Re: Passing Parameters to Event Handlers

Stanley Hopcroft <[email protected]>
Newsgroups gmane.network.netsaint.user
Message-ID <[email protected]>
Dear Sir,

I am writing to say that I am sorry that progress to helping you is
slow.

Are you using Nagios ?

(The resource definitions don't look like Netsaint).

The only suggestions I have are

. setting the debug compile variable as mentioned before and 
seeing at the command line that Netsaint uses for the handler

(create a new copy of the Netsaint source tree, build in that using a
non-production --prefix to configure, install into the non production
path, and then create in that path a stripped down set of resource files
that send notifications to /dev/bit_bucket - so you don't have too much
to look at and so that your contact groups don't get annoyed, start it
up in the forground and watch for the debug messages.

Another useful technique may be to replace your event handler by one
that echoes its arguments

Then, you can send a bug report/request for enhancement with the debug
output.

. try an event handler like so :-

'/usr/yada/handler -opt1 -opt2 argv1 argv2'

(ie quote the handler path and arguments).

Why is it that you need different arguments for each handler ?

Could you do like so in command.cfg

handler1...arguments for handler1
handler2...arguments for handler2

eg

tsitc> grep _ssh /usr/local/netsaint/etc/commands.cfg
command[check_by_ssh]=$USER1$/check_by_ssh -t 30 -H $ARG1$ -l $ARG2$ -C
'$ARG3$ $ARG4$'
command[check_by_ssh2]=$USER1$/check_by_ssh -t 30 -H $ARG1$ -l $ARG2$ -C
'$ARG3$ $ARG4$ $ARG5$'
command[check_by_ssh3]=$USER1$/check_by_ssh -t 30 -H $ARG1$ -l $ARG2$ -C
'$ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$ $ARG9$'
command[check_wl_ssh]=$USER1$/check_by_ssh -t 30 -H $ARG1$ -l $ARG2$ -i
/home/netsaint/.ssh/smon_identity -C '$ARG3$ $ARG4$'
command[check_dhcp_ssh]=$USER1$/check_by_ssh -t 45 -H $HOSTNAME$ -l
netsaint -i /home/netsaint/.ssh/id_dsa -C 'check_dhcp -l'
tsitc> 

Crude but effective.

HTH.

Yours sincerely.



-- 
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------

'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'

from Meditation 17, J Donne.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
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.