[hobbit] Hobbit client executing a script to be proactive if a problem occurs?

Josh Luthman josh at imaginenetworksllc.com
Fri Apr 11 18:56:21 CEST 2008


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.

I use puTTY and the formatting works perfectly for me.

On Fri, Apr 11, 2008 at 12:51 PM, Haertig, David F (Dave) <haertig at avaya.com>
wrote:

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


-- 
Josh Luthman
Office: 937-552-2340
Direct: 937-552-2343
1100 Wayne St
Suite 1337
Troy, OH 45373

Those who don't understand UNIX are condemned to reinvent it, poorly.
--- Henry Spencer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20080411/a71cd74c/attachment.html>


More information about the Xymon mailing list