check_snmp and mulitple oid returns

jgking at packetstorm.org jgking at packetstorm.org
Mon Jan 27 16:22:11 CET 2003


Thanks!

Yeah i found the note in the help output shortly after posting. I found a 
mechanism though (didnt send it last post so ill post it here for anyone 
in the future) that seems to work:

libexec/check_snmp -H localhost -o 
.1.3.6.1.4.1.2021.9.1.100.1,.1.3.6.1.4.1.2021.9.1.100.2,.1.3.6.1.4.1.2021.9.1.100.3,.1.3.6.1.4.1.2021.9.1.100.4,.1.3.6.1.4.1.2021.9.1.100.5,.1.3.6.1.4.1.2021.9.1.100.6 
-C ***** -c 0,0,0,0,0,0

would produce the desired output

SNMP CRITICAL - 0 0 0 *1* 0 0



On Mon, 27 Jan 2003, Karl DeBisschop wrote:

> jgking at packetstorm.org writes: 
> 
> > 
> > Ive been searching the list archives for the last 30 minutes have been 
> > having alot of hits close to it but either im not understanding or its 
> > different than what im asking. 
> > 
> > Instead of having, say 5 seperate snmp check entries in the services.cfg 
> > file, i would rather consolidate it into one single check and look for an 
> > oid return value that meets the error criteria. 
> > 
> > For example, disk percent usage.  
> > 
> > In snmpd.conf i setup the following: 
> > 
> > disk / 10000
> > disk /boot 10000
> > disk /data 10000
> > disk /home 817928
> > disk /tmp  10000
> > disk /usr 10000
> > disk /var 10000 
> > 
> > Now that this will do is set the errorflag field if anything matches  
> > 
> > .iso.3.6.1.4.1.2021.9.1.101.1 = ""
> > .iso.3.6.1.4.1.2021.9.1.101.2 = ""
> > .iso.3.6.1.4.1.2021.9.1.101.3 = ""
> > .iso.3.6.1.4.1.2021.9.1.101.4 = "/home: less than 817928 free (= 807928)"
> > .iso.3.6.1.4.1.2021.9.1.101.5 = ""
> > .iso.3.6.1.4.1.2021.9.1.101.6 = "" 
> > 
> > 
> > In my checkcommands file I have the following: 
> > 
> > define command{
> >         command_name    check_snmp
> >         command_line    $USER1$/check_snmp -H $ARG1$ -o $ARG2$ -s $ARG3$ 
> > -C $ARG4$ 
> >         } 
> > 
> > 
> > And in the services file I have this 
> > 
> > define service{
> >         use                             generic-service         ; Name of 
> > service template to use 
> > 
> >         host_name                       localhost
> >         service_description             Disk: Usage
> >         is_volatile                     0
> >         check_period                    24x7
> >         max_check_attempts              3
> >         normal_check_interval           5
> >         retry_check_interval            1
> >         contact_groups                  admins
> >         notification_interval           120
> >         notification_period             24x7
> >         notification_options            w,u,c,r
> >         check_command                   
> > check_snmp!localhost!.1.3.6.1.4.1.2021.9.1.101.1,.1.3.6.1.4.1.2021.9.1.101.2,.1.3.6.1.4.1.20
> > 21.9.1.101.3,.1.3.6.1.4.1.2021.9.1.101.4,.1.3.6.1.4.1.2021.9.1.101.5,.1.3.6.1.4.1.2021.9.1.101.6!""!*******
> >         } 
> > 
> > 
> > Which I find returns an OK unless the last oid checked is the one that 
> > fails.  
> > 
> > So is there a way to have check_snmp return a fail if any oid in the group 
> > fails? 
> 
> The string check only applies to one OID - it does not default across the 
> bunch (though on reflection, perhaps it should). This is true of any retrun 
> type. 
> 
> I know from memory that you can read the free bytes and specify multiple 
> critcal and warning thresholds to get the behaviour you want. I don't recall 
> if it works that way for strings, or if it is still to be implemented - read 
> the source to see, I guess. 
> 
>  --
> Karl
> 
> 
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> 



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com




More information about the Users mailing list