How To Install Nagios on CentOS 7 Centos, Linux, Tutorials March 02, 2015 16:09 For those of you who didn’t know, Nagios is an open source software that can be used for network and infrastructure monitoring. Aug 6, 2016 - This script is built to facilitate the NagVis installation and update . That (hopefully) includes RedHat, Fedora, CentOS, OpenSuSE .
Morning Everyone,Again thank you in advance for the help, but I'm having issues with NagVIS.
I've installed it via the install.sh command and set it up against ndoutil as the backend. When I try to access the webpage I'm getting;
Forbidden
You don't have permission to access /usr/local/nagvis/config.php on this server.
Here is the install log;
- Code: Select all
[root@nagios nagvis-1.8.5]# ./install.sh -m /usr/local/nagios/bin/ndo2db
+------------------------------------------------------------------------------+
Welcome to NagVis Installer 1.8.5
+------------------------------------------------------------------------------+
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.8.5
+------------------------------------------------------------------------------+
+--- Checking for tools -------------------------------------------------------+
Using packet manager /bin/rpm found
+--- Checking paths -----------------------------------------------------------+
Please enter the path to the nagios base directory [/usr/local/nagios]: /usr/local/nagios
nagios path /usr/local/nagios found
Please enter the path to NagVis base [/usr/local/nagvis]: /usr/local/nagvis
+--- Checking prerequisites ---------------------------------------------------+
PHP 5.4 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)
Do you want to use backend mklivestatus? [y]: n
Do you want to use backend ndo2db? [n]: y
Do you want to use backend ido2db? [n]: n
/usr/local/nagios/bin/ndo2db (ndo2db) found
PHP Module: mysql php found
WARNING: The Graphviz package was not found.
This may not be a problem if you installed it from source
Graphviz Module dot MISSING
Graphviz Module neato MISSING
Graphviz Module twopi MISSING
Graphviz Module circo MISSING
Graphviz Module fdp MISSING
SQLite 3.7 found
+--- Trying to detect Apache settings -----------------------------------------+
Please enter the web path to NagVis [/nagvis]: /usr/local/nagvis
Please enter the name of the web-server user [apache]: apache
Please enter the name of the web-server group [apache]: apache
create Apache config file [y]: 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]: y
+------------------------------------------------------------------------------+
Starting installation
+------------------------------------------------------------------------------+
Creating directory /usr/local/nagvis.. done
Creating directory /usr/local/nagvis/var.. done
Creating directory /usr/local/nagvis/var/tmpl/cache.. done
Creating directory /usr/local/nagvis/var/tmpl/compile.. done
Creating directory /usr/local/nagvis/share/var.. done
Copying files to /usr/local/nagvis.. done
Creating directory /usr/local/nagvis/etc/profiles.. done
Creating main configuration file.. done
adding sesscookie=/usr/local/nagvis done
adding htmlbase='/usr/local/nagvis' done
setting backend to ndomy_1 done
Adding webserver group to file_group.. done
Creating web configuration file.. done
Setting permissions for web configuration file.. done
+--- Setting permissions.. ---------------------------------------------------+
/usr/local/nagvis/etc/nagvis.ini.php-sample done
/usr/local/nagvis/etc done
/usr/local/nagvis/etc/maps done
/usr/local/nagvis/etc/maps/* done
/usr/local/nagvis/etc/geomap done
/usr/local/nagvis/etc/geomap/* done
/usr/local/nagvis/etc/profiles done
/usr/local/nagvis/share/userfiles/images/maps done
/usr/local/nagvis/share/userfiles/images/maps/* done
/usr/local/nagvis/share/userfiles/images/shapes done
/usr/local/nagvis/share/userfiles/images/shapes/* done
/usr/local/nagvis/var done
/usr/local/nagvis/var/* done
/usr/local/nagvis/var/tmpl done
/usr/local/nagvis/var/tmpl/cache done
/usr/local/nagvis/var/tmpl/compile done
/usr/local/nagvis/share/var done
+------------------------------------------------------------------------------+
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 -b ndo2db -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
<http://localhost/usr/local/nagvis/config.php>
- Initial admin credentials:
Username: admin
Password: admin
+------------------------------------------------------------------------------+
Nagios Core Download
Nagios 4.11, NDOUTILS 4 and NagVIS 1.8.5 on Centos 7, installed from http://www.nagvis.org/share/nagvis-1.8.5.tar.gzI can only assume i've done the apache bit incorrectly. any help would be appreciated.
Nagios,Pnp4Nagios & Nagvis installation on centos
20 Steps total
Step 1: Installation of apache
sudo yum install httpd
sudo service httpd start
sudo yum install php php-mysql
Step 2: Download packages & extract
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.2.tar.gz
wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
tar -xzf nagios-4.3.2.tar.gz
tar -xzf nagios-plugins-2.2.1.tar.gz
rm -rf *.tar.gz
Step 3: install required packages
yum install httpd php gcc glibc glibc-common gd gd-devel perl unzip -y
Step 4: add users and give rights
/usr/sbin/useradd -m nagios
passwd nagios
/usr/sbin/groupadd nagcmd # Used for Web Interface
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache
Step 5: compile the extracted code
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
now setup security for the front end
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
systemctl restart nagios && systemctl restart httpd
Step 6: Install nagios plugins
tar xzf nagios-plugins-2.1.1.tar.gz
cd nagios-plugins-2.1.1
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
How To Install Nagvis On Centos 7
Add Nagios services
chkconfig --add nagios
chkconfig nagios on
Verify the sample Nagios configuration files.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios start
Step 7: Disable selinux
nano /etc/sysconfig/selinux
and set SELINUX=disabled
reboot the machine
Step 8: Add firewall rules
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=444/tcp --permanent
firewall-cmd --zone=public --add-port=25/tcp --permanent
firewall-cmd --reload
systemctl restart nagios
systemctl restart httpd
Step 9: Installation NRPE
yum groupinstall 'Development Tools'
download http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
tar -xzf nrpe
cd nrpe
yum install -y gcc glibc glibc-common openssl openssl-devel perl wget
./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu
make all
make install
make install-xinetd
make install-daemon-config
nano /etc/xinetd.d/nrpe
and add only_from = your interal ip
service xinetd restart
Step 10: Installation pnp4nagios
yum install rrdtool perl-Time-HiRes rrdtool-perl php-gd
download pnp4 nagios
extract
cd
(https://downloads.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.26.tar.gz)
./configure
make
make all
make fullinstall
chkconfig --add npcd && chkconfig --level 35 npcd on
systemctl reload httpd
mv /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/install.php-ori
Step 11: edit nagios.cfg
usr/local/nagios/etc/nagios/.cfg
add / edit
# Bulk / NPCD mode
process_performance_data=1
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATAtTIMET::$TIMET$tHOSTNAME::$HOSTNAME$tSERVICEDESC::$SERVICEDESC$tSERVICEPERFDATA::$SERVICEPERFDATA$tSERVICECH$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file
host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATAtTIMET::$TIMET$tHOSTNAME::$HOSTNAME$tHOSTPERFDATA::$HOSTPERFDATA$tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$tHOSTSTATE::$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file Pw clean serial key.
Step 12: edit commands.cfg
# 'process-host-perfdata' command definition
define command{
command_name process-host-perfdata
command_line /usr/bin/printf '%b' '$LASTHOSTCHECK$t$HOSTNAME$t$HOSTSTATE$t$HOSTATTEMPT$t$HOSTSTATETYPE$t$HOSTEXECUTIONTIME$t$HOSTOUTPUT$t$HOSTPERFDATA$$
}
# 'process-service-perfdata' command definition
define command{
command_name process-service-perfdata
command_line /usr/bin/printf '%b' '$LASTSERVICECHECK$t$HOSTNAME$t$SERVICEDESC$t$SERVICESTATE$t$SERVICEATTEMPT$t$SERVICESTATETYPE$t$SERVICEEXECUTIONTIME$$
}
define command{
command_name process-service-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$
}
define command{
command_name process-host-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$
}
Nagios 4.3.4
Step 13: edit templates.cfg
define host {
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_'s domain
my $opt_token = 'yoursecret'; # The token from your Nagios services page
Step 19: edit contacts
define contact {
contact_name slack
alias Slack
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-service-by-slack
host_notification_commands notify-host-by-slack
}
Step 20: additional packages
for some script you need these packages
yum install cpan
cpan : install Net::DNS
yum install php-gd
yum install gd-progs
1 Comment
- Sonoradmle Feb 27, 2019 at 10:33pm
First thank you for great how-to, second, this tutorial will work with CentOS 7 (lastest)?