Generate a Test Message

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Generate a Test Message

Faine, Mark R. (MSFC-IS40)[NICS]

I am looking for a way to generate a message from Monit as a routine test just to ensure it is working and that we will receive alerts should any be generated.  The problem is that if we have it configured properly and things are running well it can be a while before we see any messages from Monit. In this time, it is possible, even if unlikely, that there is a problem with Monit somewhere that has gone unnoticed and when something does happen we won't be notified.  In order to prevent this, we are looking for a way to make Monit generate a test notice at least once per day to ensure it is functioning properly.  I have googled for this and seen a few ideas for forcing a failure and changing the message but I was hoping that there may be a better way. 

 

Thanks,

-Mark

Reply | Threaded
Open this post in threaded view
|

Re: Generate a Test Message

Ron Kelley
Quick and dirty way:  Setup a cron job to log a message to /var/log/syslog and then setup monit to watch for the message.

Example:

/etc/monit.d/monit.conf
------------------------
###############################################################################
# Send daily test message
###############################################################################
check file messages with path /var/log/message
    if match "Daily monit alert" then alert


crontab file
------------------------
0 0 * * * /bin/logger "Daily monit alert"
------------------------


Hope this helps!

-Ron




On 6/10/20 12:48 PM, Faine, Mark R. (MSFC-IS40)[NICS] wrote:
> I am looking for a way to generate a message from Monit as a routine test just to ensure it is working and that we will receive alerts should any be generated.The problem is that if we have it configured properly and things are running well it can be a while before we see any messages from Monit. In this time, it is possible, even if unlikely, that there is a problem with Monit somewhere that has gone unnoticed and when something does happen we won't be notified.In order to prevent this, we are looking for a way to make Monit generate a test notice at least once per day to ensure it is functioning properly. I have googled for this and seen a few ideas for forcing a failure and changing the message but I was hoping that there may be a better way.
>
> Thanks,
>
> -Mark
>

Reply | Threaded
Open this post in threaded view
|

RE: Generate a Test Message

Nick Upson-2
Have a cron job that does "monit summary | mail <params>"

-----Original Message-----
From: monit-general <monit-general-bounces+nu=[hidden email]> On Behalf Of Ron Kelley
Sent: 10 June 2020 17:53
To: [hidden email]
Subject: Re: Generate a Test Message

Quick and dirty way:  Setup a cron job to log a message to /var/log/syslog and then setup monit to watch for the message.

Example:

/etc/monit.d/monit.conf
------------------------
###############################################################################
# Send daily test message
###############################################################################
check file messages with path /var/log/message
    if match "Daily monit alert" then alert


crontab file
------------------------
0 0 * * * /bin/logger "Daily monit alert"
------------------------


Hope this helps!

-Ron




On 6/10/20 12:48 PM, Faine, Mark R. (MSFC-IS40)[NICS] wrote:
> I am looking for a way to generate a message from Monit as a routine test just to ensure it is working and that we will receive alerts should any be generated.The problem is that if we have it configured properly and things are running well it can be a while before we see any messages from Monit. In this time, it is possible, even if unlikely, that there is a problem with Monit somewhere that has gone unnoticed and when something does happen we won't be notified.In order to prevent this, we are looking for a way to make Monit generate a test notice at least once per day to ensure it is functioning properly. I have googled for this and seen a few ideas for forcing a failure and changing the message but I was hoping that there may be a better way.
>
> Thanks,
>
> -Mark
>

CAUTION. This email originated from outside of Telensa. Do not click links or open attachments unless you recognise the sender and know the content is safe.
IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Telensa may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.

Reply | Threaded
Open this post in threaded view
|

RE: [EXTERNAL] Re: Generate a Test Message

Faine, Mark R. (MSFC-IS40)[NICS]
In reply to this post by Ron Kelley
Excellent idea, don't know why I didn't think of that.

Thanks!
-Mark

