[Nagiosplug-devel] SNMP community in host configuration

Patrick Proy nagios at proy.org
Sun Dec 19 07:58:01 CET 2004

> Yes i am willing to test it ;-)
> --
> Benoit Mortier

OK, so here it is ! :-)

Maybe this thread should now be nagios-devel ML but it started here... And
it's only for test now

How to patch : 
 - it work with the CVS version of 19 Dec 2004 
 - in the "nagios-cvs" directory : "patch -p0 < patch_nag_snmp.patch"

Note : only works with template based config files.

I tested it on Linux only for now, but as nothing is platform specific, it
should be OK.
Here are the modified files (if a new CVS version is out) : 
- common/objects.c base/config.c base/nagios.c base/utils.c include/common.h
include/objects.h include/nagios.h.in xdata/xodtemplate.c

What it does :

1) SNMP for each host

You can put snmp information in three ways : 
- In the host definition :
	snmp_version <int>    # stores snmp version
	snmp_login <string>   # stores snmp login (for v3)
	snmp_pass  <string>   # stores snmp password for v3 or community for
None of them are compulsory of course
- In the host template (will then only overwrite what's not in host
	Same syntax

- In the nagios.cfg file : 
	This is generic snmp login for networks : it will be put in the host
snmp info if the host hasn't got any, and if it's address matches the
network/mask definition. Mask with best precision will be chosen first.
	Example : 

	This means : 
	- on the network : v1, private
	- for the host : v3 : login1, pass1 : will get v1, private : will get v3, login1, pass1

- The information is available as macro : 

2) user variables for host
- Each host can have up to 10 user variables (you can put more or less, just
by modifying a number in the code), specified in its definition : 
	hostuser<n>	<string>
	example : 
	hostuser3	SomeInformation

- Of course, host templates can have hostuser<n> too. (will be put in host
definition is the host doesn't have the hostuser<n> already).

- Available as macro : 

- I forgot snmp v2c : maybe 2 will be okay but it would be cleaner to have
- Hostuser are from 0->9..., maybe it would be cleaner to put 1->10.

Please test it and give me feedback !

nagios AT proy.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_nag_snmp.patch
Type: application/octet-stream
Size: 29602 bytes
Desc: not available
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20041219/88b3b094/attachment.obj>

More information about the Devel mailing list