Command Line from Windows Servers

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
NagiosIMCS
Posts: 20
Joined: Mon Mar 19, 2018 2:55 pm

Command Line from Windows Servers

Post by NagiosIMCS »

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
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: Command Line from Windows Servers

Post by mbellerue »

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.
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!
NagiosIMCS
Posts: 20
Joined: Mon Mar 19, 2018 2:55 pm

Re: Command Line from Windows Servers

Post by NagiosIMCS »

Thank you :D :D
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Command Line from Windows Servers

Post by benjaminsmith »

Hi,
Thank you :D :D
Your welcome. Let us know if you have any other questions or if we may close this thread.
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!
Locked