[Nagiosplug-help] Re: R: [Netsaintplug-help] Check_snmp .....modify how to....

Subhendu Ghosh sghosh at sghosh.org
Thu Jul 11 09:19:03 CEST 2002


I wasn't looking through the oids...  but I have seen this in some other 
mibs where one of the oids tells you what the length of the remainder of 
the index is.

While you are still coding...

Might I make a suggestion about plugin naming...
check_snmp_xxxx

Whats the issue with the plugin guidelines?

-sg

On Thu, 11 Jul 2002 Volker.Aust at premiere.de wrote:

> Apologies for the very late answer but i can give some informations
> regarding the lan-manager mib and the question to read the state of a NT/W2K
> service with SNMP.
> 
> The '10' does not belong to the character 'C' but to the length of the
> string 'Client DNS'. If you include the parameter '-On' in the snmpwalk (or
> you have not(!) installed the lan-manager mib file for decode), then you get
> the numeric representation of the OID's and you can see the structure of the
> svSvcName and svSvcOperatingState table:
> 
> svSvcName:
> 
> enterprises.77.1.2.3.1.1.5.77.121.83.113.108 = "MySql"
> enterprises.77.1.2.3.1.1.6.65.112.97.99.104.101 = "Apache"
> enterprises.77.1.2.3.1.1.6.83.101.114.118.101.114 = "Server"
> enterprises.77.1.2.3.1.1.8.68.101.102.87.97.116.99.104 = "DefWatch"
> ...
> 
> svSvcOperatingState:
> 
> enterprises.77.1.2.3.1.3.5.77.121.83.113.108 = 1
> enterprises.77.1.2.3.1.3.6.65.112.97.99.104.101 = 1
> enterprises.77.1.2.3.1.3.6.83.101.114.118.101.114 = 1
> enterprises.77.1.2.3.1.3.8.68.101.102.87.97.116.99.104 = 1
> ...
> 
> The svSvcOperatingState table has the following structure:
> xxx.svSvcOperatingState.<length of service name>.<ascii first
> character>.<ascii second character> and so on. Only running services are
> included in the table.
> 
> The following extract is from an perl plugin (which is not yet released
> because it is not even alpha (i have problems with the plugin developer
> guidelines (it is a question for another mailing-list why i should not use
> named subroutines))) which checks the state of a service with SNMP:
> 
> my($result);
> my(%state) = ('0'=>'OK', '1'=>'WARNING', '2'=>'CRITICAL', '3'=>'UNKNOWN');
> my($oid_name) = "1.3.6.1.4.1.77.1.2.3.1.1."; # enterprises.77.1.2.3.1.1
> my($oid_oper) = "1.3.6.1.4.1.77.1.2.3.1.3."; # enterprises.77.1.2.3.1.3
> my($svcnumber) = "1.3.6.1.4.1.77.1.2.2.0"; # enterprises.77.1.2.2.0
> my($laenge) = length($service);
> my($oid) = $laenge;
> for(my($i) = 0; $i < $laenge; $i++) {
> 	$oid .= ".".ord(substr($service, $i, 1));
> }
> # print "$oid_name$oid\n"; ### debug
> $result = 2;
> my($services) = snmpget($server, $community, $port, $svcnumber, $result);
> $result = 2;
> my($value) = snmpget($server, $community, $port, $oid_oper.$oid, $result);
> my($name) = snmpget($server, $community, $port, $oid_name.$oid, $result);
> if ($value == 1) {
> 	$result = 0;
> }
> print STDOUT $state{$result}, " - $services $name $value\n";
> exit($result);
> 
> If the plugin is finished and tested I consider the submission for the
> contrib directory.
> 
> -vol
> 
> 
> Thread: [Nagiosplug-devel] Re: R: [Netsaintplug-help] Check_snmp .....modify
> how to....
> 
> Print
> Message: 8991957
> 
> FROM: Subhendu Ghosh
> DATE: 06/21/2002 00:34:20
> SUBJECT:  [Nagiosplug-devel] Re: R: [Netsaintplug-help] Check_snmp
> .....modify how to....
> 
>  
> 
> If you look through the output of snmpwalk, how will note that the last 
> "oid" when sorted in lexicographic (dictionary) order starts with 
> "Client DNS"
> 
> So a getnext with svSvcOperatingState.10  looks for the lexicographic next 
> for the ASCII code 10 which would be "C" in this case - the exact entry 
> being "Client DNS"
> 
> This is part of the reason we had a discussion a couple of months ago 
> about supporting getnext or "getcolumn" functionality in check_snmp
> on nagiosplug-* lists.
> 
> Some design work has to be acomplished to support it effectively because 
> of the existence on sparse tables in some mibs. Specially because we don't 
> want to implement a MIB reader to figure out the column vs index oid 
> values.
> 
> As a different solution have you tried NSClient to see if a particular 
> process is running ?
> 
> -sg
> 
> 
> 
> On Fri, 21 Jun 2002, Pietro Bandera wrote:
> 
> > > Well.....
> > > Thanks to your tips i get this:
> > > snmpgetnext 192.168.0.9 public
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState.10
> > > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Client DNS" = active(1)
> > > As you can see i used the snmpgetnext command and at the end of the mib
> > call "a number"
> > > I say a number because there isn't, as i can see, a valid
> > "correspondece" between the number tha i wrote 10 and the list taht i
> > got with snmpwalk command
> > > (i thought the number 10 would be "FAXCOM Queue" and not "Client DNS"
> > that is in 3 position in the following list)
> > > root at LanIt25 ~# snmpwalk 192.168.0.9 public
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Server" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Messenger" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Telefonia" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Client DNS" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Server DNS" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."VNC Server" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Client DHCP" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."RPC Locator" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Workstation" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Accesso rete" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."FAXCOM Queue" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Replica file" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Plug and Play" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Servizio SNMP" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Servizio RunAs" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Registro eventi" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Microsoft Search" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Servizi terminal" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."NetSaint NT agent" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Spooler di stampa" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Servizio Trap SNMP" = active(1)
> > enterprises.lanmanager.lanmgr-2.server.svSvcTable.svSvcEntry.svSvcOperat
> > ingState."Browser di computer" = active(1)
> > > Anyway now i can get the state value of each service but without any
> > true correspondece!!!!!!!!!!!
> > > M$ i hate you!
> > > Because this is far away of what i would!...in fact i need to write ONLY
> > the name of the service as value of a snmp_check service that would
> > check if a NT service is running or not using SNMP instead of netsaint
> > agent.
> > > By using this solution i have to write a numbre instead of the name of
> > the service and also I DON'T KNOW IF THE NUMBER WOULD BE CORRECT BECAUSE
> > THERE ISN'T ANY CORRESPONDENCE BETWEEN NUMBERS AND SERVICE
> > LIST....ARRRGGGGG!! :(
> > > Please if any of you have an idea let me know!
> > > Thanks
> > > Pietro
> > > > > Message: 2
> > Date: Thu, 20 Jun 2002 11:20:08 -0400 (EDT)
> > From: Subhendu Ghosh <<EMAIL: PROTECTED>>
> > To: <EMAIL: PROTECTED>
> > Subject: [netsaint] Re: R: [Netsaintplug-help] Check_snmp .....modify
> > how to....
> > > do an snmpwalk and see what gets returned..
> > > MS snmp agent has known bugs regarding not responding to get but
> > returning 
> > the value via getnext..
> > > -sg
> > > > -- 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> PC Mods, Computing goodies, cases & more
> http://thinkgeek.com/sf
> _______________________________________________
> Nagiosplug-help mailing list
> Nagiosplug-help at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
> 

-- 








More information about the Help mailing list