sending snmptraps w/ snmptrap
Hi! I am trying to send an snmptrap if a critical or error-Message occures. I found some scripts in the net which told me to use destination traps {program("/usr/local/sbin/sendtrap.sh"); }; with following script #!/bin/sh while read line; do snmptrap .... done It has the problem that I can not manipulate the snmptrap statement, I tried further: destination d_send_trap { pipe("/tmp/snmptrap.pipe" template("snmptrap ..... '$HOST' '$FACILITY' '$PRIORITY' ... '$MSG'\n") template-escape(yes)); now I have the trouble how I get the statement from the pipe into execution. Does anyone have something in this kind working ? Thanks in advance Matthias Gruber ------------------------------------------------------------------------------------ Dipl.-Inform. Matthias Gruber MCNE(mult.), MCSE, CIP, IT-Project+ Bankhaus B. Metzler seel. Sohn & Co. KGaA ++ Informationssysteme/Systemtechnik ++ Tel.: +49 69 2104 4330 Fax: +49 69 2104 4040 Große Gallusstr. 18 60311 Frankfurt MGruber@Metzler.com
Why don't you use a template with the "program" destination? destination traps { program("/usr/local/sbin/sendtrap.sh" template('$HOST' '$FACILITY' '$PRIORITY' ... '$MSG'); } You just have to parse the command line arguments properly. On Tuesday, September 23, 2003, at 03:57 AM, MGruber@metzler.com wrote:
Hi!
I am trying to send an snmptrap if a critical or error-Message occures. I found some scripts in the net which told me to use
destination traps {program("/usr/local/sbin/sendtrap.sh"); }; with following script #!/bin/sh while read line; do snmptrap .... done
It has the problem that I can not manipulate the snmptrap statement, I tried further:
destination d_send_trap { pipe("/tmp/snmptrap.pipe" template("snmptrap ..... '$HOST' '$FACILITY' '$PRIORITY' ... '$MSG'\n") template-escape(yes));
now I have the trouble how I get the statement from the pipe into execution.
Does anyone have something in this kind working ?
Thanks in advance Matthias Gruber
----------------------------------------------------------------------- -------------
Dipl.-Inform. Matthias Gruber MCNE(mult.), MCSE, CIP, IT-Project+ Bankhaus B. Metzler seel. Sohn & Co. KGaA ++ Informationssysteme/Systemtechnik ++ Tel.: +49 69 2104 4330 Fax: +49 69 2104 4040 Große Gallusstr. 18 60311 Frankfurt MGruber@Metzler.com
_______________________________________________ syslog-ng maillist - syslog-ng@lists.balabit.hu https://lists.balabit.hu/mailman/listinfo/syslog-ng Frequently asked questions at http://www.campin.net/syslog-ng/faq.html
participants (2)
-
Aaron Jackson
-
MGruber@metzler.com