Example: Automatic monitoring of Logic Machine system processes

Program

We strongly recommend to add the following program into Network Configuration –> Services –> System monitoring

Source code    
  1. # check once in 2 minutes
  2. set daemon 120
  3. # reboot system when memory or cpu usage is too high
  4. check system $HOST
  5. if cpu usage (user) > 90% for 15 cycles then exec "/sbin/reboot"
  6. if memory usage > 90% for 5 cycles then exec "/sbin/reboot"
  7. # http server
  8. check process uhttpd with pidfile /var/run/uhttpd_httpd.pid
  9. start program = "/etc/init.d/httpd restart"
  10. stop program = "/etc/init.d/httpd stop"
  11. if failed port 80 with timeout 15 seconds then restart
  12. # knx backend
  13. check process eibd with pidfile /var/run/eibd
  14. start program = "/etc/init.d/eibd restart"
  15. stop program = "/etc/init.d/eibd stop"
  16. if 5 restarts within 5 cycles then timeout
  17. # knx monitor
  18. check process groupmonitor with pidfile /var/run/gs-groupmonitor.pid
  19. start program = "/etc/init.d/genohm-scada restart"
  20. stop program = "/etc/init.d/genohm-scada stop"
  21. if 5 restarts within 5 cycles then timeout

 

 

lm2_system_monitoring