Homepage

Thursday, June 23, 2016

How to Install Nagvis with Check_mk

In nagvis need to have backend to create data from Nagios Server to Nagvis, so before install Nagvis we must install check_mk first by follow the instruction below:

Prerequisites.

Check_mk GUI need a python apache module that is not included in distro repositories actually. It can be installed from EPEL repositories.

# Install EPEL Repositories (if needed it)
rpm --import https://fedoraproject.org/static/0608B895.txt
wget 
http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

yum localinstall epel-release-6-8.noarch.rpm

# Install python module for apache
yum install mod_python gcc gcc-c++ rsync php
Install
tar zxfv check_mk-1.2.5i2p1.tar.gz
cd check_mk-1.2.5i2p1
./setup
Check_mk install is quite easy. It may be even easier if you copy next text in a file named “.check_mk_setup.conf” in your home root (first character file name is “.”).  
# just follow this step to setup check_mk
bindir=’/usr/bin’
confdir=’/etc/check_mk’
sharedir=’/usr/share/check_mk’
docdir=’/usr/share/doc/check_mk’
checkmandir=’/usr/share/doc/check_mk/checks’
vardir=’/var/lib/check_mk’
agentslibdir=’/usr/lib/check_mk_agent’
agentsconfdir=’/etc/check_mk’
nagiosuser=’nagios’
wwwuser=’apache’
wwwgroup=’nagcmd’
nagios_binary=’/usr/local/nagios/bin/nagios’
nagios_config_file=’/usr/local/nagios/etc/nagios.cfg’
nagconfdir=’/usr/local/nagios/etc/check_mk.d’
nagios_startscript=’/etc/init.d/nagios’
nagpipe=’/usr/local/nagios/var/rw/nagios.cmd’
check_result_path=’/usr/local/nagios/var/spool/checkresults’
nagios_status_file=’/usr/local/nagios/var/status.dat’
check_icmp_path=’/usr/local/nagios/libexec/check_icmp’
url_prefix=’/’
apache_config_dir=’/etc/httpd/conf.d’
htpasswd_file=’/usr/local/nagios/etc/htpasswd.users’
nagios_auth_name=’Nagios Access’
pnptemplates=’/usr/local/pnp4nagios/share/templates’
rrd_path=’/var/lib/nagios/rrd’
rrdcached_socket=’/tmp/rrdcached.sock’
enable_livestatus=’yes’
nagios_version=’4.0.5
libdir=’/usr/lib/check_mk’
livesock=’/usr/local/nagios/var/rw/live’
livebackendsdir=’/usr/share/check_mk/livestatus’
enable_mkeventd=’yes’
mkeventdstatedir=’/var/lib/mkeventd’
# Load Livestatus Module
broker_module=/usr/lib/check_mk/livestatus.o /usr/local/nagios/var/rw/live
event_broker_options=-1
We can test check_mk in URI http://server/check_mk.

chmod 0770 /var/lib/check_mk/wato/ -R
 chown apache:nagios -R /var/lib/check_mk/wato/
 chmod 777 -R /etc/check_mk/conf.d/wato/
chmod 777 -R /etc/check_mk/multisite.d/wato/
 chown apache:nagios -R /var/lib/check_mk/web/

If you find any problem with check_mk livestatus connect to Nagios, first to look is correct load of livestatus in nagios.log:

> tail /usr/local/nagios/var/nagios.log
[1396806973] livestatus: Livestatus 1.2.5i2 by Mathias Kettner. Socket: '/usr/local/nagios/var/rw/live'
[1396806973] livestatus: Please visit us at http://mathias-kettner.de/
[1396806973] livestatus: Hint: please try out OMD - the Open Monitoring Distribution
[1396806973] livestatus: Please visit OMD at http://omdistro.org
[1396806973] livestatus: Finished initialization. Further log messages go to /usr/local/nagios/var/livestatus.log
[1396806973] Event broker module '/usr/lib/check_mk/livestatus.o' initialized successfully.
[1396806974] Successfully launched command file worker with pid 4873
Example localhost in check_mk…
Nagvis

