It's easy to put together a wrapper for your process that writes a pid into
a file...

For example: (if using bash)

/bin/process &
echo $! > /var/run/process.pid

$! returns the pid of the last background process started...

This will always be safer than matching on a name - a pattern match can fail
or throw false positives under many different circumstances.


On Tue, Mar 8, 2011 at 3:10 PM, Martin Pala <[email protected]> wrote:

> Hello,
>
> you can test the pattern with processes using the new command-line option
> "procmatch" which was added in monit 5.2.4 (available for download here:
> http://www.mmonit.com/monit/download/)
>
> Example:
> monit procmatch aaa
>
> ... will list all processes matching your pattern
>
> Please try to verify that your pattern returns what is expected.
>
> Regards,
> Martin
>
>
> On Mar 8, 2011, at 4:05 AM, <[email protected]> <
> [email protected]> wrote:
>
> > I added "with timeout" parameter, but  no changes.
> > My process "a" is  up within 10 sec.
> > Maybe nothing to relate timeout and this problem in my case.
> >
> >
> > Watching monit.log, I found debug entry. What's happen ?
> >
> > [JST Mar  8 11:54:57] info     : start service 'a' on user request
> > [JST Mar  8 11:54:57] info     : monit daemon at 1360 awakened
> > [JST Mar  8 11:54:57] info     : Awakened by User defined signal 1
> > [JST Mar  8 11:54:57] info     : 'a' start: /sbin/service
> > [JST Mar  8 11:55:27] error    : 'a' failed to start
> > [JST Mar  8 11:55:27] debug    :
> -------------------------------------------------------------------------------
> > [JST Mar  8 11:55:27] debug    :     /usr/bin/monit [0x8053cce]
> > [JST Mar  8 11:55:27] debug    :     /usr/bin/monit(LogError+0x22)
> [0x8054092]
> > [JST Mar  8 11:55:27] debug    :     /usr/bin/monit(Event_post+0x382)
> [0x80517f2]
> > [JST Mar  8 11:55:27] debug    :     /usr/bin/monit [0x804f718]
> > [JST Mar  8 11:55:27] debug    :     /usr/bin/monit(control_service+0xbb)
> [0x804f90b]
> > [JST Mar  8 11:55:27] debug    :     /usr/bin/monit [0x8064368]
> > [JST Mar  8 11:55:27] debug    :     /usr/bin/monit(validate+0x78)
> [0x8064448]
> > [JST Mar  8 11:55:27] debug    :     /usr/bin/monit [0x8056005]
> > [JST Mar  8 11:55:27] debug    :     /usr/bin/monit(main+0x524)
> [0x80568c4]
> > [JST Mar  8 11:55:27] debug    :
> /lib/i686/nosegneg/libc.so.6(__libc_start_main+0xdc) [0x190e8c]
> > [JST Mar  8 11:55:27] debug    :     /usr/bin/monit [0x804e8e1]
> > [JST Mar  8 11:55:27] debug    :
> -------------------------------------------------------------------------------
> > [JST Mar  8 11:55:27] debug    : Execution failed notification is sent to
> xxxxxx@xxxxx<--sorry,confidential
> > [JST Mar  8 11:55:27] debug    : Monitoring enabled -- service a
> >
> >
> >
> > Thanks.
> > Kenichi Futatsumori in Japan.
> >
> >
> >
> >> -----Original Message-----
> >> From:
> >> monit-general-bounces+kenichi.futatsumori=unisys.co.jp@nongnu.
> >> org
> >> [mailto:monit-general-bounces+kenichi.futatsumori=unisys.co.jp
> >> @nongnu.org] On Behalf Of Patrick Viola
> >> Sent: Friday, March 04, 2011 8:25 PM
> >> To: This is the general mailing list for monit
> >> Subject: Antwort: Problems : start action status is always
> >> "failed to start" when check process with matching
> >>
> >> I have had the same problem with two of my processes. I get
> >> rid of the messages with a timeout.
> >>
> >> May your process needs some time to stop or start?
> >> Try to add a timeout behind your stop / start command.
> >>
> >> start program = "/sbin/service aaa start" with timeout 20 seconds
> >>
> >>
> >>
> >> Mit freundlichen Grüßen
> >> Patrick Viola
> >> Projektentwicklung Business Information
> >>
> >> Tel: +49 2152 143 - 439, Fax: +49 2152 44 47
> >> E-Mail: [email protected], Lotus Notes: Patrick Viola@GEPONETZ
> >>
> >> GEDAK - Gesellschaft für Datenverarbeitung und Kommunikation
> >> mbH Mülhauser Str. 157 · D-47906 Kempen, Geschäftsführer:
> >> Bernd Kothes Amtsgericht Krefeld HRB 9087, Steuer-Nr.
> >> 115/5715/0137, USt.-ID DE119998337
> >>
> >> www.gedak.de
> >>
> >>
> >>
> >> Von:         <[email protected]>
> >> An:  <[email protected]>
> >> Datum:       04.03.2011 08:08
> >> Betreff:     Problems : start action status is always
> >> "failed to start" when check process with matching
> >> Gesendet von:        [email protected]
> >>
> >> ________________________________
> >>
> >>
> >>
> >>
> >> Hi,
> >>
> >> I am trying to use monit for monitoring a process.
> >> A process doesn't create pid file, so I would like to  use
> >> matching option.
> >> (monit is version 5.2.4 on linux.)
> >>
> >> check process aaa  with matching  "aaa"
> >>  start = "/sbin/service aaa start"
> >>  stop =  "/sbin/service aaa stop"
> >>
> >>
> >> # monit   start  aaa
> >>
> >> The process "aaa" is running  but  monit's service status is
> >> always "Execution failed",
> >> and I recieved a mail.   And "failed to start" was put syslog.
> >>
> >> And "monit procmatch"  is  OK.
> >>
> >> Why ?
> >>
> >> # monit status
> >> ....
> >> Process 'aaa'
> >> status                            Execution failed
> >> monitoring status                 monitored
> >> pid                               15376   <--- but process
> >> is running !
> >> parent pid                        1
> >> uptime                            1m
> >> children                          17
> >> memory kilobytes                  2232
> >> memory kilobytes total            68428
> >> memory percent                    0.1%
> >> memory percent total              3.2%
> >> cpu percent                       0.0%
> >> cpu percent total                 0.0%
> >> data collected                    Fri Mar  1 16:02:33 2011
> >>
> >>
> >> Thanks.
> >>
> >> Kenichi in Japan.
> >>
> >>
> >> --
> >> To unsubscribe:
> >> http://lists.nongnu.org/mailman/listinfo/monit-general
> >> <http://lists.nongnu.org/mailman/listinfo/monit-general>
> >>
> >>
> >>
> > --
> > To unsubscribe:
> > http://lists.nongnu.org/mailman/listinfo/monit-general
>
>
> --
> To unsubscribe:
> http://lists.nongnu.org/mailman/listinfo/monit-general
>



-- 
*Mike SCHMIDT
**CTO
Intello Technologies Inc.
**[email protected]*
*Canada: 1-888-404-6261 x320
USA: 1-888-404-6268 x320
www.intello.com*
*
*
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to