monit-general
[Top][All Lists]
Advanced

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

RE: Monit and SQL query


From: Charles Pino
Subject: RE: Monit and SQL query
Date: Mon, 17 Sep 2012 11:33:04 +0800

:) thank you. i think i would just stick with the defaults for now. looks pretty complicated for a noob like me.

so, how would i make monit execute the script? as the script checks if the field has been written for the past 12hrs.

im initially thinking i would just do all this in cron.




> Subject: Re: Monit and SQL query
> From: address@hidden
> Date: Sun, 16 Sep 2012 17:20:31 +0200
> To: address@hidden
>
> Yes, more or less. To have Monit send an alert message that is printed from your script, follow this receipt
>
> 1) Add a custom mail format to the check, where the message body is just $DESCRIPTION:
>
> check program foo with path "/path/to/foo.sh"
> alert address@hidden mail-format { message: $DESCRIPTION }
> if status != 0 then alert
>
> 2) Make your script write the error message you want to send to stderr. Here is a demo script I used to test this:
>
> foo.sh:
>
> #!/bin/bash
>
> echo 1>&2 "Hello this is an error message from $0";
> exit 1;
>
> 3) The alert mail you get from Monit will look something like this.
>
> status failed (1) for /path/to/foo.sh -- Error: Hello this is an error message from /path/to/foo.sh
>
> The prefix 'status failed (1) for /path/to/foo.sh -- Error: ' is hardcoded in validate.c:check_program and if it bothers you, just remove the prefix.
>
> That is replace this line
>
> Event_post(s, Event_Status, STATE_FAILED, status->action, "status failed (%d) for %s -- Error: %s..", s->program->exitStatus, s->path, buf);
>
> With this one:
>
> Event_post(s, Event_Status, STATE_FAILED, status->action, "%s", buf);
>
> and recompile Monit.
>
> Hope this helps.
>
>
> On Sep 16, 2012, at 4:33 PM, Charles Pino <address@hidden> wrote:
>
> > i had it somehow working, but the alerts message / email is somewhat not really nice to look at.
> >
> >
> > Status failed Service foo
> >
> > Date: Sun, 16 Sep 2012 21:12:38
> > Action: alert
> > Host: orecx
> > Description: status failed (1) for /root/mysql.py. Error: 1
> > .
> >
> > Your faithful employee,
> > Monit
> >
> >
> > my question is. can i change the status failed service to my own message? as well as
> > Description: status failed (1) for /root/mysql.py. Error: 1 -- id like to have it say that the db hasnt been any writes in the past 12 hrs etc etc.
>
>
>
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general

reply via email to

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