Nagios freshness checks randomly think check results are from 1973.

Thomas Guyot-Sionnest dermoth at aei.ca
Tue Aug 12 05:23:29 CEST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/08/08 04:57 PM, fevin Kagen wrote:
> So...    is a date sent in the SNMP trap or is the date set to the
> time that Nagios receives the alert?

It's in the command sent to the Nagios command pipe.

See:

http://nagios.sourceforge.net/docs/3_0/extcommands.html
http://www.nagios.org/developerinfo/externalcommands/commandlist.php

> Is there a way to output to both the existing output (the nagios
> command file) and a debug output?  It doesn't happen all the time so
> trying to capture a bad entry would mean taking the whole system down
> for a week plus.

I never touched python before, but looks plain simple object-oriented
programming. I'd try making the post_results function looks like this:

def post_results(host, job, mondata_res, return_code):
      mytime = time.time()
      mytime = str(mytime)
      mytime = mytime[:-3]
      #print mondata_res
      output = open('/usr/local/nagios/var/rw/nagios.cmd', 'w')
      debug_out = open('/tmp/services-debug.out, 'a')
      results = "[" + mytime + "] " + "PROCESS_SERVICE_CHECK_RESULT;" \
        + host + ";" + job + ";" \
        + return_code + ";" + mondata_res + "\n"
      output.write(results)
      debug_out.write(results)

The change are oppening a 2nd file in append mode:
  debug_out = open('/tmp/services-debug.out, 'a')

And then writing the same thing as the nagios out to it:
  debug_out.write(results)

As soon as it fails check the end of that file, you should see the same
thing as what nagios received. If the [time] part is the problem thoug I
can't really help. This is the part that generated the time part:

  mytime = time.time()
  mytime = str(mytime)
  mytime = mytime[:-3]

- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIoQIx6dZ+Kt5BchYRAkQLAJ9M1m7clEuSL9LjEEwNM6hV7gCrdwCgsfK7
M0W2J7uXH1Xcbrck7Tn3ZEA=
=XWSo
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list