IBM Tivoli Storage Manager (TSM) – monitoring DB backup state with ZABBIX.

Hi Guys,

If you would like to monitor your TSM server with ZABBIX for ex., here are some useful selects to TSM database. Below are user parameters that has to be put in zabbix_agentd.conf:

UserParameter=Scratch,%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe /nologo “C:\zabbix\TsmInformation.ps1 1”
UserParameter=Buffhit,%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe /nologo “C:\zabbix\TsmInformation.ps1 2”
UserParameter=FreeSpaceDb,%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe /nologo “C:\zabbix\TsmInformation.ps1 3”
UserParameter=FreeSpaceLog,%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe /nologo “C:\zabbix\TsmInformation.ps1 4”
UserParameter=SchedulesMissed,%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe /nologo “C:\zabbix\TsmInformation.ps1 5”
UserParameter=SchedulesFailed,%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe /nologo “C:\zabbix\TsmInformation.ps1 6”
UserParameter=PathsOffline,%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe /nologo “C:\zabbix\TsmInformation.ps1 7”
UserParameter=HighSGTUtilization,%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe /nologo “C:\zabbix\TsmInformation.ps1 8”
UserParameter=RwErrors,%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe /nologo “C:\zabbix\TsmInformation.ps1 9”
UserParameter=UnVolumes,%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe /nologo “C:\zabbix\TsmInformation.ps1 10”
UserParameter=UnHosts,%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe /nologo “C:\zabbix\TsmInformation.ps1 11”
UserParameter=Scratch_BCKP,%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe /nologo “C:\zabbix\TsmInformation.ps1 12”
UserParameter=Scratch_OFF,%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe /nologo “C:\zabbix\TsmInformation.ps1 13”
UserParameter=TsmBackupStatus,%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe /nologo “C:\zabbix\TsmInformation.ps1 14”

And here is a powershell script that retrieves those pieces of information:



param($select)

switch ($select)
{
1 {$select = "select count(*) as Scratch from libvolumes where status='Scratch'"}
2 {$select = "select buff_hit_ratio from db"}
3 {$select = "select cast((free_space_mb/1024) as decimal(8,2)) from db"}
4 {$select = "select free_space_mb/1024 from log"}
5 {$select = "select count(*) from events where status='Missed'"}
6 {$select = "select count(*) from events where status='Failed'"}
7 {$select = "select count(*) from paths where NOT online='YES'"}
8 {$select = "select count(*) from stgpools where pct_utilized>95"}
9 {$select = "select count(*) from volumes where read_errors>0 or write_errors>0"}
10 {$select = "select count(*) from volumes where access='UNAVAILABLE'"}
11 {$select = "select count(*) from nodes where node_name NOT IN (select node_name from associations)"}
12 {$select = "select count(*) as Scratch from libvolumes where status='Scratch' and library_name='TS3310_BCKP'"}
13 {$select = "select count(*) as Scratch from libvolumes where status='Scratch' and library_name='TS3310_OFF'"}
14 {$select = "select last_backup_date from DB"}
default {"BRAK PARAMETRÓW"}
}

$a = (& C:\Progra~1\Tivoli\TSM\baclient\dsmadmc.exe -optfile=C:\Progra~1\Tivoli\TSM\baclient\dsm.opt -id=Admin -pa=<PUT_HERE_YOUR_TSM_PASSWORD> -display=list -dataonly=yes "$select")
$b = $a | Select-Object -first 1
$c = $b.split(":")
$d = $c[1].Substring(1)
#$d = $d.replace(".",",")
if ( $d -match " ") {
$e = $d.split(" ")
$f = $e[0].Substring(0)
$d = Get-Date
$data = (get-date).ToString("yyyy-MM-dd")
$data2 = (get-date).AddDays(-1).ToString("yyyy-MM-dd")
if (($f -eq $data) -or (($f -eq $data2) -and ($d.Hour -lt "10")) ){
"BACKUP UP TO DATE"
} else { $f }
} else { $d }

Advertisements