Page 1 of 1

Bulk Change SNMP Community strings in NagiosXI

Posted: Thu Aug 19, 2021 1:48 pm
by cgreve
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?

Re: Bulk Change SNMP Community strings in NagiosXI

Posted: Fri Aug 20, 2021 12:46 pm
by ssax
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

Posted: Tue Sep 07, 2021 12:30 pm
by cgreve
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';"
This is exactly what I was looking for thank you!

Re: Bulk Change SNMP Community strings in NagiosXI

Posted: Tue Sep 07, 2021 5:04 pm
by ssax
Great, let us know when we're okay to lock this up and mark it as resolved.