Code: Select all
#!/usr/bin/perl
$response = `/bin/check_nt -H $ARGV[0] -p 1248 -v CPULOAD -l 10,80,95`;
chomp $response;
($load) = ($response =~ /min. (\d+)\%\)/);
print "$load\n";
#!/usr/bin/perl
$active_sessions= `/usr/lib/nagios/plugins/check_nt -H $ARGV[0] -p 1248 -v COUNTER -l "\\Terminal Services\\Active Sessions"`;
chomp $active_sessions;
$inactive_sessions= `/usr/lib/nagios/plugins/check_nt -H $ARGV[0] -p 1248 -v COUNTER -l "\\Terminal Services\\Inactive Sessions"`;
chomp $inactive_sessions;
print "active:$active_sessions inactive:$inactive_sessions\n";
The problem is I can not get the SQL examples to work. I get NANs or sometimes I actually get Zeros. If I run from command line I get the proper return, but never from the perl script. Obviously it is in the Perl script. Any help would be great.
A little information:
Cacti version: 0.8.7a on CentOS
SQL Sever: 2003svr 64bit running SQL2000 32bit. (I think this is the problem - 32 bit counters on 64 bit system)
NSClient installed on servers.
Examples:
Code: Select all
#!/usr/bin/perl
$sql_trans_sec = `/usr/lib/nagios/plugins/check_nt -H $ARVG[0] -p 1248 -v COUNTER -l "\\SQLServer:Databases(_Total)\Transactions/sec"`;
chomp $sql_trans_sec;
print "sql_trans_sec:$sql_trans_sec\n";
#!/usr/bin/perl
$sql_fscans = `/usr/lib/nagios/plugins/check_nt -H $ ARVG[0] -p 1248 -v COUNTER -l "\\SQLServer:Buffer Manager\Buffer cache hit ratio"`;
chomp $sql_fscans;
print "sql_fscans:$sql_fscans\n";
And many more for SQL.
Is the problem in the Perl script or is it something to do with the 32 bit version of SQL on the 64 bit OS? When I run from command line:
Code: Select all
scripts]# /usr/lib/nagios/plugins/check_nt -H 10.0.20.7 -p 1248 -v COUNTER -l "\\SQLServer:Buffer Manager\Buffer cache hit ratio"
I get 100, which is correct. When I run any of the SQL check_nt scripts from command line I get the correct response.
Additionally, when I run any of the .pl for SQL from command line
Code: Select all
scripts]# /usr/bin/perl check_nt_bchr.pl
I get Zero. As in 0. Not a NAN. I have about 6 other .pl that I have made from information I obtained here and they work great. It is just the SQL. If you need any more info, let me know.