Page 1 of 3
Turn off monitoring for servers shutdown gracefully.
Posted: Wed Aug 05, 2020 9:25 am
by NagiosIMCS
Can you help me please?
I am new to Nagios so apologies if I am asking something obvious I couldn't find anything online.
We have a number of servers in AWS and Azure that are only powered on when required to limit costs. They are automatically started and then shutdown when they have been finished with. There is no set date or time when this might occur. When the servers are powered on and off is totally out of my remit
Is it possible that if a server is shutdown gracefully Nagios wont alarm on the server in question but instead be aware that it has been shutdown by design.
Thank you for your help and recommendations.
Re: Turn off monitoring for servers shutdown gracefully.
Posted: Wed Aug 05, 2020 4:29 pm
by benjaminsmith
Hi
@NagiosIMCS,
That's a great question, and this could be easily worked out if you set up a simple script to
automatically run on startup and shutdown.
Within the script, you can either run API calls to turn off notifications or put the host and service is scheduled downtime. One advantage of using scheduled downtime is the ability to include or exclude this into your Availability Reports.
Configuring Downtime In Nagios XI
To see example API commands, in the Nagios XI interface, go to Help > API Docs > System Reference > Scheduled Downtime
Let us know if that would work for you.
Re: Turn off monitoring for servers shutdown gracefully.
Posted: Thu Aug 06, 2020 6:00 am
by NagiosIMCS
Thank you very much Ben I will look into this.
Very helpful thank you very much.

Re: Turn off monitoring for servers shutdown gracefully.
Posted: Thu Aug 06, 2020 3:49 pm
by benjaminsmith
Very helpful thank you very much.

Happy to help! We'll keep this open if you have any more questions.
Re: Turn off monitoring for servers shutdown gracefully.
Posted: Tue Sep 08, 2020 6:38 am
by NagiosIMCS
Hi Ben,
I hope you are well apologies for the long delay. I have been working on other things so this has taken a back seat.
Hope you don't mind me asking do you have an sample scripts to achieve this please? All the servers are running Windows.
Would really appreciate it. My research hasn't been that fruitful.
Thank you for all your help.

Re: Turn off monitoring for servers shutdown gracefully.
Posted: Tue Sep 08, 2020 5:52 pm
by benjaminsmith
Hi,
Thank you for all your help.
No problem! Let me do a little testing here and I'll follow up shortly with some suggestions.
Benjamin
Re: Turn off monitoring for servers shutdown gracefully.
Posted: Wed Sep 09, 2020 9:14 am
by NagiosIMCS
Thank you Ben greatly appreciated.
I am still struggling with Nagios.
Thank you so much.
Stephen P
Re: Turn off monitoring for servers shutdown gracefully.
Posted: Thu Sep 10, 2020 10:48 am
by benjaminsmith
Hi Stephen,
After digging into this further, what operating systems are these AWS and Azure VM's running?
Benjamin
Re: Turn off monitoring for servers shutdown gracefully.
Posted: Fri Sep 11, 2020 7:58 am
by NagiosIMCS
Hi Ben,
Thank you for the response, they are pretty much running Windows servers 2012 to Windows 2016.
Thank you very much for your help and have a good weekend.
Stephen P
Re: Turn off monitoring for servers shutdown gracefully.
Posted: Fri Sep 11, 2020 4:39 pm
by ssax
You would need to do it like this (or through group policy):
https://docs.microsoft.com/en-us/previo ... 0(v=ws.11)
Note that in order to do this you'll need to know the exact hostname in XI, it's case-sensitive and would need to match exactly to what the servername is in order for it to work.
Are you trying to schedule downtime for the host and all it's services, disable notifications for the host and all it's services, or disable checks from even occurring for the host and all of it's services?
Either way, once we know that you're essentially going to need to write a script that calls this API endpoint:
- Go there and look at the example
Code: Select all
http://YOURXISERVER/nagiosxi/help/api-system-reference.php#system-core-command
Then you're going to submit some of these (depending on what you want to accomplish) through the API endpoint above:
https://old.nagios.org/developerinfo/externalcommands/
There will be two scripts, one for startup and one for shutdown. Once you let us know what you'd prefer to do (downtime, disable notifications, disable checks) that will give us more to go for what the scripts should be like.