r9: - dodao aosi
authorDinko Korunic <Dinko.Korunic@CARNet.hr>
Sat, 13 Oct 2007 17:04:10 +0000 (17:04 +0000)
committerDinko Korunic <Dinko.Korunic@CARNet.hr>
Sat, 13 Oct 2007 17:04:10 +0000 (17:04 +0000)
- modificirao *ftp servise da pricaju ftp
- popravio ssh template (nedostajuci =)
- update-monit.d sad provjerava i init skripte
- monitrc -> 900 sec izmedju checkova
- freeradius prica 1812 udp
- update README

README.CARNet
debian/rules
monit-cn/aosi.conf [new file with mode: 0644]
monit-cn/freeradius.conf
monit-cn/monitrc
monit-cn/proftpd.conf
monit-cn/sshd.conf
monit-cn/vsftpd.conf
update-monit.d

index f6117ab..a62b17e 100644 (file)
@@ -16,11 +16,11 @@ odgovarajuci servis koji ispravno radi.
 
 Za sljedece servise dolaze gotovi predlosci:
 
 
 Za sljedece servise dolaze gotovi predlosci:
 
-  amavisd  cron        mysqld    samba     tomcat5
-  apache1  dhcpd3      ntpd      sendmail  vsftpd
-  apache2  dovecot     openldap  sophie
-  bind8    exim        postfix   sshd
-  bind9    freeradius  proftpd   syslogd
-  clamd    monitrc     qpopper   thttpd
+  amavisd.conf  clamd.conf       monitrc        qpopper.conf   thttpd.conf
+  aosi.conf     cron.conf        mysqld.conf    samba.conf     tomcat5.conf
+  apache1.conf  dhcpd3.conf      ntpd.conf      sendmail.conf  vsftpd.conf
+  apache2.conf  dovecot.conf     openldap.conf  sophie.conf
+  bind8.conf    exim.conf        postfix.conf   sshd.conf
+  bind9.conf    freeradius.conf  proftpd.conf   syslogd.conf
 
  -- Dinko Korunic <kreator@carnet.hr> at  Mon, 24 Sep 2007 18:51:14 +0200
 
  -- Dinko Korunic <kreator@carnet.hr> at  Mon, 24 Sep 2007 18:51:14 +0200
index 5c69e32..ab981fb 100755 (executable)
@@ -42,7 +42,7 @@ binary-indep: build install
        dh_testroot
        dh_installchangelogs
        dh_installdocs
        dh_testroot
        dh_installchangelogs
        dh_installdocs
-       dh_install
+       dh_install -X.svn
 #      dh_installexamples
 #      dh_installmenu
 #      dh_installdebconf
 #      dh_installexamples
 #      dh_installmenu
 #      dh_installdebconf
diff --git a/monit-cn/aosi.conf b/monit-cn/aosi.conf
new file mode 100644 (file)
index 0000000..b0e1553
--- /dev/null
@@ -0,0 +1,7 @@
+# aosi monit-cn template
+
+check aosi with pidfile "/var/run/aosi/aosi.pid"
+    start program = "/etc/init.d/aosi start"
+    stop program = "/etc/init.d/aosi stop"
+    if failed host 127.0.0.1 port 1443 type tcp
+        then restart
index 4fc3ac1..a3ba685 100644 (file)
@@ -2,4 +2,6 @@
 
 check freeradius with pidfile "/var/run/freeradius/freeradius.pid"
     start program = "/etc/init.d/freeradius start"
 
 check freeradius with pidfile "/var/run/freeradius/freeradius.pid"
     start program = "/etc/init.d/freeradius start"
-    stop program  = "/etc/init.d/freeradius stop"
+    stop program = "/etc/init.d/freeradius stop"
+    if failed host 127.0.0.1 port 1812 type udp
+        then restart
index a49a0c9..d626e79 100644 (file)
@@ -1,6 +1,6 @@
 # monit-cn template
 
 # monit-cn template
 
