<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
As a last resort, if you also have rsh running, you could<br>
- set hosts.equiv to allow the hobbit user coming in from the hobbit
server to login as user x without a password, <br>
- then give user x sudo ( with NOPASSWD ) rights to restart sshd.<br>
<br>
I have a bunch automated fixes i setup, restart ntpd, kill processes,
etc, using the SCRIPT alert & ssh keys. <br>
<br>
In your case you could do this to restart the local or remote ssh
service<br>
<br>
<br>
< from hobbit-alerts.cfg><br>
...<br>
PAGE=bla COLOR=red<br>
SCRIPT /opt/hobbit/server/bin/autofix_ssh autofix_ssh
SERVICE=ssh DURATION<10m<br>
MAIL <a class="moz-txt-link-abbreviated" href="mailto:admin@sample.com">admin@sample.com</a> DURATION>10m REPEAT=30m<br>
<br>
<autofix_ssh><br>
<br>
#!/bin/bash<br>
<br>
if [ $BBHOSTNAME -eq `hostname` ] ; then<br>
sudo /etc/init.d/sshd restart<br>
else<br>
rsh $BBHOSTNAME -l userx sudo /etc/init.d/sshd restart";<br>
fi<br>
<br>
<br>
hope this helps<br>
<pre class="moz-signature" cols="72">Daniel Bourque
Systems/Network Administrator
WeatherData Service Inc
An Accuweather Company
Office (316) 266-8013
Office (316) 265-9127 ext. 3013
Mobile (316) 640-1024
</pre>
<br>
<br>
Henrik Stoerner wrote:
<blockquote cite="mid20070711142041.GB29442@hswn.dk" type="cite">
<pre wrap="">On Wed, Jul 11, 2007 at 04:13:56PM +0200, Henrik Stoerner wrote:
</pre>
<blockquote type="cite">
<pre wrap="">If You really want this, then the easiest way is probably to
have a script on the Hobbit server that handles the service
restart, and trigger it from an alerting script. Here's how:
</pre>
</blockquote>
<pre wrap=""><!---->
[snipped]
Particularly for ssh, running the recovery script from the Hobbit
server might not be easy - since ssh is usually the only way you
can remote-login to the server and gets things (re-)started.
So to implement the same functionality on the client-side, you can
write a client-side extension script that does:
#!/bin/sh
PROCSTATUS=`$BB $BBDISP "query $MACHINE.procs" | awk '{print $1}'`
if test "$PROCSTATUS" = "red"
then
/etc/init.d/sshd restart
fi
exit 0
This triggers the "sshd restart" whenever the "procs" status goes red.
So it won't be able to tell if it's the sshd process that triggers a red
if you're monitoring multiple processes on each host. So alternatively,
you could add network-monitoring of "ssh", and then query the "ssh"
column instead of the "procs" column.
Regards,
Henrik
To unsubscribe from the hobbit list, send an e-mail to
<a class="moz-txt-link-abbreviated" href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a>
</pre>
</blockquote>
</body>
</html>