Install nagios di ubuntu 16.04/17.04 server

by koboi - 10-06-2017 at 06:43 AM
Administrator
Administrators
Posts:
83
Joined:
Mar 2016
Likes:
2
Reputation:
0
2 Year Of Member
#1
OP
Posted: 10-06-2017, 06:43 AM (This post was last modified: 10-26-2017, 08:37 AM by koboi.)
Perintah untuk install nagios


Code:
user[~] >> sudo su
root[~] >> apt-get install wget build-essential apache2 php apache2-mod-php7.0 php-gd libgd-dev sendmail unzip
root[~] >> useradd nagios
root[~] >> groupadd nagcmd
root[~] >> usermod -a -G nagcmd nagios
root[~] >> usermod -a -G nagios,nagcmd www-data
root[~] >> cd ~
root[~] >> wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.2.tar.gz
root[~] >> tar -xzf nagios*.tar.gz
root[~] >> cd nagios-4.3.2/
root[~] >> ./configure --with-nagios-group=nagios --with-command-group=nagcmd
root[~] >> make all
root[~] >> make install
root[~] >> make install-commandmode
root[~] >> make install-init
root[~] >> make install-config
root[~] >> /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf
root[~] >> cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
root[~] >> chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
root[~] >> cd ~
root[~] >> wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
root[~] >> tar -xzf nagios-plugins*.tar.gz
root[~] >> cd nagios-plugin-2.2.1/
root[~] >> ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl
root[~] >> make
root[~] >> make install
root[~] >> nano /usr/local/nagios/etc/objects/contacts.cfg


Edit contact email, contoh


Quote:email budi@backboxindonesia.or.id


Perintah selanjutnya


Code:
root[~] >> a2enmod rewrite
root[~] >> a2enmod cgi
root[~] >> htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin


Masukan password untuk login nagiosnya
Kemudian ketik lagi perintah di bawah


Code:
root[~] >> ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/
root[~] >> nano /etc/systemd/system/nagios.service


Di dalam nano tambahkan script ini


Quote:[Unit]
Description=Nagios
BindTo=network.target


[Install]
WantedBy=multi-user.target

[Service]
User=nagios
Group=nagios
Type=simple
ExecStart=/usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg


Selanjutnya masukan perintah ini


Code:
root[~] >> systemctl enable /etc/systemd/system/nagios.service
root[~] >> systemctl apache2 restart
root[~] >> systemctl nagios start
root[~] >> systemctl nagios restart


Testing nagios di browser, contoh alamatnya http://192.168.1.69/nagios/
Kalo muncul popup login berarti nagios sudah kita install.
Setelah itu masukkan username dan password yang telah kita buat tadi. Sebagai contoh


Quote:User : nagiosadmin
Pass : passwordygkitabuattadi


Step selanjutnya menambahkan host di dalam nagios, perintahnya adalah


Code:
root[~] >> apt-get install nagios-nrpe-server nagios-plugins
root[~] >> nano /etc/nagios/nrpe.cfg


Ganti server_address dengan ip address kita


Quote:server_address=192.168.1.69


Masukan perintah ini


Code:
root[~] >> service nagios-nrpe-server restart
root[~] >> nano /usr/local/nagios/etc/objects/baru.cfg


Masukan script ini untuk menambahkan host ke dalam nagios


Quote:define host{
        use                     linux-server
        host_name               Server
        alias                   Server
        address                 192.168.1.2
        }


Perintah selanjutnya adalah


Code:
root[~] >> nano /usr/local/nagios/etc/nagios.cfg


Setelah itu kita tambahkan script ini


Quote:cfg_file=/usr/local/nagios/etc/objects/baru.cfg


Sampai di sini nagios sudah bisa kita gunakan. Untuk perintah selanjutnya kita reload terlebih dahulu nagiosnya sebelum kita buka di browser dengan perintah ini.


Code:
root[~] >> /etc/init.d/nagios restart


Setelah di restart kita buka alamat ini http://192.168.1.69/nagios/ di browser. Dan setelah di tambah beberapa host di config nagios kurang lebih seperti ini tampilannya..

[Image: ZhgX1m5hQ_uQxt6BuGq2LQ.png]

Maaf kalo tutorialnya singkat banget. hehe
Akhir kata, selamat belajar. :)
Reply
Find Posts
Register an account or login to reply
Create an account
Create a free account today and start posting right away. It only takes a few seconds.
Login
Log into an existing account.
1 Guest(s)