Assuming you're using SSH - what SSH client are you pasting from?  The formating would be put in the buffer from the client, not VI at all.<br><br>I use puTTY and the formatting works perfectly for me.<br><br><div class="gmail_quote">
On Fri, Apr 11, 2008 at 12:51 PM, Haertig, David F (Dave) <<a href="mailto:haertig@avaya.com">haertig@avaya.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Sorry about the formating of the code I sent.  I don't know why I can't<br>
successfully cut-n-paste from vi on Linux into Outlook on Windows and<br>
not get screwed up format-wise.  I guess if you know Hobbit alert syntax<br>
and PERL, they you can figure it out easy enough.<br>
<div class="Ih2E3d"><br>
-----Original Message-----<br>
From: Haertig, David F (Dave) [mailto:<a href="mailto:haertig@avaya.com">haertig@avaya.com</a>]<br>
Sent: Friday, April 11, 2008 10:30 AM<br>
To: <a href="mailto:hobbit@hswn.dk">hobbit@hswn.dk</a><br>
</div><div><div></div><div class="Wj3C7c">Subject: RE: [hobbit] Hobbit client executing a script to be proactive<br>
if a problem occurs?<br>
<br>
Here is how I execute a remote "pkill" on a client.  Replace<br>
"client_server" with your client hostname, and replace "client_userid"<br>
with the userid (on the client) that you want to run the script (pkill)<br>
under.  Also, set up ssh pubkey authentication between the Hobbit server<br>
and client so that ssh does not prompt you for a password.<br>
<br>
<br>
hobbit_alerts.cfg:<br>
<br>
##############################<br>
$KILL_SCRIPT=/hobbit/server/ext/kill_script<br>
HOST=client_server SERVICE=procs COLOR=red<br>
        SCRIPT $KILL_SCRIPT client_server,client_userid,grep_pattern<br>
##############################<br>
<br>
<br>
<br>
/hobbit/server/ext/kill_script:<br>
<br>
##############################<br>
#!/bin/perl<br>
#$debug++;      # Comment-out this line for normal operation<br>
($host, $userid, $pattern) = split(/,/, $ENV{RCPT}, 3); exit unless<br>
((defined $host) && (defined $userid) && (defined $pattern)); $command =<br>
qq!ssh $userid\@$host "pkill -f '$pattern'"!; if ($debug) {<br>
        $command =~ s/pkill/pgrep -l/;<br>
        print `$command`;<br>
}<br>
else {<br>
        `$command`;<br>
}<br>
##############################<br>
<br>
<br>
<br>
And here is how I execute an arbitrary script on the client (in this<br>
example, "weblogics_kill_script").  It is a minor modification of the<br>
above:<br>
<br>
<br>
hobbit_alerts.cfg:<br>
<br>
##############################<br>
$REMOTE_SCRIPT=/hobbit/server/ext/remote_script<br>
HOST=ssdpws001 SERVICE=weblogics COLOR=red<br>
        SCRIPT $REMOTE_SCRIPT<br>
client_server,client_userid,/export/home/hobbit/scripts/weblogics_kill_s<br>
cript<br>
##############################<br>
<br>
<br>
Note: weblogics_kill_script exists on the client - I use it to force a<br>
few thread dumps, archive logfiles, and then kill/restart weblogics<br>
<br>
/hobbit/server/ext/remote_script:<br>
<br>
##############################<br>
#!/bin/perl<br>
#$debug++;      # Comment-out this line for normal operation<br>
($host, $userid, $script) = split(/,/, $ENV{RCPT}, 3); exit unless<br>
((defined $host) && (defined $userid) && (defined $script)); $command =<br>
qq!ssh $userid\@$host "$script"!; if ($debug) {<br>
        print `$command`;<br>
}<br>
else {<br>
        `$command`;<br>
}<br>
##############################<br>
<br>
<br>
-----Original Message-----<br>
From: Chris Wopat [mailto:<a href="mailto:chrisw@supranet.net">chrisw@supranet.net</a>]<br>
Sent: Friday, April 11, 2008 7:56 AM<br>
To: <a href="mailto:hobbit@hswn.dk">hobbit@hswn.dk</a><br>
Subject: [hobbit] Hobbit client executing a script to be proactive if a<br>
problem occurs?<br>
<br>
Hello,<br>
<br>
I've been running hobbit for a few years, after converting from Big<br>
Brother. I actively use it to monitor hundreds of hosts, send alerts,<br>
etc. However, one thing I have yet to do is use any custom scripts for<br>
anything. Looking at docs, I see two ways that scripts are called:<br>
<br>
1) an alert can call a script instead of email directly. This script is<br>
passed variables, and just about anything can be done *on the hobbit<br>
server* from here.<br>
<br>
2) A script can be launched on the client, from ext/, when the hobbit<br>
clien starts. This script is generally used to add another column to<br>
hobbit.<br>
<br>
What I'd like to do is execute a script *on the client* when an alert<br>
has happened. Say, if CPU goes red on something, I'd like a script to<br>
run on the cilent. I could force the issue with #1 above, but this seems<br>
like it would invovle the server having the script, likely having SSH<br>
keys setup to get into the client, then run the script.<br>
<br>
Is there a cleaner way built in that will just say "if service FOO is<br>
red then on client run script ext/BAR.sh"?<br>
<br>
Thanks<br>
--Chris<br>
<br>
To unsubscribe from the hobbit list, send an e-mail to<br>
<a href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a><br>
<br>
<br>
<br>
To unsubscribe from the hobbit list, send an e-mail to<br>
<a href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a><br>
<br>
<br>
<br>
To unsubscribe from the hobbit list, send an e-mail to<br>
<a href="mailto:hobbit-unsubscribe@hswn.dk">hobbit-unsubscribe@hswn.dk</a><br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Josh Luthman<br>Office: 937-552-2340<br>Direct: 937-552-2343<br>1100 Wayne St<br>Suite 1337<br>Troy, OH 45373<br><br>Those who don't understand UNIX are condemned to reinvent it, poorly.<br>
--- Henry Spencer