0

I have a php script which parses xml file. I want to create plugin for Nagios, which will use that php script, or any other solution that would parse the xml file for attribute to change and monitor it via Nagios. Is it possible?

1 Answer 1

1

This is definitely possible, but it has a complication that you may not have addressed. In order to monitor for a change, you must have a way of recording the "previous" value outside of the PHP script in question - simply parsing the XML won't let you know if anything is changed, it will only let you compare against constant values.

Ultimately, the create a Nagios plugin, you need something that generates the appropriate return code and (optionally) outputs a single line with the Nagios status first. An example OK message would be:

OK - value unchanged

and an example warning message would be:

WARN - value unknown

and an example critical message would be:

CRIT - value changed to something bad

See https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/pluginapi.html for details of how to write a Nagios plugin - the language used is immaterial as long as the return code is correct.

2
  • That seems to be difficult codding stuff. i kinda hoped for ready plugin for running php scripts for nagios. Commented Oct 5, 2016 at 6:40
  • not you to write of course, but there should be plugins all over the internet, i can't find any php script related Commented Oct 5, 2016 at 10:14

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.