1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>13.9. notifications.cfg</title>
<link rel="stylesheet" href="../stylesheets/icinga-docs.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
<meta name="keywords" content="Supervision, Icinga, Nagios, Linux">
<link rel="home" href="index.html" title="Icinga Version 1.14 Documentation">
<link rel="up" href="ch13.html" title="Chapter 13. Icinga Samples">
<link rel="prev" href="sample-localhost.html" title="13.8. localhost.cfg">
<link rel="next" href="sample-printer.html" title="13.10. printer.cfg">
<script src="../js/jquery-min.js" type="text/javascript"></script><script src="../js/icinga-docs.js" type="text/javascript"></script>
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<CENTER><IMG src="../images/logofullsize.png" border="0" alt="Icinga" title="Icinga"></CENTER>
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">13.9. notifications.cfg</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="sample-localhost.html">Prev</a> </td>
<th width="60%" align="center">Chapter 13. Icinga Samples</th>
<td width="20%" align="right"> <a accesskey="n" href="sample-printer.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="section" title="13.9. notifications.cfg">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="sample-notifications"></a>13.9. <a name="sample_notifications"></a>notifications.cfg</h2></div></div></div>
<pre class="programlisting">
###############################################################################
# NOTIFICATIONS.CFG - SAMPLE NOTIFICATION COMMAND DEFINITIONS FOR ICINGA
#
# NOTES: This config file provides you with some example notification definitions
# that you can reference in host, service, and contact definitions.
#
# You don't need to keep commands in a separate file from your other
# object definitions. This has been done just to make things easier to
# understand.
#
# These are some advanced notification commands. They may or may not work on
# your system without modification. As an example, some systems will require
# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
#
# Furthermore, make sure to replace ICINGAHOST with the appropriate host name
# if used in any notification as url.
#
# Notifications are using the macros quite a lot. Watch out for your own in the
# official docs: http://docs.icinga.org/latest/en/macrolist.html
#
# Those notification commands need to be assigned to the contacts/contactgroups
# as host_notification_commands and service_notification_commands as comma
# separated list.
#
################################################################################
################################################################################
# NOTIFICATIONS BY EMAIL
#
# The idea is to add more information to the ascii-only email. This includes
# notes_url, display_name, comment+author.
# subject
# $NOTIFICATIONTYPE$ - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$
# body
# $SHORTDATETIME$ - Info:
#
# $SERVICEOUTPUT$
#
# $NOTIFICATIONTYPE$ - Service $SERVICEDESC$ on Host $HOSTALIAS$ is $SERVICESTATE$
#
# (Address: $HOSTADDRESS$, Displayname: $SERVICEDISPLAYNAME$)
#
# Notes: $NOTIFICATIONAUTHOR$ $NOTIFICATIONCOMMENT$
# $SERVICENOTESURL$
#
# Url:
# http://ICINGAHOST@cgiurl@/status.cgi?host=$HOSTNAME$
################################################################################
# 'notify-host-by-email-advanced' command definition
define command{
command_name notify-host-by-email-advanced
command_line /usr/bin/printf "%b" "$SHORTDATETIME$ - Info:\n\n$HOSTOUTPUT$\n\n$NOTIFICATIONTYPE$ - Host $HOSTNAME$ is $HOSTSTATE$\n\n(Address: $HOSTADDRESS$ Displayname: $HOSTDISPLAYNAME$)\n\nNotes: $NOTIFICATIONAUTHOR$ $NOTIFICATIONCOMMENT$\n$HOSTNOTESURL$\n\nUrl:\nhttp://ICINGAHOST@cgiurl@/extinfo.cgi?type=1&host=$HOSTNAME$\n\n" | @MAIL_PROG@ -s "$NOTIFICATIONTYPE$ - $HOSTNAME$ is $HOSTSTATE$" $CONTACTEMAIL$
}
# 'notify-service-by-email-advanced' command definition
define command{
command_name notify-service-by-email-advanced
command_line /usr/bin/printf "%b" "$SHORTDATETIME$ - Info:\n\n$SERVICEOUTPUT$\n\n$NOTIFICATIONTYPE$ - Service $SERVICEDESC$ on Host $HOSTALIAS$ is $SERVICESTATE$\n\n(Address: $HOSTADDRESS$ Displayname: $SERVICEDISPLAYNAME$)\n\nNotes: $NOTIFICATIONAUTHOR$ $NOTIFICATIONCOMMENT$\n$SERVICENOTESURL$\n\nUrl:\nhttp://ICINGAHOST@cgiurl@/status.cgi?host=$HOSTNAME$\n\n" | @MAIL_PROG@ -s "$NOTIFICATIONTYPE$ - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTEMAIL$
}
################################################################################
# NOTIFICATIONS BY JABBER (XMPP)
#
# http://www.gridpp.ac.uk/wiki/Nagios_jabber_notification
# check contrib/notifications/notify_via_jabber for the script and copy it to
# $USER1$ location (check resource.cfg)
#
# Hint: make sure to define 'pager' as contact attribute! Alternatively, replace
# $CONTACTPAGER$ with $CONTACTADDRESS1$ and use 'address1' attribute instead.
################################################################################
define command {
command_name notify-service-by-jabber
command_line $USER1$/notify_via_jabber $CONTACTPAGER$ "$SHORTDATETIME$ - Info: $SERVICEOUTPUT$ | $NOTIFICATIONTYPE$ - Service $SERVICEDESC$ on Host $HOSTALIAS$ is $SERVICESTATE$ | (Address: $HOSTADDRESS$ Displayname: $SERVICEDISPLAYNAME$) | Notes: $NOTIFICATIONAUTHOR$ $NOTIFICATIONCOMMENT$ $SERVICENOTESURL$ | Url: http://ICINGAHOST@cgiurl@/status.cgi?host=$HOSTNAME$"
}
define command {
command_name notify-host-by-jabber
command_line $USER1$notify_via_jabber $CONTACTPAGER$ "$SHORTDATETIME$ - Info: $HOSTOUTPUT$ | $NOTIFICATIONTYPE$ - Host $HOSTNAME$ is $HOSTSTATE$ | (Address: $HOSTADDRESS$ Displayname: $HOSTDISPLAYNAME$) | Notes: $NOTIFICATIONAUTHOR$ $NOTIFICATIONCOMMENT$ $HOSTNOTESURL$ | Url: http://ICINGAHOST@cgiurl@/extinfo.cgi?type=1&host=$HOSTNAME$"
}
################################################################################
# NOTIFICATIONS BY TWITTER
################################################################################
define command {
command_name notify-host-by-twitter
command_line $USER1$/eventhandler_twitter.php -t "HOST" -h "$HOSTALIAS$" -s "$HOSTSTATE$" -o "$HOSTOUTPUT$"
}
define command {
command_name notify-service-by-twitter
command_line $USER1$/eventhandler_twitter.php -t "SERVICE" -h "$HOSTALIAS$" -s "$SERVICESTATE$" -d "$SERVICEDESC$" -o "$SERVICEOUTPUT$"
}
################################################################################
# NOTIFICATIONS BY SMS
#
# First off, you need either a local sms service, or an sms gateway. Besides
# an applicable plugin interacting the that api and integrated as notification
# command. Below is only the command example.
################################################################################
define command {
command_name notify-host-by-sms
command_line /usr/bin/printf "%b" "$NOTIFICATIONTYPE$ - $HOSTNAME$ is $HOSTSTATE$ $SHORTDATETIME$ - Info:\n\n$HOSTOUTPUT$\n\n($HOSTADDRESS$)" | $USER1$/notify_via_sms $CONTACTPAGER$
}
define command {
command_name notify-service-by-sms
command_line /usr/bin/printf "%b" "$NOTIFICATIONTYPE$ - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ $SHORTDATETIME$ - Info:\n\n$SERVICEOUTPUT$\n\n($HOSTADDRESS$)" | $USER1$/notify_via_sms $CONTACTPAGER$
}
################################################################################
# MORE NOTIFICATION POSSIBILITIES
#
# NoMa: https://www.netways.org/projects/noma/
# IRCBot: http://www.vanheusden.com/nagircbot/
################################################################################
</pre>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="sample-localhost.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="ch13.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="sample-printer.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">13.8.
localhost.cfg </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> 13.10. printer.cfg</td>
</tr>
</table>
</div>
<P class="copyright">© 1999-2009 Ethan Galstad, 2009-2017 Icinga Development Team, https://www.icinga.com</P>
</body>
</html>
|