check_snmp and mulitple oid returns

Karl DeBisschop kdebisschop at mail.debisschop.net
Mon Jan 27 15:00:36 CET 2003


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




More information about the Users mailing list