{"id":864,"date":"2015-03-26T05:46:22","date_gmt":"2015-03-26T12:46:22","guid":{"rendered":"http:\/\/blog.ls-al.com\/?p=864"},"modified":"2015-03-26T05:46:22","modified_gmt":"2015-03-26T12:46:22","slug":"nagios-email-notifications-with-comments","status":"publish","type":"post","link":"https:\/\/blog.ls-al.com\/nagios-email-notifications-with-comments\/","title":{"rendered":"Nagios Email Notifications with Comments"},"content":{"rendered":"

If you prefer more detail in the email notification of Nagios here is how to add those comments. For example someone acknowledging a service and you want to see the comment they added during acknowledgement.<\/p>\n

\r\n# pwd\r\n\/usr\/local\/nagios\/etc\/objects\r\n# more commands.cfg\r\n[..]\r\ndefine command{\r\n        command_name    notify-service-by-email\r\n        command_line    \/usr\/bin\/printf "%b" "***** Nagios *****\\n\\nNotification Type: $NOTIFICATIONTYPE$\\n\\nService: $SERVICEDESC$\\nHost: $HOSTALIAS$\\nAddress: $HOSTADDRESS$\\nState: $SERVICESTATE$\\n\\nDate\/Time: $LONGDATETIME$\\n\\nAdditional Info:\\n\\n$SERVICEOUTPUT$\\n\\nACK Comment: $SERVICEACKCOMMENT$\\n\\nComment: $NOTIFICATIONCOMMENT$\\n" | \/usr\/bin\/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$\/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$\r\n<\/pre>\n

Note: I added $SERVICEACKCOMMENT$ and $NOTIFICATIONCOMMENT$ but I think in newer versions of Nagios $SERVICEACKCOMMENT$ is deprecated and you only need $NOTIFICATIONCOMMENT$.<\/p>\n

Link: http:\/\/nagios.sourceforge.net\/docs\/3_0\/macrolist.html<\/p>\n","protected":false},"excerpt":{"rendered":"

If you prefer more detail in the email notification of Nagios here is how to add those comments. For example<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/864"}],"collection":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/comments?post=864"}],"version-history":[{"count":0,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/864\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/media?parent=864"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/categories?post=864"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/tags?post=864"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}