-set daemon 300
+set daemon 900
 set logfile syslog facility log_daemon
 
 set mail-format {
 set logfile syslog facility log_daemon
 
 set mail-format {
index d71f454..467ab2d 100644 (file)
@@ -2,4 +2,6 @@
 
 check process proftpd with pidfile "/var/run/proftpd.pid"
     start program = "/etc/init.d/proftpd start"
 
 check process proftpd with pidfile "/var/run/proftpd.pid"
     start program = "/etc/init.d/proftpd start"
-    stop program  = "/etc/init.d/proftpd stop"
+    stop program = "/etc/init.d/proftpd stop"
+       if failed host 127.0.0.1 port 21 protocol ftp
+               then restart
index 8ce1fe4..9bbd5e2 100644 (file)
@@ -1,8 +1,8 @@
 # sshd monit-cn template
 
 check process sshd with pidfile "/var/run/sshd.pid"
 # sshd monit-cn template
 
 check process sshd with pidfile "/var/run/sshd.pid"
-    start program  "/etc/init.d/ssh start"
-    stop program  "/etc/init.d/ssh stop"
+    start program = "/etc/init.d/ssh start"
+    stop program = "/etc/init.d/ssh stop"
     if failed host 127.0.0.1 port 22 protocol ssh
                with timeout 15 seconds
         then restart
     if failed host 127.0.0.1 port 22 protocol ssh
                with timeout 15 seconds
         then restart
index 6e89be2..3bcae87 100644 (file)
@@ -2,4 +2,6 @@
 
 check process vsftpd with pidfile "/var/run/vsftpd/vsftpd.pid"
     start program = "/etc/init.d/vsftpd start"
 
 check process vsftpd with pidfile "/var/run/vsftpd/vsftpd.pid"
     start program = "/etc/init.d/vsftpd start"
-    stop program  = "/etc/init.d/vsftpd stop"
+    stop program = "/etc/init.d/vsftpd stop"
+       if failed host 127.0.0.1 port 21 protocol ftp
+               then restart
index 4ed19e1..05472e9 100755 (executable)
@@ -1,4 +1,11 @@
 #!/bin/sh
 #!/bin/sh
+#
+# Copyright (C) 2007  Dinko Korunic, CARNet, Grupa za izradu paketa
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
 
 MONIT_DIR=/etc/monit.d
 TEMPLATES_DIR=/usr/share/monit-cn
 
 MONIT_DIR=/etc/monit.d
 TEMPLATES_DIR=/usr/share/monit-cn
@@ -12,13 +19,26 @@ check_service() {
         return 1
     fi
 
         return 1
     fi
 
-    script='BEGIN { RS = "[ \t\n]+" }
+    scriptpid='BEGIN { RS = "[ \t\n]+" }
                { line[NR] = $0 "" }
          END { for (j in line)
                 if (line[j] == "pidfile")
                     print line[j + 1] }'
                { line[NR] = $0 "" }
          END { for (j in line)
                 if (line[j] == "pidfile")
                     print line[j + 1] }'
-    pidfiles=$(awk "$script" < "$filename" | sed -e 's/"//g')
+    pidfiles=$(awk "$scriptpid" < "$filename" | sed -e 's/"//g')
     check_pidfile $pidfiles
     check_pidfile $pidfiles
+
+    if [ $RET -eq 1 ]; then
+        return 1
+    fi
+
+    scriptinit='BEGIN { RS = "[ \t\n]+" }
+               { line[NR] = $0 "" }
+         END { for (j in line)
+                if (((line[j] == "start") || (line[j] == "stop")) && (line[j + 1] == "program"))
+                    print line[j + 3] }'
+    initscripts=$(awk "$scriptinit" < "$filename" | sed -e 's/"//g')
+    check_initscript $initscripts
+
     return $RET
 }
 
     return $RET
 }
 
@@ -41,6 +61,20 @@ check_pidfile() {
     return 0
 }
 
     return 0
 }
 
+check_initscript() {
+    RET=0
+
+    while [ -n "$1" ]; do
+        if [ ! -x "$1" ]; then
+            RET=1
+            return 1
+        fi
+        shift
+    done
+
+    return 0
+}
+
 check_pid() {
     RET=0
 
 check_pid() {
     RET=0