Execute program on remote host

Andreas Ericsson ae at op5.se
Sat Oct 23 12:15:40 CEST 2010


On 10/23/2010 12:03 PM, Jonas Kellens wrote:
> On 10/23/2010 11:49 AM, Andreas Ericsson wrote:
>> On 10/23/2010 11:38 AM, Jonas Kellens wrote:
>>> I want Nagios to activate the backup server (host C), when the
>>> production server (host B) has problems.
>>>
>>>
>> Look through the docs for eventhandlers.
>>
> 
> The documentation says :
> 
> define service{
>       host_name            somehost
>       service_description        HTTP
>       max_check_attempts        4
>       event_handler            restart-httpd
>       ...other service variables...
>       }
> 
> define command{
>       command_name    restart-httpd
>       command_line
> /usr/local/nagios/libexec/eventhandlers/restart-httpd  $SERVICESTATE$
> $STATETYPE$ $SERVICEATTEMPT$
>       }
> 
> 
> Can you show me an example of executing a command on a remote host (and
> not executing on localhost) ??
> 

The command will have to connect to the remote host and do its stuff there.
Setting up ssh keys without passwords should be well documented online. Try
googling for it.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list