-----Original Message-----
From: monit-general <monit-general-bounces+mark.faine=[hidden email]> On Behalf Of Ron Kelley
Sent: Wednesday, June 10, 2020 11:53
To: [hidden email]
Subject: [EXTERNAL] Re: Generate a Test Message

Quick and dirty way:  Setup a cron job to log a message to /var/log/syslog and then setup monit to watch for the message.

Example:

/etc/monit.d/monit.conf
------------------------
###############################################################################
# Send daily test message
###############################################################################
check file messages with path /var/log/message
    if match "Daily monit alert" then alert


crontab file
------------------------
0 0 * * * /bin/logger "Daily monit alert"
------------------------


Hope this helps!

-Ron




On 6/10/20 12:48 PM, Faine, Mark R. (MSFC-IS40)[NICS] wrote:
> I am looking for a way to generate a message from Monit as a routine test just to ensure it is working and that we will receive alerts should any be generated.The problem is that if we have it configured properly and things are running well it can be a while before we see any messages from Monit. In this time, it is possible, even if unlikely, that there is a problem with Monit somewhere that has gone unnoticed and when something does happen we won't be notified.In order to prevent this, we are looking for a way to make Monit generate a test notice at least once per day to ensure it is functioning properly. I have googled for this and seen a few ideas for forcing a failure and changing the message but I was hoping that there may be a better way.
>
> Thanks,
>
> -Mark
>


Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] Re: Generate a Test Message

Ron Kelley
Glad to help.

Note, in my email below, I said "send to /var/log/syslog" but my example has "/var/log/message".  Just make sure to use same log file for logger and monit :-)

-Ron


On 6/10/20 12:56 PM, Faine, Mark R. (MSFC-IS40)[NICS] wrote:

> Excellent idea, don't know why I didn't think of that.
>
> Thanks!
> -Mark
>
> -----Original Message-----
> From: monit-general <monit-general-bounces+mark.faine=[hidden email]> On Behalf Of Ron Kelley
> Sent: Wednesday, June 10, 2020 11:53
> To: [hidden email]
> Subject: [EXTERNAL] Re: Generate a Test Message
>
> Quick and dirty way:  Setup a cron job to log a message to /var/log/syslog and then setup monit to watch for the message.
>
> Example:
>
> /etc/monit.d/monit.conf
> ------------------------
> ###############################################################################
> # Send daily test message
> ###############################################################################
> check file messages with path /var/log/message
>      if match "Daily monit alert" then alert
>
>
> crontab file
> ------------------------
> 0 0 * * * /bin/logger "Daily monit alert"
> ------------------------
>
>
> Hope this helps!
>
> -Ron
>
>
>
>
> On 6/10/20 12:48 PM, Faine, Mark R. (MSFC-IS40)[NICS] wrote:
>> I am looking for a way to generate a message from Monit as a routine test just to ensure it is working and that we will receive alerts should any be generated.The problem is that if we have it configured properly and things are running well it can be a while before we see any messages from Monit. In this time, it is possible, even if unlikely, that there is a problem with Monit somewhere that has gone unnoticed and when something does happen we won't be notified.In order to prevent this, we are looking for a way to make Monit generate a test notice at least once per day to ensure it is functioning properly. I have googled for this and seen a few ideas for forcing a failure and changing the message but I was hoping that there may be a better way.
>>
>> Thanks,
>>
>> -Mark
>>
>
>

Reply | Threaded
Open this post in threaded view
|

RE: Generate a Test Message

Faine, Mark R. (MSFC-IS40)[NICS]
In reply to this post by Nick Upson-2
That's a good idea too but I prefer the other idea because the goal is to test Monit's ability to notify us not that I can send an email from the command line, though I admit they are almost the same thing.

-Mark


-----Original Message-----
From: monit-general <monit-general-bounces+mark.faine=[hidden email]> On Behalf Of Nick Upson
Sent: Wednesday, June 10, 2020 11:56
To: This is the general mailing list for monit <[hidden email]>
Subject: [EXTERNAL] RE: Generate a Test Message

Have a cron job that does "monit summary | mail <params>"

