How can I update the SNMP Community String via CLI or SQL?
Moderators: Developers, Moderators
How can I update the SNMP Community String via CLI or SQL?
I need to update the SNMP Community String on about 3000+ hosts. So I don't loose any graph data, both the snmp config and cacti device need updated at the same time. I don't see any way of updating a device via the CLI so can someone provide the SQL I would need to use to update the SNMP Community String on a device on cacti version 1.2.16?
Re: How can I update the SNMP Community String via CLI or SQL?
You can find snmp_community on the host table.
Make sure you only update the ones you need.
Something like this:
UPDATE host SET snmp_community = 'newstring' where snmp_community = 'oldstring';
Make sure you only update the ones you need.
Something like this:
UPDATE host SET snmp_community = 'newstring' where snmp_community = 'oldstring';
Github https://github.com/zuka1337
Killspikealt https://github.com/zuka1337/killspikealt "Graphical Interface to Remove Spikes"
Spikepyrrd https://github.com/zuka1337/Spikepyrrd "Python Script to remove spikes from graph"
Killspikealt https://github.com/zuka1337/killspikealt "Graphical Interface to Remove Spikes"
Spikepyrrd https://github.com/zuka1337/Spikepyrrd "Python Script to remove spikes from graph"
Re: How can I update the SNMP Community String via CLI or SQL?
na, the snmp_community string exits in three tables. The bit I now realise I missed was updating the poller cache. So the commands to change it on a $HOST are as follows.
UPDATE host SET snmp_community = 'newstring' WHERE description = "$HOST" AND snmp_community = 'oldstring'
UPDATE data_input_data SET value = 'newstring' WHERE value = 'oldstring' AND data_template_data_id IN (SELECT id FROM data_template_data WHERE name_cache LIKE "$HOST %")
UPDATE poller_item SET snmp_community = 'newstring' WHERE snmp_community = 'oldstring' AND hostname LIKE "${HOST}.%"
/bin/php /usr/share/cacti/cli/rebuild_poller_cache.php --host-id=$ID
UPDATE host SET snmp_community = 'newstring' WHERE description = "$HOST" AND snmp_community = 'oldstring'
UPDATE data_input_data SET value = 'newstring' WHERE value = 'oldstring' AND data_template_data_id IN (SELECT id FROM data_template_data WHERE name_cache LIKE "$HOST %")
UPDATE poller_item SET snmp_community = 'newstring' WHERE snmp_community = 'oldstring' AND hostname LIKE "${HOST}.%"
/bin/php /usr/share/cacti/cli/rebuild_poller_cache.php --host-id=$ID
Re: How can I update the SNMP Community String via CLI or SQL?
If you are using automation, you should also update your snmp option sets.
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Who is online
Users browsing this forum: No registered users and 1 guest