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:


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"}

$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")) ){
} else { $f }
} else { $d }

Listing permissions for Sharepoint 2010 – including information about inheritable permissions lists/libraries and files

I am about to describe my struggling with SCCM 2007 to 2012 upgrade, but just before that I would like to share with you guys a script I was dreaming to have time to write to.

I am talking about script that is listing permissions for sharepoint and all libraries and files that don’t inherit permissions.

It was slightly a horrible nightmare for me to list permissions for the web application – there was a time, where users had power to grant permissions for folders and files. After a couple of years there was an idea from the managment – let’s take back those permissions and put everythign in User Rights Management system…

First thought:


Second – pretty much the same:


Finally I had some time and written a script that lets me to specify precisely on what file in what library who the hell has permissions 😀

Here it is:

$url = &quot;http://&lt;WEB_APPLICATION_NAME&gt;&quot;
$site = Get-SPWeb ($url)
$pliki = @()&lt;/span&gt;

foreach ($web in $site.Site.AllWebs)

# if ($web.Url.StartsWith($url)) { # Uncomment for listing whe whole web application

if ($web.Url -match &quot;http://&lt;WEB_APPLICATION_NAME&gt;/&lt;SOME_FOLDER&gt;&quot;) { #Uncomment to list just one particular site


$host.ui.RawUI.ForegroundColor = “Green”;
Write-Host (&quot;PErmissions for website &quot; + $web.Name + &quot; ,Url: &quot; + $web.Url)
$lists = $web.Lists
Write-Host &quot;Website contains the content libraries:&quot;
$host.ui.RawUI.ForegroundColor = “white”;
foreach ($list in $lists) {

# (START) Getting the files with non heritable permissions
foreach ($ll in $list.items){
if ($ll.HasUniqueRoleAssignments -match &quot;True&quot;){
$e = $ll.url
foreach ($upr_f in $ll.RoleAssignments){
$f = $
$g = $upr_f.RoleDefinitionBindings | foreach {$}
$paczka = &quot;$e,$f,$g&quot;
$pliki += $paczka
# (END) Getting the files with non heritable permissions

# (START) Getting the list/libraries with inheritable permissions

$l = $list.folders
foreach ($upr in $l){

#   if ($ -match &quot;Systemy - admini&quot;){ #Uncoment if you would like to list particular list/library, do not forget
#   to uncommenct the bracket below
$a= $upr.Url
$b = $upr.HasUniqueRoleAssignments

if ($b -eq &quot;True&quot;){
$host.ui.RawUI.ForegroundColor = “green”;
Write-Host &quot;The list/library with unique permissions:&quot;
$host.ui.RawUI.ForegroundColor = “yellow”;

foreach ($u in $upr.RoleAssignments){
$c = $
$d = $u.RoleDefinitionBindings | foreach {$}
Write-Host &quot;$a, $c, $d&quot;

if ($pliki) {
$host.ui.RawUI.ForegroundColor = “Green”;
Write-Host &quot;Files with unique permissions&quot;
$host.ui.RawUI.ForegroundColor = “yellow”;

$pliki = @()
$host.ui.RawUI.ForegroundColor = “Green”;
Write-host &quot;#-------------&quot;
$host.ui.RawUI.ForegroundColor = “white”;
#   } Bracket for &quot;IF&quot; specifying list/library

# (END) Getting the list/libraries with inheritable permissions