[Nagiosplug-devel] Check M$SQL server by snmp
Pietro Bandera
pietrob at lansystems.it
Tue Oct 19 01:12:02 CEST 2004
Hi all
I'm having problems in checking some M$SQL snmp call using a perl script
The problem is this:
The snmpcall that i want to use have this OID
.1.3.6.1.4.1.311.1.4.1.1.1.1.5
That correspond to this name "mssqlSrvState"
Unfortunatly if i call this by snmpwalk command i get:
[ftplan at dns ftplan]$ snmpwalk 10.11.108.138 public
.1.3.6.1.4.1.311.1.4.1.1.1.1.5
enterprises.microsoft.software.4.1.1.1.1.5.21.77.105.99.114.111.115.111.102.
116.32.67.111.114.112.111.114.9 7.116.105.111.110 = 1
As you can see in the answer i get a bigger OID that i think is real OID of
that call.
But if i use
Snmpget 10.11.108.138 public
enterprises.microsoft.software.4.1.1.1.1.5.21.77.105.99.114.111.115.111.102.
116.32.67.111.114.112.111.114.9 7.116.105.111.110
Or
Snmpwalk 10.11.108.138 public
enterprises.microsoft.software.4.1.1.1.1.5.21.77.105.99.114.111.115.111.102.
116.32.67.111.114.112.111.114.9 7.116.105.111.110
I got an error about "no such name"
The same problem is affecting my check_MSsql.pl perl script down here:
That's the main part of the script:
use Fcntl;
use Net::SNMP;
use strict;
use diagnostics;
# inizializza variabili
my $host = shift || "";
my $comunity = shift || "";
my ($session, $error) = Net::SNMP->session(
-hostname => $host,
-community => $comunity,
);
if (!defined($session)) {
printf("ERROR: %s.\n", $error);
exit 1;
}
my $mssqlSrvState = ".1.3.6.1.4.1.311.1.4.1.1.1.1.5";
my $result1 = $session->get_request(
-varbindlist => [$mssqlSrvState]
);
if (!defined($result1)) {
printf("ERROR: %s.\n", $session->error);
$session->close;
exit 2;
}
printf("SQL running State %s ", ($result1->{$mssqlSrvState}));
if ($result1->{$mssqlSrvState} == 3 )
{
printf ("CRITICAL SQL Stopped\n");
$session->close;
If i use it i get
[ftplan at dns libexec]# ./check_MSsql.pl 10.11.108.138 public
ERROR: Received noSuchName(2) error-status at error-index 1.
Even if i change the value of the $mssqlSrvState with the longer OID written
above i get the same answer.
Do you have any idea how to resolve it?!
I got many snmp request that i would like to use form the mssql.mib but all
of them have this problem.
Thanks a lot
Ciao
Pietro
More information about the Devel
mailing list