[Top][All Lists]

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

Re: issuing commands via shell to daemonised instance ?

From: Martin Pala
Subject: Re: issuing commands via shell to daemonised instance ?
Date: Wed, 22 Sep 2010 12:13:29 +0200


the CLI commands work well for daemon mode Monit, you need to:

1.) have monit http interface enabled (as it is used by monit CLI to pass commands to monit daemon) ... you already have this per your curl example

2.) allow access to localhost ... you already have this per your curl example

3.) if you use PAM (as you probably do with LDAP authentication), you need to add one "allow user:password" to monit configuration file. The monit CLI reads the configuration file and gets credentials which are used to connect to daemon from it (the daemon and CLI share the same configuration). The configuration file is protected by 0600 mode so only owner can read it (monit enforces the mode to protect the passwords and if it doesn't match, it refuses to start).


On Sep 22, 2010, at 10:45 AM, Daniel Maher wrote:


The monit executable has many helpful commands that can be run from the command line (and, better yet, scripted), such as "start", "stop", "summary", and so forth.  I'm curious if there is a way to extend it to instances of Monit that are running as a daemon ?  The help for monit 5.1.1 clearly states that the various actions are for non-daemon mode only, and (of course) they don't work otherwise :

address@hidden ~]$ sudo monit -V
This is monit version 5.1.1
Copyright (C) 2000-2010 by Tildeslash Ltd. All Rights Reserved.
address@hidden ~]$ sudo grep daemon /etc/monit.conf
set daemon 120
address@hidden ~]$ ps axuw | grep monit | grep -v grep
root     13029  0.0  0.0  58516  2488 ?        Sl   Jul26   1:28 /usr/bin/monit
address@hidden ~]$ sudo monit status
monit: cannot read status from the monit daemon
address@hidden ~]$ sudo monit monitor ntpd
monit: error receiving data -- Resource temporarily unavailable

I used to get around this by using curl to issue http interactions, such as :

/usr/bin/curl -d "action="" http://localhost:2812/ntpd"

This worked great until recently, when i activated http authentication to our LDAP back-end (to bring Monit in line with the rest of our infrastructure).  I could pass a username and a password in the curl command, but i'd rather not leave authentication credentials lying around in plain text files.

Does anybody have any ideas how i might be able to script Monit interactions given the scenario ?

Thank you.

reply via email to

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