Monitoring Asterisk with Icinga2
Main What is Icinga? How it works? Monitoring agents. Existing Plugins. Create custom plugins. Preference Data from plugins.
Icinga is… Icinga 2 is an open source monitoring system which checks the availability of your network resources. Icinga both sends queries to devices/services and receives status updates. Icinga 1 is a Nagios fork and it is compatible with Nagios Plugins. Icinga 2 is rewritten from scratch and is still compatible Nagios Plugins. Icinga is very flexible and extensible. Multithreaded and scalable for small embedded systems as well as large scale environments. A lot of plugins already exists and it is very simple to create your custom plugin.
Icinga 2 Packages Debian Upstream, DebMon, Icinga Repository Ubuntu Upstream, Icinga PPA, Icinga Repository RHEL/CentOS Icinga Repository OpenSUSE Icinga Repository, Server Monitoring Repository SLES Gentoo Upstream FreeBSD ArchLinux
Icinga UI. Three kind of UI exist today. Classic UI. Icinga Web.
How it works? Icinga server and Modules. Agent less plugins. Compatible with Icinga 2 check agents. Plugins. Nagios plugins and custom plugins.
Icinga 2 Multithreaded and scalable for small embedded systems as well as large scale environments. Real-time monitoring capabilities. Can run checks every second. Modularity just enable or disable module and run reload. Live Status add-on . You can query Icinga to get info. DB IDO Module (Database Icinga Data Output).
Icinga Checks Agent less checks. Http, Ping, SSH and more. (Usually every check that uses known protocol). Agent Based Checks. Plugins on remote host that can’t use protocol, use Agents.
Icinga Compatible Agents NRPE (Nagios Remote Plugin Executor). NSClient++ (For Windows and Linux). SNMP daemon (Cisco routers, not only). SSH can use ssh automatic connection to fetch information from plugins on remote host. Icinga 2 Agent under development now. There are more (can be found in Icinga 2 docs).
Check by ssh check_by_ssh plugin Asterisk inbound Asterisk outbound Icinga2 server Asterisk outbound Nagios Plugins ssh server ssh server CheckCommand “by_ssh” Nagios Plugins ssh automatic connection ssh automatic connection check_by_ssh plugin ssh automatic connection ssh server Nagios plugins Asterisk ss7
CheckCommand “by_nrpe” Check by nrpe CheckCommand “nrpe” Asterisk inbound Asterisk outbound Icinga 2 server Nagios plugins CheckCommand “by_nrpe” Nagios plugins Nrpe server xinetd Nrpe server xinetd Nrpe check Nrpe check check_nrpe plugin
Icinga Plugins Nagios Plugins Icinga Plugins http://exchange.nagios.org/ https://www.monitoringexchange.org/ Icinga Plugins https://exchange.icinga.org/ There are also Custom Plugins.
Custom Plugins. Plugin Directory. Usually is /usr/lib64/nagios/plugins/ on remote host. Plugin in directory “check_mycheck”. Command inside /etc/nagios/nrpe.cfg (on remote host). NRPE agent (could be other agents).
Custom Plugin If(UNKNOWN STATE){ echo “UNKNOWN: Unknown alert or command| ‘unknownt‘=-1 'curcalls‘ = ?”; exit(3); }else If (CRITICAL STATE){ echo "CRITICAL: Current calls 60 and critical alert is 55 | 'critlimit‘=55 'curcalls‘ = 60” ; exit(2); } else If (WARNING STATE){ echo “WARNING: Current calls 45 and warning alert is 40 | ‘warnlimit‘=40 'curcalls‘ = 45” ; exit(1); }else { echo "OK - Current calls 15 | 'calls'= 15”; exit(0); }
Performance Data Icinga2-enable-future prefdata. Spool Dir /var/spool/icinga2/prefdata/ File name for host data: host- perfdata.<timestamp> File name for Service data : service- perfdata.<timestamp> Plugins pass performance data to Icinga server this data can be saved in files and can be red by some Add-ons to presenting it as stats and graphs. In the example above all data that comes after “|” pipe is performance data.
Graphing Add-ons Performance data can be used for statistic and graphic presentations. Icinga 2 needs additional modules for saving this data in files. PNP4nagios uses data written by PrefdataWriter Icinga module. InGraph same (PrefdataWriter ). Graphite (GraphiteWriter Icinga 2 Module).
The End David Bereslavich DevOps Engineer Greenfieldtech.net Email: david.bereslavich@reenfieldtech.net