Hello, if you need a custom script, you can use the "check program": https://mmonit.com/monit/documentation/monit.html#PROGRAM-STATUS-TESTING
We have fixed the send/expect to provide more details about the failed pattern (https://bitbucket.org/tildeslash/monit/issues/335/display-output-on-failed-match-of-expect). You can run monit in debug mode (using -v option) or use wireshark/tcpdump to trace the communication. Best regards, Martin > On 24 Mar 2016, at 14:55, Holder, Shane <[email protected]> wrote: > > Hello, > > 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/progname.pid > 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 > AmerisourceBergen > Solutions Architect > Enterprise Architecture > > 3101 Gaylord Parkway 2W-C120 > Frisco, TX 75034 > > Work: 469.365.7727 > > http://absg.com <http://absg.com/> > > > 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: > https://lists.nongnu.org/mailman/listinfo/monit-general > <https://lists.nongnu.org/mailman/listinfo/monit-general>
-- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
