Re: Event handler over a remote machine

Kenneth.ray <[email protected]>
Newsgroups gmane.network.netsaint.user
Message-ID <[email protected]>
in addtion to what Andy said,
if you need to execute the plugin locally to the machine in question, you
need to look at the following things..
permisions on the remote machine,
what user, your going to use to do this with.
what commands need to be run.

we dont use the event handlers in this fashion to start services, however if
we were to start doing this here is what i would do.
Using the Netsaint_statd plugin (now known as Nagios_statd on all my
machines)
I would create a simple sub routine that called my shell script in the event
of
a problem, passing it a parameter that would clarify it was indeed needed.
then I would write a simple client using one of the already created checks,
to communicate
with the Nagios_statd plugin on the local machine.
i would give the Nagios_statd daemon the rights to execute all the commmands
needed to perform the function I requested (thoroughly testing that it
works).
then I would set up an event handler, that called the new check on the local
machine, in the
event that I receive a hard status state, and pass it the variable telling
the Daemon on the
remote machine to run it.

I chose nagios_statd. because we already have it running on the remote
machines
and since its written in perl, I know enough about perl  to actually
manipulate the daemon
and add the sub routine. on the local side its quite easy to take one of the
existing checks
and change it to fit your needs.  you could even pass back the time the event
handler dit the
change from the remote machine, and if that time is less than a certain
number, you could
do your event handler again.

that is how I would do it,
are there other ways, I'm quite sure there are.


[email protected] wrote:

> Send Netsaint-users mailing list submissions to
>      [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>      https://lists.sourceforge.net/lists/listinfo/netsaint-users
> or, via email, send a message with subject or body 'help' to
>      [email protected]
>
> You can reach the person managing the list at
>      [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Netsaint-users digest..."
>
> Today's Topics:
>
>    1. RE: Event handler over a remote machine (Andy)
>
> --__--__--
>
> Message: 1
> Reply-To: <[email protected]>
> From: "Andy" <[email protected]>
> To: "=?iso-8859-1?Q?'Edgard_Dap=E1s'?=" <[email protected]>,
>    <[email protected]>
> Subject: RE: [netsaint] Event handler over a remote machine
> Date: Sun, 15 Sep 2002 02:13:20 -0400
>
> What I do with my two event handlers that solve problems is have it run
> a script locally to check the parameters that I'm passing from Nagios.
>
> define command{
>         command_name    update-asus-ts-portfw
>         command_line
> /usr/local/nagios/libexec/eventhandlers/update-asus-ts-portfw $HOSTNAME$
> $HOSTSTATE$ $STATETYPE$ $HOSTATTEMPT$
>         }
>
> Notice the 2,3,4 params.  Those would pass something like [soft,hard]
> [ok,down] [1,2,3,4,5,6]
>
> I then have a bash script that looks at the params to see if I need it
> to do something.  You wouldn't want it to restart your notes server
> every time it runs the script.  It will run the event handler on every
> attempt that is a non-ok state.  So the script would look something like
> this.  Look at the bottom of the page, there is an example script there.
> http://nagios.sourceforge.net/docs/1_0/eventhandlers.html =20
>
> But it bases has some case statements where it checks if it's in a hard
> or soft state.  If it's in a soft state, it could be just a fluke.  So
> look at the attempt.
>
> What I have done is on the first attempt where the state is 'hard' I
> have it update firewall rules to point my terminal server session to a
> different host.  I also have another one that on the first 'hard'
> attempt, I have it reboot my firewall just in case my cable modem is
> flaking out and I need my firewall to reset it.
>
> Hope this helps....
> Andy
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Edgard
> Dap=E1s
> Sent: Friday, September 13, 2002 10:17 AM
> To: [email protected]
> Subject: [netsaint] Event handler over a remote machine
>
> Hi !!!
>
> I'm trying to set my first event handler, but i have problem.
>
> I'm checking my Notes on a remote machine with the check_notes command ,
> and it's working right
>
> The problem appear when I'm trying to restart the Notes when the result
> of
> check_notes command is Critical, the command to restart the Notes is
> notes_restart.sh
>
> I configure my netsaint machine in this way:
>
> In the hosts.cfg:
> command[notes_restart]=3D$USER1$/check_nrpe!notes_restart.sh =
> $HOSTADDRESS$
> -c $ARG1$ $SERVICESTATE$ $STATETYPE$ $SERVICEATTEMPT$
>
> service[dsl101]=3DNOTES;0;24x7;3;2;1;webpin;120;24x7;1;1;0;notes_restart;=
> c
> heck_nrpe!check_notes
>
> But Netsaint is looking for the notes_restart in the local machine and
> not
> in the remote machine
> Error message:
> sh: /opt/sfw/lib/netsaint/plugins/check_nrpe!notes_restart.sh: not
> founds
>
> Could you send me a example of the best way to configure the remote
> execution of a eventhandler?
>
> Thanks
>
> La=A0  informaci=F3n=A0 contenida=A0 en=A0 este=A0 correo=A0 es=A0 para  =
> uso exclusivo
> de
> los destinatarios=A0 del=A0 mismo. Est=E1 prohibido a  las personas o
> entidades
> que no sean=A0los =
> destinatarios=A0de=A0este=A0correo,=A0realizar=A0cualquier=A0tipo=A0de
> modificaci=F3n, copia o distribuci=F3n del mismo.
> Si=A0 Ud.=A0recibe=A0este=A0correo por error, tenga a  bien notificar al =
> emisor
> y
> eliminarlo.
>
> This=A0email=A0is=A0confidential=A0and=A0intended=A0solely=A0for=A0the=A0=
> use=A0of the
> individual=A0to=A0whom=A0it=A0is addressed. Any views or opinions =
> presented are
> solely=A0those=A0of the author=A0 and=A0do=A0not necessarily represent =
> those of
> Personal.=A0If=A0you are not the intended recipient, be advised that you
> have
> received=A0this=A0email in error and that any use, dissemination,
> forwarding,
> printing,=A0or=A0copying=A0of=A0this=A0email is strictly prohibited. If =
> you have
> received this email in error please contact the sender.(Embedded image
> moved to file: pic06724.pcx)
>
> ---
>
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.386 / Virus Database: 218 - Release Date: 9/9/2002
> =20
>  =20
>
> --__--__--
>
> _______________________________________________
> Netsaint-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/netsaint-users
>
> End of Netsaint-users Digest

--
this message and any attachments are confidential to the ordinary user of
the e-mail address to which it was addressed and may also be privilaged.
If you receive this message in error please immediately delete it and all
 copies of it from your system, destroy any hard copies of it and notify
the sender. You must not, directly or indirectly, use, disclose,distribute,
print or copy any part of this message if you are not the intended
resipient. Internet communications cannot be guaranteed to be secure
or error-free as information could be intercepted, corrupted, lost,
arrive late or contain viruses or unauthorized amendments. The sender,
therfore, does not accept liability for any errors or ommission in the
content of this message or any damage or other consequences arising as
a result of Internet Transmition. Opinions, conclusions and/or
other information in this transmitted messxage that do not relate
to official business of CITIGROUP shall be understood as neither given
nor endorsed by CitiGroup.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.