Results 1 to 5 of 5

Thread: [RESOLVED] Email notification command_line with '}'

  1. #1

    [RESOLVED] Email notification command_line with '}'

    I'm having an issue porting my Nagios notifications to Shinken, in particular the } character when used in the command_line (but the { is just fine.)

    Any thoughts on why this fails the config check?

    If I delete the CSS portion of the code below the config check passes, but as soon as I add any one line (such as "body, td {text-align: center}&quot it fails. Subtract the } and it passes.

    This is my last big hurdle and then I can convert over to Shinken, so I'm rather frustrated. Any help would be appreciated.

    Thank you.

    Code:
    define command{
    	command_name	host-notify-by-email-html
    	command_line  /usr/bin/printf "%b" "MIME-Version: 1.0 \n\
    Content-Type: text/html \n\
    Content-Disposition: inline \n\
    From: email@example.com \n\
    To: $CONTACTEMAIL$ \n\
    Subject: $HOSTALIAS$ is $HOSTSTATE$ (HOST $NOTIFICATIONTYPE$) \n\
    <html><head><meta http-equiv=\"Content-Type\" content=\"text/html\"><style type=\"text/css\"> \
    	body, td {text-align: center} \n\
    	table {margin: 0px auto} \n\
    	table {width: 500px} \n\
    	table {border: 1px solid black} \n\
    	td.customer {background-color: #004488} \n\
    	td.customer {color: white} \n\
    	td.customer {font-size: 12pt} \n\
    	th {white-space: nowrap} \n\
    	th, td.output {text-align: left} \n\
    	tr.even th {background-color: #D9D9D9} \n\
    	tr.even td, tr.odd th {background-color: #F2F2F2} \n\
    	tr.odd td {background-color: white} \n\
    	td.ACKNOWLEDGEMENT {background-color: blue} \n\
    	td.PROBLEM {background-color: red} \n\
    	td.RECOVERY {background-color: green} \n\
    	span.WARNING, span.UNKNOWN {color: orange} \n\
    	span.CRITICAL, span.DOWN, span.UNREACHABLE {color: red} \n\
    	span.OK, span.UP {color: green} \n\
    	td.output {padding: 15px 10px} \n\
    </style> \
    <title>$HOSTALIAS$ is $HOSTSTATE$ (HOST $NOTIFICATIONTYPE$)</title></head> \n\
    <body><table> \
    	<tr><td colspan=2 class=$NOTIFICATIONTYPE$><b>HOST $NOTIFICATIONTYPE$</b></td></tr> \
    	<tr class=odd><th>Host:</th><td><b>$HOSTALIAS$</b></td></tr> \
    	<tr class=even><th>Host State:</th><td><span class=$HOSTSTATE$><b>$HOSTSTATE$</b></span> <i>for</i> $HOSTDURATION$</td></tr> \
    	<tr class=odd><th>Host IP:</th><td>$HOSTADDRESS$</td></tr> \
    	<tr class=even><th>Date, Time:</th><td>$LONGDATETIME$</td></tr> \
    	<tr><td colspan=2 class=output><i><p>$HOSTOUTPUT$</p><p>$LONGHOSTOUTPUT$</p></i></td></tr> \
    	<tr><td colspan=2 class=output><p>$HOSTACTIONURL$</p></td></tr>\
    	<tr><td colspan=2 class=customer><b>OUR COMPANY</b></td></tr> \
    </table></body></html>" | sendmail -v -t
    }

  2. #2

    Re: Email notification command_line with '}'

    Ah, minor details:

    • [li]I'm running Shinken v1.0[/li]
      [li]Error:[/li]
    Code:
    Checking commands...
    host-notify-by-email-html missing property : command_line
    Error: In host-notify-by-email-html is incorrect ; from /usr/local/shinken/etc/notifications.cfg
    	commands conf incorrect !!
    Thanks again.

  3. #3
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Email notification command_line with '}'

    Hi,

    It should take the } as the } for closing the command object. I'll see to catch that this ending "}" should be the only in the line, and so your definition should work.

    PS: did you look at the send-mail-color.pl script?
    No direct support by personal message. Please open a thread so everyone can see the solution

  4. #4
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Email notification command_line with '}'

    It's fixed in the last commit
    https://github.com/naparuba/shinken/...cda1042ca32cb0

    It will be in the 1.0.1 version so
    No direct support by personal message. Please open a thread so everyone can see the solution

  5. #5

    Re: Email notification command_line with '}'

    Very nice, thank you.

    And I didn't know about the .pl script but I do now! I'll read up on it now.

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •