Last active
February 27, 2016 16:10
-
-
Save jshiell/9934929 to your computer and use it in GitHub Desktop.
Icinga on CentOS 6.4 via RPM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# These are very quick & dirty notes on getting Icinga installed on Centos 6.5 via RPMs, | |
# as most documentation seems to be based around source installation. It's mostly recovered from | |
# my history as I worked it out, so no guarantees are offered. | |
# Make EPEL available | |
sudo rpm -Uvh http://mirror.bytemark.co.uk/fedora/epel/6/i386/epel-release-6-8.noarch.rpm | |
# Install HTTPd | |
sudo yum install httpd | |
sudo service https start | |
sudo chkconfig httpd on | |
sudo iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT && sudo service iptables save | |
# Turn off selinux | |
echo 0 >/selinux/enforce | |
sed -i'' -e 's%^SELINUX=.*$%SELINUX=disabled%g' /etc/selinux/config | |
# Ensure Postfix will work | |
sudo mkfifo /var/spool/postfix/public/pickup | |
sudo service postfix restart | |
sudo chkconfig postfix on | |
# Install MySQL and repos | |
sudo yum install http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm | |
sudo yum install Percona-Server-server-56 | |
sudo service mysql start | |
sudo chkconfig mysql on | |
# Set up icinga | |
cd /etc/yum.repos.d/ | |
sudo wget http://packages.icinga.org/epel/6/release/ICINGA-release.repo | |
sudo yum makecache | |
sudo yum install icinga icinga-idoutils icinga-idoutils-libdbi-mysql pnp4nagios nagios-plugins nagios-plugins-mysql nagios-plugins-pgsql | |
echo "CREATE DATABASE icinga; \ | |
GRANT USAGE ON *.* TO 'icinga'@'localhost' \ | |
IDENTIFIED BY 'icinga' \ | |
WITH MAX_QUERIES_PER_HOUR 0 \ | |
MAX_CONNECTIONS_PER_HOUR 0 \ | |
MAX_UPDATES_PER_HOUR 0; \ | |
GRANT SELECT , INSERT , UPDATE , DELETE, DROP, CREATE VIEW \ | |
ON icinga.* TO 'icinga'@'localhost'; \ | |
FLUSH PRIVILEGES;" \ | |
| mysql -u root | |
cat /usr/share/doc/icinga-idoutils-libdbi-mysql-*/db/mysql/mysql.sql | mysql -u root icinga | |
# Set up icings-web | |
sudo yum install php icinga-web icinga-web-mysql icinga-web-module-pnp | |
echo "CREATE DATABASE icinga_web; \ | |
GRANT USAGE ON *.* TO 'icinga_web'@'localhost' \ | |
IDENTIFIED BY 'icinga_web' \ | |
WITH MAX_QUERIES_PER_HOUR 0 \ | |
MAX_CONNECTIONS_PER_HOUR 0 \ | |
MAX_UPDATES_PER_HOUR 0; \ | |
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX \ | |
ON icinga_web.* TO 'icinga_web'@'localhost'; \ | |
FLUSH PRIVILEGES ;" \ | |
| mysql -u root | |
cat /usr/share/doc/icinga-web-1.11.0/schema/mysql.sql | mysql -u root icinga_web | |
# Ensure apache can write to the command queue | |
sudo usermod -a -G icingacmd apache | |
# Prepare config files | |
sudo sed -i'' "s|^[ ;]*date.timezone *=.*|date.timezone='Europe/London'|" /etc/php.ini | |
sudo sed -i'' 's/^ *process_performance_data *=.*/process_performance_data=1/' /etc/icinga/icinga.cfg | |
sudo sed -i'' 's/^ *date_format *=.*/date_format=euro/' /etc/icinga/icinga.cfg | |
sudo sed -i'' 's/^ *enable_environment_macros *=.*/enable_environment_macros=1/' /etc/icinga/icinga.cfg | |
# Set up performance tracking for Icinga | |
sudo sed -i'' 's/^ *user *=.*/user=icinga/' /etc/pnp4nagios/npcd.cfg | |
sudo sed -i'' 's/^ *group *=.*/group=icinga/' /etc/pnp4nagios/npcd.cfg | |
sudo chown -R icinga:icinga /var/spool/pnp4nagios /var/log/pnp4nagios /var/lib/pnp4nagios | |
echo -e 'define module { | |
module_name npcdmod | |
module_type neb | |
path /usr/lib64/nagios/brokers/npcdmod.o | |
args config_file=/etc/pnp4nagios/npcd.cfg | |
}' >/etc/icinga/modules/pnp.cfg | |
# Plugin madness | |
sudo yum install nagios-plugins nrpe nagios-plugins-load nagios-plugins-users nagios-plugins-apt nagios-plugins-breeze nagios-plugins-by_ssh nagios-plugins-check_sip nagios-plugins-cluster nagios-plugins-dhcp nagios-plugins-dig nagios-plugins-disk nagios-plugins-disk_smb nagios-plugins-dns nagios-plugins-file_age nagios-plugins-flexlm nagios-plugins-fping nagios-plugins-game nagios-plugins-hpjd nagios-plugins-http nagios-plugins-icmp nagios-plugins-ide_smart nagios-plugins-ifoperstatus nagios-plugins-ifstatus nagios-plugins-ircd nagios-plugins-ldap nagios-plugins-linux_raid nagios-plugins-log nagios-plugins-mailq nagios-plugins-mrtg nagios-plugins-mrtgtraf nagios-plugins-nagios nagios-plugins-nrpe nagios-plugins-nt nagios-plugins-ntp nagios-plugins-nwstat nagios-plugins-oracle nagios-plugins-overcr nagios-plugins-perl nagios-plugins-pgsql nagios-plugins-ping nagios-plugins-procs nagios-plugins-radius nagios-plugins-real nagios-plugins-rpc nagios-plugins-sensors nagios-plugins-smtp nagios-plugins-snmp nagios-plugins-ssh nagios-plugins-swap nagios-plugins-tcp nagios-plugins-time nagios-plugins-udp nagios-plugins-ups nagios-plugins-wave | |
# Allow sudo/ports for required plugins | |
echo 'icinga ALL=NOPASSWD: /usr/lib64/nagios/plugins/check_dhcp' >> /etc/sudoers | |
sudo iptables -I INPUT -i eth0 -p udp --dport 67:68 --sport 67:68 -j ACCEPT && sudo service iptables save | |
# Allow hip chat push | |
sudo yum install -y python-pip | |
sudo pip install hipsaint | |
# Activate all services | |
sudo chkconfig icinga on | |
sudo chkconfig ido2db on | |
sudo chkconfig npcd on | |
sudo service ido2db start | |
sudo service npcd start | |
sudo service icinga restart | |
# Lazy redirect | |
echo - '<!DOCTYPE html> | |
<html> | |
<head><title>Hades</title><meta http-equiv="refresh" content="0; url=/icinga-web"></head> | |
<body>Redirecting...</body> | |
</html>' > /var/www/html/index.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sudo service https start > sudo service httpd start