RE: [Nagios-devel] RE: SNMP community in host configuration

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

RE: [Nagios-devel] RE: SNMP community in host configuration

Post by Guest »

Hi,

Did anybody test the patch ?=20


Patrick

> Envoy=E9 : mardi 21 d=E9cembre 2004 16:04
> =C0 : 'nagios-devel'
> Objet : [Nagios-devel] RE: SNMP community in host configuration
>=20
> Hi,
>=20
> I updated my patch. Works with today's CVS : "patch -p0 patch_nag_snmp_2004.12.21.patch" :
>=20
> - added "snmp_community" in host/template definition,=20
> accessed by $SNMPCOMMUNITY$ macro.
>=20
> - Changed the "hostuser" macro in "hostmacro" :=20
> - in host/template definition : "hostmacro SomeData"
> - In services : "$HOSTMACRO$"
>=20
> - In nagios.cfg, the option is now named "host_snmp_login",=20
> same syntax.=20
>=20
> As usual, feedbacks are welcome !
>=20
> Patrick
> nagios AT proy.org
> =20
> > How to patch :=20
> > - it work with the CVS version of 19 Dec 2004
> > - in the "nagios-cvs" directory : "patch -p0 patch_nag_snmp.patch"
> >=20
> > Note : only works with template based config files.
> >=20
> > I tested it on Linux only for now, but as nothing is platform=20
> > specific, it should be OK.
> > Here are the modified files (if a new CVS version is out) :=20
> > - common/objects.c base/config.c base/nagios.c base/utils.c=20
> > include/common.h include/objects.h include/nagios.h.in=20
> > xdata/xodtemplate.c xdata/xodtemplate.h
> >=20
> >=20
> > What it does :
> >=20
> > 1) SNMP for each host
> >=20
> > You can put snmp information in three ways :=20
> > - In the host definition :
> > snmp_version # stores snmp version
> > snmp_login # stores snmp login (for v3)
> > snmp_pass # stores snmp password for v3 or=20
> > community for
> > v1
> > None of them are compulsory of course
> > - In the host template (will then only overwrite what's not in host
> > definition)
> > Same syntax
> >=20
> > - In the nagios.cfg file :=20
> > snmp_login=3D1,,/
> > snmp_login=3D3,,,/
> > =09
> > This is generic snmp login for networks : it will be=20
> put in the host
>=20
> > snmp info if the host hasn't got any, and if it's address=20
> matches the=20
> > network/mask definition. Mask with best precision will be chosen=20
> > first.
> > Example :=20
> > snmp_login=3D1,private,10.100.0.0/16
> > snmp_login=3D3,login1,pass1,10.100.0.3/32
> >=20
> > This means :=20
> > - on the 10.100.0.0/16 network : v1, private
> > - for the 10.100.0.3 host : v3 : login1, pass1
> > =09
> > 10.100.3.45 : will get v1, private
> > 10.100.0.3 : will get v3, login1, pass1
> >=20
> > - The information is available as macro :=20
> > - $SNMPVERSION$
> > - $SNMPLOGIN$
> > - $SNMPPASS$
> > =09
> >=20
> > 2) user variables for host
> > =09
> > - Each host can have up to 10 user variables (you can put more or=20
> > less, just by modifying a number in the code), specified in its=20
> > definition :
> > hostuser
> > =09
> > example :=20
> > hostuser3 SomeInformation
> >=20
> > - Of course, host templates can have hostuser too. (will=20
> be put in=20
> > host definition is the host doesn't have the hostuser already).
> >=20
> > - Available as macro :=20
> > $HOSTUSER$
> >=20
> > TODO :=20
> > - I forgot snmp v2c : maybe 2 will be okay but it would be=20
> cleaner to=20
> > have "2c".
> > - Hostuser are from 0->9..., maybe it would be cleaner to put 1->10.
> >=20
> >=20
> > Please test it and give me feedback !
> >=20
> >=20
> > Patrick
> > nagios AT proy.org
> >=20
>=20






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked