[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [hobbit] Hobbit client executing a script to be proactive if a problem occurs?
- To: <hobbit (at) hswn.dk>
- Subject: RE: [hobbit] Hobbit client executing a script to be proactive if a problem occurs?
- From: "Haertig, David F (Dave)" <haertig (at) avaya.com>
- Date: Fri, 11 Apr 2008 11:11:00 -0600
- References: <47FF6DF2.4030306 (at) supranet.net> <9836EA7D7FDAE34099AED87A2D9C3A8D018AD00B (at) 306181ANEX2.global.avaya.com> <9836EA7D7FDAE34099AED87A2D9C3A8D018AD05D (at) 306181ANEX2.global.avaya.com> <961092e10804110956x38941c8aya0e158e2da25a47b (at) mail.gmail.com>
- Thread-index: Acib9Xp9u8CwSGLcSlGwaZFrY6u4PAAAG9JQ
- Thread-topic: [hobbit] Hobbit client executing a script to be proactive if a problem occurs?
My local computer is Windows XP, using Putty to ssh into my Linux box
(which runs Hobbit). VI on Linux, highlight, then cut-n-paste into an
Outlook 2003 reply to the Hobbit mailing list. I have only noticed this
formatting problem when posting code to this Hobbit list. It's probably
some text-only email line-wrap formatting option I have set in Outlook.
It's not an issue in HTML email (which I hate, but when in Rome, do as
the Romans do, and HTML email is what most everybody in my company
uses). I had to grudging give up on Thunderbird and move to Outlook so
I could easily deal with all the other Windows-loving coworkers and
their Outlook calendar meeting invites.
I'll check my Outlook text settings again. There's probably something
in there that I missed.
________________________________
From: Josh Luthman [mailto:josh (at) imaginenetworksllc.com]
Sent: Friday, April 11, 2008 10:56 AM
To: hobbit (at) hswn.dk
Subject: Re: [hobbit] Hobbit client executing a script to be proactive
if a problem occurs?
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\ (at) $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\ (at) $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