check_snmp and mulitple oid returns

Subhendu Ghosh sghosh at sghosh.org
Mon Jan 27 16:28:43 CET 2003


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. 
> 
>  --

regex matches are currtnely limited to a single oid...  will change on the 
next rewrite of check_snmp to remove the 8 oid limit.

-- 

-sg



-------------------------------------------------------
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