Monit - utility for monitoring services on a Unix system

monit is a utility for managing and monitoring processes, files, directories and filesystems on a Unix system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. E.g. Monit can start a process if it does not run, restart a process if it does not respond and stop a process if it uses too much resources. You may use Monit to monitor files, directories and filesystems for changes, such as timestamps changes, checksum changes or size changes.

Monit is controlled via an easy to configure control file based on a free-format, token-oriented syntax. Monit logs to syslog or to its own log file and notifies you about error conditions via customizable alert messages. Monit can perform various TCP/IP network checks, protocol checks and can utilize SSL for such checks. Monit provides a http(s) interface and you may use a browser to access the Monit program.

debian package

da es kein aktuelles paket für debian gibt, habe ich auf basis des source-package der 4.10.-Version ein neues Paket erzeugt.

http://www.mmonit.org/monit/dist/monit-5.0.3.tar.gz
tar xzf !$

Patches

Für Patches (config-file-relocation) wird das Verzeichnis debian/patches verwendet, die Datei 00list gibt an, welche Patches einfließen sollen.

#! /bin/sh /usr/share/dpatch/dpatch-run
## config_file_relocation.dpatch by  <alfs@kossan>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad monit-5.0.3/file.c /tmp/dpep.zWsLpf/monit-5.0.3/file.c
--- monit-5.0.3/file.c  Sun Jul  5 13:02:48 2009
+++ /tmp/dpep.zWsLpf/monit-5.0.3/file.c Fri Feb 13 21:43:29 2009
@@ -190,6 +190,10 @@
   if(File_exist(rcfile)) {
     return (rcfile);
   }
+  snprintf(rcfile, STRLEN, "/etc/monit/%s", MONITRC);
+  if(File_exist(rcfile)) {
+    return (rcfile);
+  }
   memset(rcfile, 0, STRLEN);
   snprintf(rcfile, STRLEN, "%s/%s", SYSCONFDIR, MONITRC);
   if(File_exist(rcfile)) {
@@ -206,8 +210,8 @@
     return (rcfile);
   }
   LogError("%s: Cannot find the control file at "
-      "~/.%s, /etc/%s, %s/%s, /usr/local/etc/%s or at ./%s \n",
-      prog, MONITRC, MONITRC, SYSCONFDIR, MONITRC, MONITRC, MONITRC);
+      "~/.%s, /etc/monit/%s, /etc/%s, %s/%s, /usr/local/etc/%s or at ./%s \n",
+      prog, MONITRC, MONITRC, MONITRC, SYSCONFDIR, MONITRC, MONITRC, MONITRC);
   exit(1);
   
 }

Build-Prozess

  • time dpkg-buildpackage -rfakeroot -uc -sa 2>&1 | tee ../monit-5.0.3-3tiri.log
    • real 0m58.504s
    • user 0m27.262s
    • sys 0m28.438s

Ergebnis

Das Ergebnis kann sich sehen lassen:

  • monit -v
monit: Debug: Adding host allow 'localhost'
monit: Debug: Skipping redundant host 'localhost'
monit: Debug: Skipping redundant host 'localhost'
monit: Debug: Adding net allow '192.168.178.0/255.255.255.0'.
monit: Debug: Adding credentials for user 'admin'.
Runtime constants:
 Control file       = /etc/monit/monitrc
 Log file           = syslog
 Pid file           = /var/run/monit.pid
 Debug              = True
 Log                = True
 Use syslog         = True
 Is Daemon          = True
 Use process engine = True
 Poll time          = 60 seconds with start delay 0 seconds
 Expect buffer      = 256 bytes
 Mail server(s)     = 192.168.178.25:25, localhost:25 with timeout 5 seconds using 'monitor.tiri.local' as my hostname
 Mail from          = monit-monitor@tiri.local
 Mail subject       = monit alert --  $EVENT $SERVICE
 Mail message       = $EVENT Service $SERV..(truncated)
 Start monit httpd  = True
 httpd bind address = Any/All
 httpd portnumber   = 2812
 httpd signature    = True
 Use ssl encryption = False
 httpd auth. style  = Basic Authentication and Host/Net allow list
 Alert mail to      = tom@hidden
   Alert on         = All events

The service list contains the following entries:

System Name           = monitor
 Monitoring mode      = active
 CPU wait limit       = if greater than 20.0% 1 times within 1 cycle(s) then alert else if succeeded 1 times within 1 cycle(s) then alert
 CPU system limit     = if greater than 30.0% 1 times within 1 cycle(s) then alert else if succeeded 1 times within 1 cycle(s) then alert
 CPU user limit       = if greater than 70.0% 1 times within 1 cycle(s) then alert else if succeeded 1 times within 1 cycle(s) then alert
 Memory usage limit   = if greater than 75.0% 1 times within 1 cycle(s) then alert else if succeeded 1 times within 1 cycle(s) then alert
 Load avg. (5min)     = if greater than 2.0 1 times within 1 cycle(s) then alert else if succeeded 1 times within 1 cycle(s) then alert
 Load avg. (1min)     = if greater than 4.0 1 times within 1 cycle(s) then alert else if succeeded 1 times within 1 cycle(s) then alert

Process Name          = sshd
 Pid file             = /var/run/sshd.pid
 Monitoring mode      = active
 Start program        = '/etc/init.d/ssh start' timeout 30 second(s)
 Stop program         = '/etc/init.d/ssh stop' timeout 30 second(s)
 Pid                  = if changed 1 times within 1 cycle(s) then alert
 Ppid                 = if changed 1 times within 1 cycle(s) then alert
 Port                 = if failed localhost:22 [SSH via TCP] with timeout 5 seconds 1 times within 1 cycle(s) then restart else if succeeded 1 times within 1 cycle(s) then alert
 Timeout              = If 5 restart within 5 cycles then unmonitor else if succeeded then alert

Process Name          = freeradius
 Pid file             = /var/run/freeradius/freeradius.pid
 Monitoring mode      = active
 Start program        = '/etc/init.d/freeradius start' timeout 30 second(s)
 Stop program         = '/etc/init.d/freeradius stop' timeout 30 second(s)
 Pid                  = if changed 1 times within 1 cycle(s) then alert
 Ppid                 = if changed 1 times within 1 cycle(s) then alert
 Port                 = if failed localhost:1812 [DEFAULT via UDP] with timeout 5 seconds 1 times within 1 cycle(s) then restart else if succeeded 1 times within 1 cycle(s) then alert
 Timeout              = If 5 restart within 5 cycles then unmonitor else if succeeded then alert

-------------------------------------------------------------------------------
monit daemon at 10989 awakened
 
wissen/linux/debian/monit-5.0.3-deb-debian-package-utility.txt · Zuletzt geändert: 05.09.2010 20:31
 
Recent changes RSS feed Donate Valid XHTML 1.0 Valid CSS Recent cached RSS feed cacert-signed web site: inhalt.serviert.de