Nagios-users Digest, Vol 16, Issue 4
Fabio Iovine
fabio.iovine at gmail.com
Tue Sep 4 17:38:45 CEST 2007
Thanx for your help but I succeded in using the macro/variables in my
script in the meantime.
Quoting was not the solution, I had already tried to use single quotes
and double quotes but they didn't work.
then I discovered the nagios env variables and I used them, so,
instead to pass the $HOSTNAME$ to my script I tried using
$NAGIOS_HOSTNAME inside it and it was ok.
thanks as well,
regards,
fabio
On 9/4/07, nagios-users-request at lists.sourceforge.net
<nagios-users-request at lists.sourceforge.net> wrote:
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 03 Sep 2007 21:12:16 +0200
> From: Arno Lehmann <al at its-lehmann.de>
> Subject: Re: [Nagios-users] Nagio & TEC
> To: nagios-users at lists.sourceforge.net
> Message-ID: <46DC5C90.3050701 at its-lehmann.de>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi,
>
> 03.09.2007 15:10,, Fabio Iovine wrote::
> > hi all,
> >
> > I need to forward Nagios alarm events to TEC (Tivoli Enterprise Monitor).
> >
> > For this reason I wrote a couple of shell-scripts to handle Nagios
> > servicestate and change them in TEC suitable severity codes.
> >
> > Then I try to forward these event to TEC by using a Tivoli command but
> > I have problems with SERVICEOUTPUT/HOSTOUTPUT which are truncated.
> >
> > let's make some fixed points; these are the twho commands I defined in
> > my commands.cfg file:
> >
> > # 'service-notify-by-postemsg' command definition
> >
> > define command{
> >
> > command_name service-notify-by-postemsg
> >
> > command_line $USER3$/service-nagios-postemsg.sh `$DATE$` `$TIME$` `$HO
>
> You should change these quotes to something more useful, like ' or "
> and make sure any special characters you pass are correctly quoted (or
> handled by your script correctly). IIRC, Nagios calls the commands you
> define using /bin/sh, and that might understand unexpected things...
>
> > STNAME$` `$SERVICESTATE$` `$SERVICEOUTPUT$`
> >
> > }
> >
> > # 'host-notify-by-postemsg' command definition
> >
> > define command{
> >
> > command_name host-notify-by-postemsg
> >
> > command_line $USER3$/host-nagios-postemsg.sh $DATE$ $TIME$ $HOSTNAME$
>
> Also, put qoutes around the variables. As long as you forbid any
> potentilly insecure characters in Nagios' configuration (the default,
> IIRC), " should work fine.
>
> > $HOSTSTATE$ $HOSTOUTPUT$
> >
> > }
> >
> > the two files have the following inside them:
> >
> > date=$1
>
> Again, qouting...
>
> ...
>
>
> > what really happen to me is that the $hostoutput wich should contain
> > the $HOSTOUTPUT$ text is truncated right after the first word, for
> > istance:
> >
> > $HOSTOUTPUT$ = JMX ATTRIBUTE CRITICAL -
> > jboss.j2ee:jndiName=ejb/GameTransactionSystem,service=EJB-StateString:
> >
> > become $hostoutput = JMX
> >
> > do you have any idea?
>
> Sure. Quoting.
> To verify this, try to enter the line you give above into the shell...
> you'll get something else than only a variable assignment.
>
> Arno
>
> > thanx in advance,
> >
> > Fabio
> >
> > -------------------------------------------------------------------------
> Arno Lehmann
> IT-Service Lehmann
> www.its-lehmann.de
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list