On 2011-08-01 17:46, Lorenzo Santi | Jobrapido wrote:

Hi everybody in the list,

Im new to monitoring system and actually I'm trying to write a custom notification email script

define command {

        command_name    new-monitorcsp-notify

command_line /usr/local/icinga/jobrapido/scripts/icinga_sendmail_monitorcsp.pl "$NOTIFICATIONTYPE$" "$SERVICEDESC$" "$HOSTADDRESS$" "$SERVICESTATE$" "$LONGDATETIME$" "$CONTACTEMAIL$"

        register                        1

}

Here is the command:

Here is the debug:

[1312211613.855026] [032.0] [pid=22154] Notification viability test passed.

[1312211613.855044] [032.1] [pid=22154] Current notification number: 0 (unchanged)

[1312211613.855064] [032.2] [pid=22154] Creating list of contacts to be notified.

[1312211613.855084] [032.1] [pid=22154] Service notification will NOT be escalated.

[1312211613.855104] [032.1] [pid=22154] Adding normal contacts for service to notification list.

[1312211613.855115] [032.2] [pid=22154] Adding contact 'xxx-csp' to notification list.

[1312211613.855129] [032.2] [pid=22154] Adding contact 'xxx-monitorcsp' to notification list.

[1312211613.855217] [032.2] [pid=22154] ** Attempting to notifying contact 'xxx-monitorcsp'...

[1312211613.855235] [032.2] [pid=22154] ** Checking service notification viability for contact 'xxx-monitorcsp'...

[1312211613.855256] [032.2] [pid=22154] ** Notifying contact 'xxx-monitorcsp'

[1312211613.855336] [032.2] [pid=22154] Raw notification command: /usr/local/icinga/etc/scripts/icinga_sendmail_monitorcsp.pl "$NOTIFICATIONTYPE$" "$SERVICEDESC$" "$HOSTADDRESS$" "$SERVICESTATE$" "$LONGDATETIME$" "$CONTACTEMAIL$"

[1312211613.855398] [032.2] [pid=22154] Processed notification command: /usr/local/icinga/etc/scripts/icinga_sendmail_monitorcsp.pl "CUSTOM" "CSP Monitor" "cz.frontend.xxx" "OK" "Mon Aug 1 17:13:33 JREUS 2011" "xxx.ranfi@xxx"

[1312211613.865045] [032.2] [pid=22154] ** Attempting to notifying contact 'xxx-csp'...

[1312211613.865063] [032.2] [pid=22154] ** Checking service notification viability for contact 'xxx-csp'...

[1312211613.865097] [032.2] [pid=22154] ** Notifying contact 'xxx-csp'

[1312211613.865123] [032.2] [pid=22154] Raw notification command: /usr/local/icinga/etc/scripts/icinga_sendmail_monitorcsp.pl "$NOTIFICATIONTYPE$" "$SERVICEDESC$" "$HOSTADDRESS$" "$SERVICESTATE$" "$LONGDATETIME$" "$CONTACTEMAIL$"

[1312211613.865151] [032.2] [pid=22154] Processed notification command: /usr/local/icinga/etc/scripts/icinga_sendmail_monitorcsp.pl "CUSTOM" "CSP Monitor" "cz.frontend.xxx" "OK" "Mon Aug 1 17:13:33 JREUS 2011" "xxx.santi@xxx"

[1312211613.874573] [032.0] [pid=22154] 2 contacts were notified.

But:

Looks like all ok but icinga don't run the script.

On the shell if I launch the raw notification command as Root and icinga user both users work like a charm.

I don't know how to do more to run the script

Icinga don't run it . If I use a test perl script that write some bla bla on one file and nothing else nothing appened. Icinga just don't run any perl script.

If I put some append >> and 2>> at the end of the command (tried with illegal_macro_output_chars=`~$|'" ) no file output. If I try on the shell work fine and produce output and no error.

Embedded perl disable.I'm using perl strict


did you try defining the script using the perl interpreter instead of calling it directly? like

command_line perl /usr/local/....

probably the icinga user's environment isn't aware of the interpreter and fails such as. for further siomulation i'd suggest changing to the icinga user's env with

# su - icinga

and test the run over there too. but beware, the icinga daemon doesn't use something like a .bashrc, but the init script can be used as a source for exports.


Thanks and let me know if someone have some advice

Lorenzo

------------------------------------------------------------------------


------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey


_______________________________________________
icinga-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/icinga-users


--
DI (FH) Michael Friedrich

Vienna University Computer Center
Universitaetsstrasse 7 A-1010 Vienna, Austria

email:     [email protected]
phone:     +43 1 4277 14359
mobile:    +43 664 60277 14359
fax:       +43 1 4277 14338
web:       http://www.univie.ac.at/zid
           http://www.aco.net

Icinga Core&  IDOUtils Developer
http://www.icinga.org


------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/icinga-users

Reply via email to