SpecialK Posted March 28, 2008 Share Posted March 28, 2008 Hello, i have a little script which does some tests and then return the results to nagios. Nagios is waiting for an exit code to decide if a result status is ok, critical or in a warning state. That works well. But it is also possible that nagios receives a "echo" answer together with the exit code, so that you can see the answer in the nagios web interface. Here is an example batch file: @echo OK: Everything is going to be fine. @exit 0 When a nagios check call this script, i receive a green "ok" answer with the text "Everythin is going to be fine." My little test script looks like this: $ip = IniRead ("scriptconfig.ini", "IP", "IP", "14.14.14.14") $check = ping ($ip) if $check = 0 Then exit (2) Else exit (0) EndIf You see, i get the correct error code but i don't know how to set an answer for nagios. RunWait (@COMSPEC & " /c echo Ping ok") does not work. I hope someone can help me. SpecialK Link to comment Share on other sites More sharing options...
Talder Posted May 23, 2008 Share Posted May 23, 2008 Hi SpecialK, use a consolewrite() before your exit() Just tested this out and works like a charm! Greets, Tim Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now