mirror of
https://github.com/opinkerfi/nagios-plugins.git
synced 2024-11-22 18:33:45 +01:00
Draft of check_mssql_dbsize.pl added
This commit is contained in:
parent
1d490fe596
commit
2778fcb5a4
34
check_mssql/trunk/check_mssql_dbsize.pl
Normal file
34
check_mssql/trunk/check_mssql_dbsize.pl
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#
|
||||||
|
# This script will check MSSQL Database size via check_nrpe and NSclient. returns performance data in Nagios format
|
||||||
|
# Author Pall Sigurdsson <palli@opensource.is>
|
||||||
|
#
|
||||||
|
|
||||||
|
$HOSTNAME=$ARGV[0];
|
||||||
|
|
||||||
|
|
||||||
|
$databases = `check_nrpe -H $HOSTNAME -c listCounterInstances -a "SQLServer:Databases"`;
|
||||||
|
@array1 = split(/\,/, $databases);
|
||||||
|
|
||||||
|
|
||||||
|
#[root@nagios ~]# check_nrpe -H $HOSTNAME -c CheckCounter -a "Counter:Vanskilaskra=\SQLServer:Databases(Vanskilaskra)\Data File(s) Size (KB)"# OK all counters within bounds.|'Vanskilaskra'=30996480;0;0;
|
||||||
|
$num_databases = 0;
|
||||||
|
$perfdata = "";
|
||||||
|
foreach $database (@array1)
|
||||||
|
{
|
||||||
|
# Strip whitespace
|
||||||
|
$database =~ s/^\s*(.*?)\s*$/$1/;
|
||||||
|
|
||||||
|
# Call check_nrpe
|
||||||
|
$dbSize = `check_nrpe -H $HOSTNAME -c CheckCounter -a 'Counter:$database=\\SQLServer:Databases($database)\\Data File(s) Size (KB)'`;
|
||||||
|
|
||||||
|
# Strip everything but the performance data
|
||||||
|
$dbSize =~ s/^.*\|(.*?)$/$1/;
|
||||||
|
chomp($dbSize);
|
||||||
|
$perfdata = $perfdata . " " . $dbSize;
|
||||||
|
$num_databases = $num_databases + 1;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
print "$num_databases databases found | $perfdata \n";
|
Loading…
Reference in New Issue
Block a user