Hey guys,
I'm trying to change our SNMP community across all of our devices currently monitored in NagiosXI. We have multiple strings across all devices and I would like to change them all to a single string.
Currently it looks like the devices have been configured in 3 different ways:
1: Directly on the host itself - with a Free Variable named _community
2: Directly on the Service - with a Free Variable named _community
3: Template with the Free Variable named _community
I was able to run some linux commands and find where all of the community strings are stored on within NagiosCore - however from what I understand is that will get overridden as soon as someone hits apply within Nagios XI because it is apparently storing this information in a database somewhere.
Is there any way to leverage the API to accomplish this?
Bulk Change SNMP Community strings in NagiosXI
Re: Bulk Change SNMP Community strings in NagiosXI
While it's not currently possible to do through the Bulk Modifications tool, you should be able to do it through SQL like this:
- First, make sure you have a successful apply configuration config snapshot that you can revert to in Admin > Config Snapshots in case you want to revert
- This will change every free variable named _community for all templates/hosts/services that have the _community free variable defined and are set to oldcommunity to newcommunity
- First, make sure you have a successful apply configuration config snapshot that you can revert to in Admin > Config Snapshots in case you want to revert
- This will change every free variable named _community for all templates/hosts/services that have the _community free variable defined and are set to oldcommunity to newcommunity
Code: Select all
mysql -h localhost -uroot -pnagiosxi nagiosql -e "update tbl_variabledefinition set value = 'newcommunity' where name = '_community' and value = 'oldcommunity';"Re: Bulk Change SNMP Community strings in NagiosXI
This is exactly what I was looking for thank you!ssax wrote:While it's not currently possible to do through the Bulk Modifications tool, you should be able to do it through SQL like this:
- First, make sure you have a successful apply configuration config snapshot that you can revert to in Admin > Config Snapshots in case you want to revert
- This will change every free variable named _community for all templates/hosts/services that have the _community free variable defined and are set to oldcommunity to newcommunity
Code: Select all
mysql -h localhost -uroot -pnagiosxi nagiosql -e "update tbl_variabledefinition set value = 'newcommunity' where name = '_community' and value = 'oldcommunity';"
Re: Bulk Change SNMP Community strings in NagiosXI
Great, let us know when we're okay to lock this up and mark it as resolved.