-----Original Message-----
From: monit-general <monit-general-bounces+nu=[hidden email]> On Behalf Of Ron Kelley
Sent: 10 June 2020 17:53
To: [hidden email]
Subject: Re: Generate a Test Message

Quick and dirty way:  Setup a cron job to log a message to /var/log/syslog and then setup monit to watch for the message.

Example:

/etc/monit.d/monit.conf
------------------------
###############################################################################
# Send daily test message
###############################################################################
check file messages with path /var/log/message
    if match "Daily monit alert" then alert


crontab file
------------------------
0 0 * * * /bin/logger "Daily monit alert"
------------------------


Hope this helps!

-Ron




On 6/10/20 12:48 PM, Faine, Mark R. (MSFC-IS40)[NICS] wrote:
> I am looking for a way to generate a message from Monit as a routine test just to ensure it is working and that we will receive alerts should any be generated.The problem is that if we have it configured properly and things are running well it can be a while before we see any messages from Monit. In this time, it is possible, even if unlikely, that there is a problem with Monit somewhere that has gone unnoticed and when something does happen we won't be notified.In order to prevent this, we are looking for a way to make Monit generate a test notice at least once per day to ensure it is functioning properly. I have googled for this and seen a few ideas for forcing a failure and changing the message but I was hoping that there may be a better way.
>
> Thanks,
>
> -Mark
>

CAUTION. This email originated from outside of Telensa. Do not click links or open attachments unless you recognise the sender and know the content is safe.
IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Telensa may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.


Reply | Threaded
Open this post in threaded view
|

RE: [EXTERNAL] Re: Generate a Test Message

Faine, Mark R. (MSFC-IS40)[NICS]
In reply to this post by Ron Kelley
Yeah, I got that.  It's /var/log/messages in this case.

Thanks,
-Mark


-----Original Message-----
From: monit-general <monit-general-bounces+mark.faine=[hidden email]> On Behalf Of Ron Kelley
Sent: Wednesday, June 10, 2020 11:59
To: [hidden email]
Subject: Re: [EXTERNAL] Re: Generate a Test Message

Glad to help.

Note, in my email below, I said "send to /var/log/syslog" but my example has "/var/log/message".  Just make sure to use same log file for logger and monit :-)

-Ron


On 6/10/20 12:56 PM, Faine, Mark R. (MSFC-IS40)[NICS] wrote:

> Excellent idea, don't know why I didn't think of that.
>
> Thanks!
> -Mark
>
> -----Original Message-----
> From: monit-general <monit-general-bounces+mark.faine=[hidden email]> On Behalf Of Ron Kelley
> Sent: Wednesday, June 10, 2020 11:53
> To: [hidden email]
> Subject: [EXTERNAL] Re: Generate a Test Message
>
> Quick and dirty way:  Setup a cron job to log a message to /var/log/syslog and then setup monit to watch for the message.
>
> Example:
>
> /etc/monit.d/monit.conf
> ------------------------
> ###############################################################################
> # Send daily test message
> ###############################################################################
> check file messages with path /var/log/message
>      if match "Daily monit alert" then alert
>
>
> crontab file
> ------------------------
> 0 0 * * * /bin/logger "Daily monit alert"
> ------------------------
>
>
> Hope this helps!
>
> -Ron
>
>
>
>
> On 6/10/20 12:48 PM, Faine, Mark R. (MSFC-IS40)[NICS] wrote:
>> I am looking for a way to generate a message from Monit as a routine test just to ensure it is working and that we will receive alerts should any be generated.The problem is that if we have it configured properly and things are running well it can be a while before we see any messages from Monit. In this time, it is possible, even if unlikely, that there is a problem with Monit somewhere that has gone unnoticed and when something does happen we won't be notified.In order to prevent this, we are looking for a way to make Monit generate a test notice at least once per day to ensure it is functioning properly. I have googled for this and seen a few ideas for forcing a failure and changing the message but I was hoping that there may be a better way.
>>
>> Thanks,
>>
>> -Mark
>>
>
>