monit-general
[Top][All Lists]
Advanced

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

Re: Restarting monit services through an API


From: Jan-Henrik Haukeland
Subject: Re: Restarting monit services through an API
Date: Mon, 20 Aug 2012 20:00:59 +0200

Yes, this is possible by using the "_doaction" url path. The URL to use will 
look something like this:

https://host:monit-port/_doaction?action=restart&service=monit

Where action is a choice of start, stop, restart, monitor or unmonitor and 
service is the service name in your .monitrc control file. If you have password 
protected access to Monit (which you should), your script will need to create a 
basic authentication HTTP header. Doing this over https is also recommended. 




On Aug 20, 2012, at 6:06 PM, Callum Macdonald <address@hidden> wrote:

> Holamigos,
> 
> I'd like to be able to restart a service that's managed by monit,
> programmatically, from a remote host.
> 
> I was imagining something along the lines of:
> https://host.domain.tld:2082/_status?format=xml
> 
> I'd like to use something like that to restart a service, rather than
> simply retrieve status information. Is that possible?
> 
> I'm guessing I could generate a POST submission to the appropriate URL
> based on the HTML of the status interface, but I wondered if there was a
> more elegant solution. Any thoughts?
> 
> Cheers - Callum.
> 
> ==
> Callum Macdonald
> 
> UK mobile: +44 7968 378 810
> Norway mobile: +47 9346 4422
> Desk: +44 845 126 0875
> www.callum-macdonald.com
> 



reply via email to

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