how to wrap long lines in config?

Tedman Eng teng at dataway.com
Sun Aug 7 10:36:32 CEST 2005


I forgot to mention though, the macros have to be passed in some fashion:

For example, append them to the command_line and then read in as an argument
to your "notification handler" (here we append as one argument and split on
~ within the script, since some values may contain spaces).

       command_line    notify_host.sh
$NOTIFICATIONTYPE$~$SERVICEDESC$~$HOSTALIAS$

Nagios 2.0 lets you access these macros as $NAGIOS_ environment variables
(consult the documentation for more info).



-----Original Message-----
From: Tedman Eng 
Sent: Sunday, August 07, 2005 1:09 AM
To: 'prosolutions at gmx.net'
Cc: nagios-users at lists.sourceforge.net
Subject: RE: [Nagios-users] how to wrap long lines in config?



Yes, you can wrap them in bash:

       command_line    notify_host.sh


notify_host.sh:
---------------
#!/bin/bash
/usr/bin/printf "%b" \
"Nagios System\n\n\
Notification Type: $NOTIFICATIONTYPE$\n\n\
Service: $SERVICEDESC$\n\
Host: $HOSTALIAS$\n\
Address: $HOSTADDRESS$\n\
State: $SERVICESTATE$\n\n\
Date/Time: $LONGDATETIME$\n\n\
Additional Info:\n\n\
$SERVICEOUTPUT$" \
| /usr/bin/mail -s \
"** $NOTIFICATIONTYPE$ alert - \
$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" \
$CONTACTEMAIL$
---------------


-----Original Message-----
From: prosolutions at gmx.net [mailto:prosolutions at gmx.net]
Sent: Friday, August 05, 2005 8:28 PM
To: nagios-users at lists.sourceforge.net
Subject: [Nagios-users] how to wrap long lines in config?


some of the config lines look real ugly.  like:

       command_line    /usr/bin/printf "%b" "Nagios System\n\nNotification
Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost:
$HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time:
$LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mail -s
"** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$
**" $CONTACTEMAIL$


is it possible to wrap these ala bash to make them look sane?  e.g.:

command_line    /usr/bin/printf "%b" \
"Nagios System\n\n\
Notification Type: $NOTIFICATIONTYPE$\n\n\
Service: $SERVICEDESC$\n\
Host: $HOSTALIAS$\n\
Address: $HOSTADDRESS$\n\
State: $SERVICESTATE$\n\n\
Date/Time: $LONGDATETIME$\n\n\
Additional Info:\n\n\
$SERVICEOUTPUT$" \
| /usr/bin/mail -s \
"** $NOTIFICATIONTYPE$ alert - \
$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" \
$CONTACTEMAIL$



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
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