Prerequisites.

yum install php-mbstring php-pdo graphviz

Installation

tar zxfv nagvis-1.8b3.tar.gz
cd nagvis-1.8b3
./install.sh


Main questions from install are about paths and users but Nagvis install discover so good all important values. We must select only “backend mklivestatus”
+——————————————————————————+
| Welcome to NagVis Installer 1.8b3 |
+——————————————————————————+
| This script is built to facilitate the NagVis installation and update |
| procedure for you. The installer has been tested on the following systems: |
– Debian, since Etch (4.0) |
– Ubuntu, since Hardy (8.04) |
– SuSE Linux Enterprise Server 10 and 11 |
| |
| Similar distributions to the ones mentioned above should work as well. |
| That (hopefully) includes RedHat, Fedora, CentOS, OpenSuSE |
| |
| If you experience any problems using these or other distributions, please |
| report that to the NagVis team. |
+——————————————————————————+
| Do you want to proceed? [y]: y
+——————————————————————————+
| Starting installation of NagVis 1.8b3 |
+——————————————————————————+
| OS : CentOS release 6.5 (Final) |
| |
+— Checking for tools ——————————————————-+
| Using packet manager /bin/rpm found |
| |
+— Checking paths ———————————————————–+
| Please enter the path to the nagios base directory [/usr/local/nagios]:
| nagios path /usr/local/nagios found |
| Please enter the path to NagVis base [/usr/local/nagvis]:
| |
+— Checking prerequisites —————————————————+
| PHP 5.3 found |
| PHP Module: gd php found |
| PHP Module: mbstring php found |
| PHP Module: gettext compiled_in found |
| PHP Module: session compiled_in found |
| PHP Module: xml compiled_in found |
| PHP Module: pdo php found |
| Apache mod_php found |
| Checking Backends. (Available: mklivestatus,ndo2db,ido2db,merlinmy) |
| Do you want to use backend mklivestatus? [y]: y
| Do you want to use backend ndo2db? [n]:
| Do you want to use backend ido2db? [n]:
| Do you want to use backend merlinmy? [n]:
| Livestatus Socket (/usr/local/nagios/var/rw/live) found |
| PHP Module: sockets compiled_in found |
….
+— Trying to detect Apache settings —————————————–+
| Please enter the web path to NagVis [/nagvis]:
| Please enter the name of the web-server user [apache]:
| Please enter the name of the web-server group [apache]:
| create Apache config file [y]:
| |
+— Checking for existing NagVis ———————————————+
| |
+——————————————————————————+
| Summary |
+——————————————————————————+
| NagVis home will be: /usr/local/nagvis |
| Owner of NagVis files will be: apache |
| Group of NagVis files will be: apache |
| Path to Apache config dir is: /etc/httpd/conf.d |
| Apache config will be created: yes |
| |
| Installation mode: install |
| |
| Do you really want to continue? [y]:
+——————————————————————————+
| Installation complete |
| |
| You can safely remove this source directory. |
| |
| For later update/upgrade you may use this command to have a faster update: |
| ./install.sh -n /usr/local/nagios -p /usr/local/nagvis -l “unix:/usr/local/nagios/var/rw/live” -b mklivestatus -u apache -g apache -w /etc/httpd/conf.d -a y
| |
| What to do next? |
– Read the documentation |
– Maybe you want to edit the main configuration file? |
| Its location is: /usr/local/nagvis/etc/nagvis.ini.php |
– Configure NagVis via browser |
– Initial admin credentials: |
| Username: admin |
| Password: admin |
+——————————————————————————+
service httpd reload
service nagios restart
chmod 777 /usr/local/nagios/var/rw -R (to allow Mklivestatus to create file to store data)
Test your new Nagivis web site: http://server/nagvis/ (admin/admin)


No comments:

Post a Comment