Hi everyone,
I need some advise please.
I have come across this article:
https://serverfault.com/questions/58966 ... dows-linux
This is basically what I am trying to achieve. Once the host is shutdown a script executes that places the host into downtime.
This aforementioned article stipulates that its for both Windows and Linux.
How would I run the following script from a Windows server? Is it even possible?
now=`date +%s`
#Check first path nagios.cmd & printf
commandfile='/var/lib/nagios3/rw/nagios.cmd'
/usr/bin/printf "[%lu] DISABLE_HOST_NOTIFICATIONS;my-host\n" $now > $commandfile
Any help greatly appreciated apologies if I am asking silly questions
Command Line from Windows Servers
Re: Command Line from Windows Servers
Not a silly question at all. It's a great idea to have your servers put themselves in downtime when they go through a graceful shutdown.
That particular Stack link is for Nagios Core. You have a couple of different options available to you in Nagios XI. Most notably, the Nagios XI API. If you log into the Nagios XI web interface and go to Help -> API Docs -> System Reference, there is a section specifically for scheduling downtime.
The example is using the curl command, but if you need to execute this API call from a Windows machine, Powershell may be the way to go. The Invoke-WebRequest cmdlet is very similar to curl in functionality.
Take a look at the API documentation, and let me know if this would be a good route to build your solution around.
That particular Stack link is for Nagios Core. You have a couple of different options available to you in Nagios XI. Most notably, the Nagios XI API. If you log into the Nagios XI web interface and go to Help -> API Docs -> System Reference, there is a section specifically for scheduling downtime.
The example is using the curl command, but if you need to execute this API call from a Windows machine, Powershell may be the way to go. The Invoke-WebRequest cmdlet is very similar to curl in functionality.
Take a look at the API documentation, and let me know if this would be a good route to build your solution around.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
NagiosIMCS
- Posts: 20
- Joined: Mon Mar 19, 2018 2:55 pm
Re: Command Line from Windows Servers
Thank you

-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: Command Line from Windows Servers
Hi,
Your welcome. Let us know if you have any other questions or if we may close this thread.Thank you![]()
![]()
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!