Nagio & TEC

Arno Lehmann al at its-lehmann.de
Mon Sep 3 21:12:16 CEST 2007


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
> 
> -------------------------------------------------------------------------
> 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

-- 
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