背景:
阅读新闻
CentOS 6.4安装Nagios(中文版)
[日期:2013-08-08] 来源:Linux社区 作者:navyaijm [字体:]
一、安装
1、基础环境安装(系统最小安装)
yum install gcc glibc glibc-common gd gd-devel httpd
推荐阅读:
Nagios—服务和性能监控
CentOS 6.2 使用Nagios nrpe监控本地与远程Linux主机
[Nagios监控] CentOS 6.2安装配置Nagios Server
Nagios 的详细介绍:请点这里
Nagios 的下载地址:请点这里
2、 nagios和 nagios-plus的安装
/usr/sbin/useradd nagios 
/usr/sbin/groupadd nagcmd 
/usr/sbin/usermod -G nagcmd nagios 
/usr/sbin/usermod -G nagcmd apache 
tar -jxvf nagios-cn-3.2.3.tar.bz2 
cd nagios-cn-3.2.3 
./configure --with-group=nagios --with-user=nagios --with-command-group=nagcmd --with-gd-lib=/usr/lib --with 
-gd-inc=/usr/include
make all 
make install
make install-init 
make install-commandmode 
make install-config 
make install-webconf 
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin ##创建web登录用户名和密码 
chown -R nagios.nagios /usr/local/nagios/etc/htpasswd.users
tar -zxvf nagios-plugins-1.4.16.tar.gz 
cd nagios-plus-1.4.16 
./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-gourp=nagios 
make&&make install
PS:当安装nagios-plugins-1.4.16时候报错如下:
ps/check_http.Tpo -c -o check_http.o check_http.c 
check_http.c: In function ‘process_arguments’: 
check_http.c:312: error: ‘ssl_version’ undeclared (first use in this function) 
check_http.c:312: error: (Each undeclared identifier is reported only once 
check_http.c:312: error: for each function it appears in.) 
make[2]: *** [check_http.o] Error 1 
make[2]: Leaving directory `/data/nagios-plugins-1.4.16/plugins' 
make[1]: *** [all-recursive] Error 1 
make[1]: Leaving directory `/data/nagios-plugins-1.4.16' 
make: *** [all] Error 2
解决办法:
12 1、yum -y install openssl openssl-devel 
2、重新configure
3、配置文件修改
[root@db3 etc]# pwd 
/usr/local/nagios/etc
[root@db3 etc]# tree 
. 
├── cgi.cfg ##需要修改 
├── htpasswd.users
├── nagios.cfg ##需要修改 
├── nagiosgraph.cfg 
├── objects 
│  ├── commands.cfg ##需要修改 
│  ├── contacts.cfg ##需要修改 
│  ├── localhost.cfg 
│  ├── printer.cfg 
│  ├── switch.cfg 
│  ├── templates.cfg ##需要修改 
│  ├── timeperiods.cfg 
│  └── windows.cfg 
└── resource.cfg
cgi.cfg内容如下:
[root@db3 etc]# cat cgi.cfg |grep -v "#" | awk "NF" 
main_config_file=/usr/local/nagios/etc/nagios.cfg 
physical_html_path=/usr/local/nagios/share
url_html_path=/nagios
show_context_help=0 
use_pending_states=1 
use_authentication=1 
use_ssl_authentication=0 
authorized_for_system_information=nagiosadmin,command
authorized_for_configuration_information=nagiosadmin,command
authorized_for_system_commands=nagiosadmin 
authorized_for_all_services=nagiosadmin 
authorized_for_all_hosts=nagiosadmin 
authorized_for_all_service_commands=nagiosadmin 
authorized_for_all_host_commands=nagiosadmin 
statusmap_background_image=zytianbk.png 
default_statusmap_layout=0 
default_statuswrl_layout=4 
ping_syntax=/bin/ping -n -U -c 5 $HOSTADDRESS$ 
refresh_rate=90 
escape_html_tags=1 
action_url_target=_blank 
notes_url_target=_blank 
lock_author_names=1 
ttf_file=/usr/local/nagios/sbin/simhei.ttf 
statusmap_mod=2
