shinken-monitoring / check_shinken

A Nagios plugin to check the status of Shinken
2 stars 1 forks source link

Patch to display type of the daemon #3

Open GuusH opened 10 years ago

GuusH commented 10 years ago

Hi,

The current version of this check returns "OK" if a daemon is running, but you can't see if that's a spare daemon or a "live" one. You can ask that of livestatus, but I thought it would be handy to have this check output it too. After applying the patch you get these kinds of results:

$ ./check_shinken.py -d receiver
OK -  spare receiver alive
$ ./check_shinken.py -d reactionner
OK -  live reactionner alive

The check uses the 'have_conf' api call, which all daemons implement, except for the arbiter. So you can't get this info for the arbiter unfortunately (it does have a have-conf method, but that's an internal one). I couldn't find the info in livestatus either, so I'm open to suggestions on how to get this info for the arbiter. Here's the patch:

$ diff check_shinken.py check_shinken.py.orig
110a111
>
113,127d113
<        if daemon != 'arbiter':
<            try:
<                result=con.get('have_conf')
<            except Exception, exp:
<                print "CRITICAL : the have_conf call to the %s failed : (%s)." % (daemon,exp)
<                raise SystemExit(CRITICAL)
<
<            if result:
<                daemon_type = 'live'
<            else:
<                daemon_type = 'spare'
<
<            print 'OK - ', daemon_type, daemon, 'alive'
<            raise SystemExit(OK)
<

I hope you will consider applying this patch. Thanks!!

Guus

Frescha commented 10 years ago

Please send a pull request, thnak you!

naparuba commented 10 years ago

Its done and merged :D

Thanks

On Fri, Jul 11, 2014 at 5:59 PM, Andreas Karfusehr <notifications@github.com

wrote:

Please send a pull request, thnak you!

— Reply to this email directly or view it on GitHub https://github.com/shinken-monitoring/check_shinken/issues/3#issuecomment-48748778 .