SNMP community in host configuration (add a generic userarg command ?)
Patrick Proy
nagios at proy.org
Wed Jan 12 10:47:58 CET 2005
Hi,
It's a very good idea too.
It shouldn't be very difficult to implement this using my patch, but what
I've done already is enough for me (I just need snmp info). As very few
people (you and me ?) are interested by this kind of feature I won't go any
further.
Patrick
nagios AT proy.org
> -----Message d'origine-----
> De : nagios-devel-admin at lists.sourceforge.net
> [mailto:nagios-devel-admin at lists.sourceforge.net] De la part
> de Michael Medin
> Envoyé : mercredi 12 janvier 2005 09:42
> À : Andreas Ericsson; Patrick Proy
> Cc : nagios-devel
> Objet : RE: [Nagios-devel] RE: SNMP community in host
> configuration (add a generic userarg command ?)
>
> Hi,
>
> How about adding some form of prefix to settings like:
>
> define host{
> ...
> userargs MYOWNKEY "This is a value"
> ...
> }
>
> That gets translated into: $MYOWNKEY$ when a command is executed?
> That would allow people that have a need for user settings to
> use them and still not fill up the namespace. I know this
> might be useful for me as I have certain keys that are used
> changing based on "host groups" (read templates). For
> instance snmp community strings (and for that matter
> authorization tokens). Then I could derive all hosts using a
> certain snmp community from the same template? Also along
> this line something I have been wanting is "multiple
> inheritance" (don't laugh :). This would allow me to cross
> inherit settings from various classes.
> To make an example of what I mean:
> A server have different aspects:
> 1, contact settings (all our notes servers are "owned" by the
> same support group).
> 2, check frequency (test/verification systems need to be
> check less then ones that are serving users).
>
> This is two aspects that could be inherited but are distinct
> (as in not the same) as we have notes-servers that are test
> and ones that are serving users. We also have the same
> aspects on other server groups.
>
> Now this might be possible already (haven't tired, I just
> assumed that it couldn't be done)
>
> If it sounds like a reasonable thing to do I could look into
> implementing it for nagios 2.0 but if it just me being
> deluded I can also manage this in my config files :)
>
> // Michael Medin
>
> -----Original Message-----
> From: nagios-devel-admin at lists.sourceforge.net
> [mailto:nagios-devel-admin at lists.sourceforge.net] On Behalf
> Of Andreas Ericsson
> Sent: den 11 januari 2005 16:33
> To: Patrick Proy
> Cc: 'nagios-devel'
> Subject: Re: [Nagios-devel] RE: SNMP community in host configuration
>
> Patrick Proy wrote:
> > Hi,
> >
> > Did anybody test the patch ?
> >
>
> Like I told you before you went along hacking up this patch,
> it addresses a very limited usergroup. I believe most
> networks have at the most two or three snmp
> communities/username-password-pairs.
>
> >
> > Patrick
> >
> >
> >>Envoyé : mardi 21 décembre 2004 16:04
> >>À : 'nagios-devel'
> >>Objet : [Nagios-devel] RE: SNMP community in host configuration
> >>
> >>Hi,
> >>
> >>I updated my patch. Works with today's CVS : "patch -p0 <
> >>patch_nag_snmp_2004.12.21.patch" :
> >>
> >>- added "snmp_community" in host/template definition, accessed by
> >>$SNMPCOMMUNITY$ macro.
> >>
> >>- Changed the "hostuser" macro in "hostmacro" :
> >> - in host/template definition : "hostmacro<n> SomeData"
> >> - In services : "$HOSTMACRO<n>$"
> >>
> >>- In nagios.cfg, the option is now named "host_snmp_login", same
> >>syntax.
> >>
> >>As usual, feedbacks are welcome !
> >>
> >>Patrick
> >>nagios AT proy.org
> >>
> >>
> >>>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 xdata/xodtemplate.h
> >>>
> >>>
> >>>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
> >>>v1
> >>>None of them are compulsory of course
> >>>- In the host template (will then only overwrite what's not in host
> >>>definition)
> >>> Same syntax
> >>>
> >>>- In the nagios.cfg file :
> >>> snmp_login=1,<comunity>,<network>/<mask>
> >>> snmp_login=3,<login>,<pass>,<network>/<mask>
> >>>
> >>> 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 :
> >>> snmp_login=1,private,10.100.0.0/16
> >>> snmp_login=3,login1,pass1,10.100.0.3/32
> >>>
> >>> This means :
> >>> - on the 10.100.0.0/16 network : v1, private
> >>> - for the 10.100.0.3 host : v3 : login1, pass1
> >>>
> >>> 10.100.3.45 : will get v1, private
> >>> 10.100.0.3 : will get v3, login1, pass1
> >>>
> >>>- The information is available as macro :
> >>> - $SNMPVERSION$
> >>> - $SNMPLOGIN$
> >>> - $SNMPPASS$
> >>>
> >>>
> >>>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 :
> >>> $HOSTUSER<n>$
> >>>
> >>>TODO :
> >>>- I forgot snmp v2c : maybe 2 will be okay but it would be
> >>
> >>cleaner to
> >>
> >>>have "2c".
> >>>- Hostuser are from 0->9..., maybe it would be cleaner to
> put 1->10.
> >>>
> >>>
> >>>Please test it and give me feedback !
> >>>
> >>>
> >>>Patrick
> >>>nagios AT proy.org
> >>>
> >>
> >
> >
> >
> > -------------------------------------------------------
> > The SF.Net email is sponsored by: Beat the post-holiday blues Get a
> > FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> > It's fun and FREE -- well,
> almost....http://www.thinkgeek.com/sfshirt
> > _______________________________________________
> > Nagios-devel mailing list
> > Nagios-devel at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/nagios-devel
> >
>
> --
> Andreas Ericsson andreas.ericsson at op5.se
> OP5 AB www.op5.se
> Lead Developer
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> _______________________________________________
> Nagios-devel mailing list
> Nagios-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-devel
>
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> _______________________________________________
> Nagios-devel mailing list
> Nagios-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-devel
>
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
More information about the Developers
mailing list