Escaping $OUTPUT$
Karl DeBisschop
karl at debisschop.net
Thu Jun 19 13:53:58 CEST 2003
On Thu, 2003-06-19 at 04:32, Johannes Dagemark wrote:
> use /bin/echo -e instead of /usr/bin/printf "%b"
or
/usr/bin/printf " ***** Nagios
*****\n\nDate/Time: $DATETIME$\n\nNotification Type:
$NOTIFICATIONTYPE$\nService: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress:
$HOSTADDRESS$\nState: $SERVICESTATE$\nAdditional Info:\n\n %s"
"$OUTPUT$" |
/bin/mail -s "*$NOTIFICATIONTYPE$ alert* - $HOSTNAME$/$SERVICEDESC$ is
$SERVICESTATE$" $CONTACTEMAIL$
This has the added virtue of being portable and POSIX compliant
> Regards
> Johannes Dagemark
> ----- Original Message -----
> From: "Rabie van der Merwe" <Rvdmerwe at mhg.co.za>
> To: <nagios-users at lists.sourceforge.net>
> Sent: Thursday, June 19, 2003 10:19 AM
> Subject: [Nagios-users] Escaping $OUTPUT$
>
>
> Hi,
>
> I need to escape the "$OUTPUT$" as one of my checks returns a "\" ( c:\ -
> total: 2.00 Gb - used: 2.00 Gb (100%) - free 0.00 Gb (0%) )
> and this causes printf to print up to the "\" and then stop.
>
> Anyone know how I can escape the output of the variable?
>
> Regards
> Rabie
>
>
> define command{
> command_name notify-by-email
> command_line /usr/bin/printf "%b" " ***** Nagios
> *****\n\nDate/Time: $DATETIME$\n\nNotification Type:
> $NOTIFICATIONTYPE$\nService: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress:
> $HOSTADDRESS$\nState: $SERVICESTATE$\nAdditional Info:\n\n$OUTPUT$" |
> /bin/mail -s "*$NOTIFICATIONTYPE$ alert* - $HOSTNAME$/$SERVICEDESC$ is
> $SERVICESTATE$" $CONTACTEMAIL$
> }
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: INetU
> Attention Web Developers & Consultants: Become An INetU Hosting Partner.
> Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
> INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
> _______________________________________________
> 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
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
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