[Top][All Lists]

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

Re: Check a Process with a script

From: Martin Pala
Subject: Re: Check a Process with a script
Date: Fri, 1 Apr 2016 16:13:41 +0200


if you need a custom script, you can use the "check program":

We have fixed the send/expect to provide more details about the failed pattern (

You can run monit in debug mode (using -v option) or use wireshark/tcpdump to trace the communication.

Best regards,

On 24 Mar 2016, at 14:55, Holder, Shane <address@hidden> wrote:

I am trying to check a process that sends arbitrary data on the socket.  The existing send/expect does not appear to be meeting my needs as the output from the program I am attempting to check is not consistent.
I am using the following monit script:
                check process progname with pidfile /var/run/
                                start program = “/etc/init.d/prog start” with timeout 60 seconds
                                stop program = “/etc/init.d/prog stop”
                                if failed port <n> send “command\r\n” expect “command ACK” with timeout 60 seconds retry 5 then restart
the program is a service which listens on a port and accepts commands.  It is possible that when connecting to the port that there is some arbitrary data in the buffer which is sent on connection to the socket.  It is also possible that while connected data will be sent that is not related.  The following shell command succeeds where monit is not.
(echo “command”; sleep 5) | nc localhost <port> | grep “command ACK”
This allows me to ignore any arbitrary data coming from the port and look only for my expected output.
I want to add something like.
                                If failed <run some program here> status  != 0 then restart
Is something like this possible in monit 5.16 gramar?
Shane Holder 
Solutions Architect
Enterprise Architecture
3101 Gaylord Parkway 2W-C120 
Frisco, TX 75034
Work: 469.365.7727

CONFIDENTIALITY NOTICE. This electronic mail transmission may contain privileged, confidential and/or protected health information and is intended only for the review of the party to whom it is addressed.  Any unauthorized use or disclosure of the information contained herein may be a violation of federal law, including the Health Insurance Portability and Accountability Act (HIPAA). If you have received this transmission in error, please immediately return it to the sender, delete it  and destroy it without reading it. Unintended transmission shall not constitute the waiver of the attorney-client or any other privilege.

To unsubscribe:

reply via email to

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