Skip to content

Instantly share code, notes, and snippets.

@hluker
Last active October 5, 2021 01:22
Show Gist options
  • Select an option

  • Save hluker/a964fb78503fb0d6d621ba208c848101 to your computer and use it in GitHub Desktop.

Select an option

Save hluker/a964fb78503fb0d6d621ba208c848101 to your computer and use it in GitHub Desktop.
Installing Nagios onto Debian

Update components

sudo apt update && sudo apt upgrade
sudo apt install -y build-essential apache2 php openssl perl make php-gd libgd-dev libapache2-mod-php libperl-dev libssl-dev daemon wget apache2-utils unzip

Add users and put into groups

sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -a -G nagcmd www-data

Install!

cd /tmp/ 
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.6.tar.gz
tar -zxvf nagios-4.4.6.tar.gz 
cd /tmp/nagios-4.4.6/
sudo ./configure --with-nagios-group=nagios --with-command-group=nagcmd --with-httpd_conf=/etc/apache2/sites-enabled/
sudo make all
sudo make install
sudo make install-init
sudo make install-config
sudo make install-commandmode
sudo make install-webconf

Install plugins

cd /tmp
wget https://nagios-plugins.org/download/nagios-plugins-2.3.3.tar.gz
tar -zxvf /tmp/nagios-plugins-2.3.3.tar.gz
cd /tmp/nagios-plugins-2.3.3/
sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios
sudo make
sudo make install

Apache stuff

sudo a2enmod cgi
sudo a2enmod ssl
sudo systemctl restart apache2

check_ncpa

cd /usr/local/nagios/libexec/
wget https://raw.githubusercontent.com/NagiosEnterprises/ncpa/master/client/check_ncpa.py

slack_nagios

apt install libhttp-request-ascgi-perl

mailx

apt update && apt upgrade
apt install libsasl2-modules postfix mailutils
vi /etc/postfix/sasl/sasl_passwd
[smtp.gmail.com]:587 notifications@iaswc.org:xxxx
postmap /etc/postfix/sasl/sasl_passwd 
sudo chown root:root /etc/postfix/sasl/sasl_passwd /etc/postfix/sasl/sasl_passwd.db 
chmod 600 /etc/postfix/sasl/sasl_passwd /etc/postfix/sasl/sasl_passwd.db 
rm -rf /etc/postfix/sasl/sasl_passwd 
vi /etc/postfix/main.cf
myhostname=atlas.dev.luker.org
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_tls_security_level = encrypt
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
sudo systemctl restart postfix

https://www.linode.com/docs/guides/configure-postfix-to-send-mail-using-gmail-and-google-workspace-on-debian-or-ubuntu/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment