Sign in to follow this  
Followers 0
SpecialK

AutoIT Script and Nagios: How to enable an echo answer?

2 posts in this topic

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

Share this post


Link to post
Share on other sites



Hi SpecialK,

use a consolewrite() before your exit()

Just tested this out and works like a charm! :)

Greets,

Tim

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0