|
From: | Sanjay Veeramachaneni |
Subject: | Re: Syntax Errors with Moinit 5.3.2 on Ubuntu 12.04 |
Date: | Mon, 24 Feb 2014 12:14:11 -0800 |
I'm not sure if it's copy&paste typo, but the size test is not allowed in the "check process" context:--8<--check process tomcat7 with pidfile /var/run/tomcat7.pidif size = 0 then exec "/bin/rm /var/run/tomcat7.pid" <------------------------ errorstart program = "/etc/init.d/tomcat7 start" with timeout 60 seconds...--8<--The "check file" test is not necessary ... the pidfile based process check will automatically trigger restart if the pidfile is missing.Regards,MartinOn 24 Feb 2014, at 20:55, Sanjay Veeramachaneni <address@hidden> wrote:That worked thank you. Now i am running into another errorFor tomcat, and Mongo db. I try to check the pid file and start if pid file doesnt exist. The the config is shown below.
### Check Tomcat7check process tomcat7 with pidfile /var/run/tomcat7.pidif size = 0 then exec "/bin/rm /var/run/tomcat7.pid"start program = "/etc/init.d/tomcat7 start" with timeout 60 secondsstop program = "/etc/init.d/tomcat7 stop"if failed host 127.0.0.1 port 8080 protocol http then restartif 5 restarts within 5 cycles then timeoutgroup web###I get the errormonit: Error reading pid from file '/var/run/tomcat7.pid' ...monit: Error reading pid from file '/var/lib/mongodb/mongod.lock'How would go about fixing this error . I tried adding the line
check file tomcat7.pid with path /var/run/tomca7.pid if size = 0 then exec "/bin/rm /var/run/tomcat7.pid"But it gives me syntax error that ###/etc/monit/monitrc:86: Error: syntax error 'size'How can i fix this...
--On Mon, Feb 24, 2014 at 5:25 AM, Martin Pala <address@hidden> wrote:Hello,the problem is this line (4x in your configuration file):--8<--if 5 restarts within 5 cycles then timeout and alert--8<--Only one action is possible (and alert is implicit part of timeout) => it should be changed to this:--8<--if 5 restarts within 5 cycles then timeout--8<--Regards,MartinOn 24 Feb 2014, at 04:27, Sanjay Veeramachaneni <address@hidden> wrote:Hello, i am setting up monit for monitoring our servers. Please check my configuration file for monitrc. For some reason it starts failing from check filesystem rule which i have highlighted below. If i comment that whole section of for the check file system.. the error starts moving on to the next rules down................. not sure how to trouble shoot this error. This has been really frustrating. Any help is appreciated here...................####set daemon 120 # check services at 2-minute intervalsset logfile /var/log/monit.logset idfile /var/lib/monit/idset statefile /var/lib/monit/stateset mailserver smtp.gmail.com port 587using tlsv1 with timeout 30 secondsusername "address@hidden" password "******"set mail-format { from: address@hidden }set alert address@hidden # Email to send notificationsset eventqueuebasedir /var/lib/monit/eventsslots 100set mail-format {subject: monit alert -- $EVENT $SERVICEmessage: $EVENT Service $SERVICEReceived:Date: $DATEAction: $ACTIONHost: $HOSTDescription: $DESCRIPTION}set httpd port 8181 and # Port used for the WEB access, listen on LOCALHOSTuse address localhostallow 0.0.0.0/0.0.0.0allow admin:monit # Username/password################################################################################# Services###############################################################################check system localhostif loadavg (1min) > 4 then alertif loadavg (5min) > 2 then alertif memory usage > 75% then alertif swap usage > 25% then alertif cpu usage (user) > 70% then alertif cpu usage (system) > 30% then alertif cpu usage (wait) > 20% then alert# Check the binary Apache file (MD5 checksum + permission + UID + GUID)check file apache_bin with path /usr/lib/apache2/mpm-prefork/apache2if failed permission 755 then unmonitorif failed uid root then unmonitorif failed gid root then unmonitorgroup web# Check apache service (service alive + resource consumption)check process apache with pidfile /var/run/apache2.pidstart program = "/etc/init.d/apache2 start" with timeout 20 secondsstop program = "/etc/init.d/apache2 stop"if children > 150 then alertif children > 250 then restartif loadavg(5min) greater than 15 for 8 cycles then stopif totalcpu > 50% for 2 cycles then alertif totalcpu > 80% for 5 cycles then restartif failed host 127.0.0.1 port 80 protocol httpthen restartif 5 restarts within 5 cycles then timeout and alertgroup web# Check ROOT filesystem space usage--------------------------------> Sytax error start from the check filesystem rule below.check filesystem rootfs with path /if space usage > 80% for 5 times within 15 cycles then alertgroup server# Check DATA filesystem space usagecheck filesystem datafs with path /dev/xvda1if space usage > 80% for 5 times within 15 cycles then alertgroup server# Check mysqld service (depends mysqld binary + init.d startup script)check process mysqld with pidfile /var/run/mysqld/mysqld.pidgroup databasestart program = "/etc/init.d/mysql start" with timeout 20 secondsstop program = "/etc/init.d/mysql stop"if failed host 127.0.0.1 port 3306 protocol mysql then restartif 5 restarts within 5 cycles then timeout and alert# Check Tomcat7check process tomcat7 with pidfile /var/run/tomcat7.pidstart program = "/etc/init.d/tomcat7 start" with timeout 60 secondsstop program = "/etc/init.d/tomcat7 stop"if failed host 127.0.0.1 port 8080 protocol http then restartif 5 restarts within 5 cycles then timeout and alertgroup web# Check mongodb processcheck process mongodb with pidfile /var/lib/mongodb/mongod.lockgroup databasestart program = "/etc/init.d/mongodb start" with timeout 20 secondsstop program = "/etc/init.d/mongodb stop"if failed host 127.0.0.1 port 27017 protocol http for 3 times within 5 cycles then restartif 5 restarts within 5 cycles then timeout and alert
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
[Prev in Thread] | Current Thread | [Next in Thread] |