Installation documentation
Https://assets.nagios.com/downloads/nagioscore/docs/Installing_Nagios_Core_From_Source.pdf#_ga= 1.139535539.1081149190.1491445330
Solving Perl software compilation problems
[Email protected] yum.repos.d]# echo ' export lc_all=c ' >>/etc/profile ' # #设置环境变量
[Email protected] yum.repos.d]# tail-l/etc/profile
. "$i"
Else
. "$i" >/dev/null 2>&1
Fi
Fi
Done
unset I
Unset-f Pathmunge
Export Lc_all=c
[[email protected] yum.repos.d]# source/etc/profile "# # # Make the added environment variable configuration take effect
[Email protected] yum.repos.d]# echo $LC _all "# # # #查看设置结果
C
[Email protected] yum.repos.d]# CD ~
Close the fire wall and SELinux
1). [[Email protected] ~]# Setenforce 0
Setenforce:selinux is disabled
2). [[Email protected] ~]# sed-i "s/selinux=enforcing/selinux=disabled/g"
/etc/selinux/config
3). [[Email protected] ~]# Chcon-r-t httpd_sys_content_t/usr/local/nagios/sbin/
[Email protected] ~]# Chcon-r-t httpd_sys_content_t/usr/local/nagios/share/
Resolve time synchronization issues
[Email protected] ~]#/usr/sbin/ntpdate pool.ntp.org
11:01:05 ntpdate[68483]: The NTP socket is on use, exiting
[[email protected] ~]# echo ' #time sync by ZP at 2016-11-10 ' >>/var/spool/cron/root
[[email protected] ~]# echo ' */5 * * * */usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1 ' >>/VAR/SPOOL/CR On/root
[Email protected] ~]# crontab-l
#time sync by ZP at 2016-11-10
*/5 * * * */usr/sbin/ntpdate pool.ntp,org >/dev/null 2>&1
[Email protected] ~]#
Install the packages required by the Nagios server
Need the Web interface display monitoring effect, the display of the interface mainly uses PHP program, therefore need lamp environment.
Yum install gcc glibc glibc-common-y <##### upgrade compilation software
Yum install GD gd-devel-y "##### #用户后面的PNP出图的包
Yum install mysql-server-y "# # # #非必需, monitoring database
Yum Install httpd php php-gd-y "# # # #apache, PHP environment
[[email protected] ~]# rpm-qa mysql httpd php # # # #检查LAMP环境
Mysql-5.1.73-7.el6.x86_64
Php-5.3.3-48.el6_8.x86_64
Httpd-2.2.15-54.el6_8.x86_64
Create the users and groups required for the Nagios server
/usr/sbin/useradd nagios-m-s/sbin/nologin
/usr/sbin/usradd apache-m-s/sbin/nologin
/usr/sbin/usrmod-a-G Nagcmd Nagios
/usr/sbin/usrmod-a-G Nagcmd Apache
Installation omitted .....
String Check method:
[Email protected] objects]#/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfg
Add message
Vi/usr/local/nagios/etc/objects/contacts.cfg +35
Modify [email protected] for [email protected]
Enter http://IP/nagios/to access Nagios monitor screen
The monitoring site shows it appears as though you does not has permission to view information for any of the services you requests ...
Workaround:
Tables created with the user does not have permissions, plus permissions:
[Email protected] etc]# sed-i ' s/nagiosadmin/nagios/g ' cgi.cfg
[Email protected] etc]#/etc/init.d/nagios Reload
Running Configuration Check ...
Reloading Nagios configuration ...
Done
Create a Default User for Web Access. ADD A default user for Web Interface Access: htpasswd–c/usr/local/nagios/etc/htpasswd.users nagiosadmin
"Nagios"