monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom log file


From: Marco Ermini
Subject: Custom log file
Date: Tue, 10 May 2005 19:49:25 +0200

Sorry for the cross-post. I was not sure which lists was the best to ask...

I am implementing the custom log feature for monit. I am doing it very
tight to my needs, however since I am doing it, I think is it worth
asking if someone wants some different features, or maybe tell me that
I am going in the wrong way.

I am not changing the "standard" log file; I find it better (for
compatibility issues and simplicity, too) to implement a new log file
which would be possible to customize.

The keywords I programmed were two "set" statements and an extension
of the "event" case:

1) set customlog <PATH> (i.e /var/log/custommonit.log)

It creates the custom log file in a similar way than the "normal" log
file - the only difference is that it cannot be syslog (could it be
useful? I don't think so).

2) set customlog format <STRING> (default "%D, %T, %A, %S, %M, %T")

The format will use the following substitutions; %D=date, %T=time,
%A=alarm-number, %S=severity, %M=message text, %T=event type
(suggestions for other substitutions are welcome).

Then I added the possibility to specify a custom log for every event
which could occurs, to populate the custom log with the appropriate
string whichever events occurs. I.e.:

check host localhost with address 127.0.0.1
   if failed port 80 protocol http then alert log "message" alarmid 33
severity warning
   if failed port 8080 type tcp then alert else if recovered then
unmonitor log "message" alarmid auto severity warning

the keywords I added are:

log = to be inserted AFTER the "then" statement or "recovered"
statement, if present

alarmid = Numerical ID which unequivocal identifies an alarm. It will
be used to correlate alarm events with clear events (recovers). The
alarm and the correspondent clear will have the same ID, only that the
clear will have severity=normal. If you specify alarmid=auto monit
will use a

severity = must be on of the following: NORMAL WARNING MINOR MAJOR
CRITICAL FATAL - "normal" should be used to clear an alarm and is
automatically used in the case of recover, but monit will not really
check whichever severity you choose - this is up to you.


Of course it follows the logic of my particular needs (although it
should be useful to many people here), but if someone have a request,
since I am already digging into the CVS code... just ask :-)


Regards.
-- 
Marco Ermini
http://www.markoer.org
Dubium sapientiae initium. (Descartes)
address@hidden # mount -t life -o ro /dev/dna /genetic/research
<< This message is for the designated recipient only and may contain
privileged or confidential information. If you have received it in
error, please notify the sender immediately and delete the original.
Any other use of the email by you is prohibited. >>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]