Persistent Storage Does Not Get Updated Immediately

From Net-SNMP Wiki
Jump to: navigation, search
Good Answer

This is a Good Answer article. It was likely created as a response to a question on a Net-SNMP Mailing List and written up here for others to see. It likely covers material not yet in the FAQ or in the Tutorial but may someday be moved there

Question

When I make a dynamic modification to the snmp agent it does not immediately update the /var/net-snmp/snmpd.conf file with the new data (example: user password changes, new trap destinations, vacm changes, etc).

If the snmpd crashed, or some one did a "kill -9", all my changes are lost.

Answer

You're right! It doesn't update it right away. This is primarily because it was originally conceived as an expensive operation and not worth doing right away. The agent will save the data upon a proper shutdown, but it won't if it doesn't shutdown properly.

Note: You should never kill -9 any daemon except as a last resort!!

Solution: Force a Save

You can, actually, force the snmpd daemon to save the data. To do this, send a set request to versionSavePersistentData.0 with an integer value of 1.

 snmpset HOST versionSavePersistentData.0 = 1

This will force an immediate save of the data.