Hi, folks,
We're changing out our community strings for SNMP and I'm trying to figure out how to do this programmatically.
My best thought is to go into /usr/local/nagios and change the items in ./etc and ./share which match those strings. The stuff in ./var I assume is volatile and will change when the rest is changed. Do I have this figured out, or am I missing something (like a better way to do this).
Thanks,
John A
How to change SNMP strings in servers en masse
Re: How to change SNMP strings in servers en masse
Hello @adamsj,
Thank you for reaching out!
I would recommend first checking out the following forum post, as I believe you are trying to accomplish something similar:
viewtopic.php?p=334641
If you have any further questions, comments, or concerns, feel free to reach out!
Thank you for reaching out!
I would recommend first checking out the following forum post, as I believe you are trying to accomplish something similar:
viewtopic.php?p=334641
If you have any further questions, comments, or concerns, feel free to reach out!
Re: How to change SNMP strings in servers en masse
It might be a good idea to set this in resources.cfg in the future.
You could also set the C-string in cfg files, copy them to the import dir and run a reconfig to import them.
You could also set the C-string in cfg files, copy them to the import dir and run a reconfig to import them.
Re: How to change SNMP strings in servers en masse
Hi, @ajcoil,
Thanks,
John A
That is similar to what I'm doing; however, I've got to do it on a defined (by host list) subset of the hosts being monitored. I'll dig a little into that table and see what I can see.ajcoil wrote: ↑Thu May 16, 2024 5:18 pmI would recommend first checking out the following forum post, as I believe you are trying to accomplish something similar:
viewtopic.php?p=334641
Thanks,
John A
Re: How to change SNMP strings in servers en masse
It turns out our SNMP strings are set entirely differently, not as Free Variables but set (I believe) by the input wizard.adamsj wrote: ↑Tue May 21, 2024 9:58 am Hi, @ajcoil,
That is similar to what I'm doing; however, I've got to do it on a defined (by host list) subset of the hosts being monitored. I'll dig a little into that table and see what I can see.ajcoil wrote: ↑Thu May 16, 2024 5:18 pmI would recommend first checking out the following forum post, as I believe you are trying to accomplish something similar:
viewtopic.php?p=334641
Re: How to change SNMP strings in servers en masse
By the way, in case you're wondering, this is an installation I inherited. I didn't set it up and I don't fully understand its innards.
Re: How to change SNMP strings in servers en masse
Hi, folks,
I'm puzzled by something. As an experiment, I changed one host's string to the desired new string, both on the host and on our Nagios installation in /usr/local/nagios/etc/services/hostname.cfg . It's doing what I expected--it's responding with current information. When I look in the console under Monitoring, I see the string has been changed. I didn't change the string where it appeared in files under /usr/local/nagios/share/perfdata/hostname/ and thus expected monitoring to stop--but it did not.
This seems inconsistent to me. What am I not understanding?
Thanks,
John A
I'm puzzled by something. As an experiment, I changed one host's string to the desired new string, both on the host and on our Nagios installation in /usr/local/nagios/etc/services/hostname.cfg . It's doing what I expected--it's responding with current information. When I look in the console under Monitoring, I see the string has been changed. I didn't change the string where it appeared in files under /usr/local/nagios/share/perfdata/hostname/ and thus expected monitoring to stop--but it did not.
This seems inconsistent to me. What am I not understanding?
Thanks,
John A
Re: How to change SNMP strings in servers en masse
Hello @adamsj,
So long as there are the same number of perfdata points for the given host, just changing the data source for a host will not stop the perfdata as the check is controlled by Nagios Core and the check listed in the XML is ornamental and is updated when the check is ran. Is it not updating for you?
Anything in the perfdata folder is not configuration-related and will be updated by Nagios Core automatically.
So long as there are the same number of perfdata points for the given host, just changing the data source for a host will not stop the perfdata as the check is controlled by Nagios Core and the check listed in the XML is ornamental and is updated when the check is ran. Is it not updating for you?
Anything in the perfdata folder is not configuration-related and will be updated by Nagios Core automatically.
April: Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
Re: How to change SNMP strings in servers en masse
Hi, bbahn,
Thanks,
John A
P.S. It's possible the right answer is "Johnnie, RTFM," in which case just point me to it.
It did not update, but then, all I did was change a file in etc/services.bbahn wrote: ↑Thu May 23, 2024 11:41 amSo long as there are the same number of perfdata points for the given host, just changing the data source for a host will not stop the perfdata as the check is controlled by Nagios Core and the check listed in the XML is ornamental and is updated when the check is ran. Is it not updating for you?
So when the new SNMP string is truly in Core, that'll update? Which implies the new string isn't there now. But then how is performance updating?
Thanks,
John A
P.S. It's possible the right answer is "Johnnie, RTFM," in which case just point me to it.
Re: How to change SNMP strings in servers en masse
@adamsj,
Assuming you have the standard setup for Nagios Core, updating your host files in /usr/local/nagios/etc/hosts/[hostname].cfg (or the services folder) should update Nagios Core. Have you restarted the Nagios service?
Assuming you have the standard setup for Nagios Core, updating your host files in /usr/local/nagios/etc/hosts/[hostname].cfg (or the services folder) should update Nagios Core. Have you restarted the Nagios service?
Code: Select all
sudo systemctl restart nagios
April: Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.