Page 1 of 1

Trigger script on critical alert

Posted: Mon Nov 20, 2017 7:50 pm
by absarcompass
Hi Team,
I am just curious if there is a possibility of achieving batch/shell or windows script to run when a critical alarm occur.

Scenario:
There are two Windows Server with same IP address but only one stays alive so if we lose ping on Server 'A' the other server, 'B', should get A's IP address via script.
if it is achievable then what should be the line of action?

Any help will be appreciated :)

Re: Trigger script on critical alert

Posted: Tue Nov 21, 2017 12:45 pm
by npolovenko
@absarcompass, This depends on what agent you're using. In NSClient you can make a script and put it into a scripts folder. Here's an example: https://assets.nagios.com/downloads/nag ... ios-XI.pdf It's not exactly what you want but it'll walk you through the process of creating and configuring a custom script to run with NSClient.
Also, I don't know the whole plan of action but implementing this technique might be a little overkill. Why not build a script locally with a simple ping command from one server to another?
Also, Nagios XI has event handler option. So you probably already monitor host A and B with XI, you can add a custom event handler script to do something when server X goes down.
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
And the first link has more info on event handlers as well, if you scroll to the bottom.