Decommissioning Automation

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
danniiffxi
Posts: 121
Joined: Tue Jan 30, 2018 3:29 am
Location: UK

Decommissioning Automation

Post by danniiffxi »

Hi Guys,

I was just wondering if anyone has had any experience with using PowerShell on CentOS7 for removal of Nagios entries? We are currently in the early stages of automating our decommissioning process, part of which is removing the server in question from Nagios XI.

I already use a series of custom PowerShell scripts to create the Nagios cfg files when adding new servers & services from a .csv on a Windows machine, I then SCP the files to appropriate folders on the nagios server are run /usr/local/nagiosxi/scripts/reconfigure_nagios.sh, so I can add hundreds of servers to Nagios in a matter of mins.

But now I want to be able to remove entries using purely PowerShell which is slightly more challenging as it will require the script to SSH to the Nagios server, remove entries from the 'hostgroup.cfg' where when adding it imply appends the exiting file, unless I stick with removing hostgroups manually and just go for removal of 'servername'.cfg and then run /usr/local/nagiosxi/scripts/reconfigure_nagios.sh.

Any suggestions?
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Decommissioning Automation

Post by benjaminsmith »

Hi,

Full disclosure, you are much better at Powershell than I am :) . However, we have team members who are pretty good with it and I can consult them.

That said, I would recommend using the REST API as you can communicate over HTTP, and it won't being necessary to login with SSH and move files around.

Log into Nagios XI and go to Help > API Docs and review the commands in Config Reference, that's the best way to add/remove hosts or services programmatically.

Are you currently updating the cfg files directly in the static directory?

--Benjamin
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