Decommissioning Automation
Posted: Fri Sep 24, 2021 4:59 am
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?
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?