Monitor required operating system restarts

Depending on your environment, you might could have solved update installations using Puppet etc. or an automatic installation. That’s not unusual. And if your services are active-active components you are already able to reboot servers without any problem.

But if you have to reboot your server manually the following poller might be interesting.

Extend your snmpd.confwith the following entry:

extend reboot /bin/bash -c 'if [ -e /var/run/reboot-required ]; then echo "1"; else echo "0"; fi'

:exclamation: If the file /var/run/reboot-required exists, your system needs a restart

Create a corresponding poller definition like this in poller-configuration.xml:

<service name="Reboot-Required" interval="300000" user-defined="true" status="on">
    <parameter key="retry" value="1"/>
    <parameter key="timeout" value="3000"/>
    <parameter key="port" value="161"/>
    <parameter key="oid" value="1.3.6.1.4.1.8072.1.3.2.4.1.2.6.114.101.98.111.111.116.1"/>
    <parameter key="operator" value="&lt;"/>
    <parameter key="operand" value="1"/>
</service>
<monitor service="Reboot-Required" class-name="org.opennms.netmgt.poller.monitors.SnmpMonitor“/>

Don’t forget to assign the service Reboot-Required to your nodes!

Conclusion

Depending on your environment size and structure it could be a good idea to create a service detector for this service. One way or the other be careful with these pollers. For the first time you could create a lot of work… :wink:

Have fun!

1 Like