手机版
你好,游客 登录 注册
背景:
阅读新闻

CentOS 6.4安装Nagios(中文版)

[日期:2013-08-08] 来源:Linux社区  作者:navyaijm [字体:大 中 小]

一、安装
1、基础环境安装(系统最小安装)
yum install gcc glibc glibc-common gd gd-devel httpd

推荐阅读:

Nagios—服务和性能监控 http://www.linuxidc.com/Linux/2013-07/88085.htm

CentOS 6.2 使用Nagios nrpe监控本地与远程Linux主机 http://www.linuxidc.com/Linux/2013-05/84776.htm

[Nagios监控] CentOS 6.2安装配置Nagios Server  http://www.linuxidc.com/Linux/2013-03/80812.htm

CentOS 安装配置Nagios 监控服务器 http://www.linuxidc.com/Linux/2013-01/78342.htm

RHEL下安装配置Nagios与Cacti服务 http://www.linuxidc.com/Linux/2013-01/77363.htm

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

 
nagios.cfg内容如下:
[root@yw_monitor_db etc]# cat nagios.cfg |grep -v "#" | awk "NF"
log_file=/usr/local/nagios/var/nagios.log
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_dir=/usr/local/nagios/etc/objects/cfg
object_cache_file=/usr/local/nagios/var/objects.cache
precached_object_file=/usr/local/nagios/var/objects.precache
resource_file=/usr/local/nagios/etc/resource.cfg
status_file=/usr/local/nagios/var/status.dat
status_update_interval=10
nagios_user=nagios
nagios_group=nagios
check_external_commands=1
command_check_interval=-1
command_file=/usr/local/nagios/var/rw/nagios.cmd
external_command_buffer_slots=4096
lock_file=/usr/local/nagios/var/nagios.lock
temp_file=/usr/local/nagios/var/nagios.tmp
temp_path=/tmp
event_broker_options=-1
log_rotation_method=d
log_archive_path=/usr/local/nagios/var/archives
use_syslog=1
log_notifications=1
log_service_retries=1
log_host_retries=1
log_event_handlers=1
log_initial_states=0
log_external_commands=1
log_passive_checks=1
service_inter_check_delay_method=s
max_service_check_spread=30
service_interleave_factor=s
host_inter_check_delay_method=s
max_host_check_spread=30
max_concurrent_checks=0
check_result_reaper_frequency=10
max_check_result_reaper_time=30
check_result_path=/usr/local/nagios/var/spool/checkresults
max_check_result_file_age=3600
cached_host_check_horizon=15
cached_service_check_horizon=15
enable_predictive_host_dependency_checks=1
enable_predictive_service_dependency_checks=1
soft_state_dependencies=0
auto_reschedule_checks=0
auto_rescheduling_interval=30
auto_rescheduling_window=180
sleep_time=0.25
service_check_timeout=60
host_check_timeout=30
event_handler_timeout=30
notification_timeout=30
ocsp_timeout=5
perfdata_timeout=5
retain_state_information=1
state_retention_file=/usr/local/nagios/var/retention.dat
retention_update_interval=60
use_retained_program_state=1
use_retained_scheduling_info=1
retained_host_attribute_mask=0
retained_service_attribute_mask=0
retained_process_host_attribute_mask=0
retained_process_service_attribute_mask=0
retained_contact_host_attribute_mask=0
retained_contact_service_attribute_mask=0
interval_length=60
check_for_updates=1
bare_update_check=0
use_aggressive_host_checking=0
execute_service_checks=1
accept_passive_service_checks=1
execute_host_checks=1
accept_passive_host_checks=1
enable_notifications=1
enable_event_handlers=1
process_performance_data=0
obsess_over_services=0
obsess_over_hosts=0
translate_passive_host_checks=0
passive_host_checks_are_soft=0
check_for_orphaned_services=1
check_for_orphaned_hosts=1
check_service_freshness=1
service_freshness_check_interval=60
check_host_freshness=0
host_freshness_check_interval=60
additional_freshness_latency=15
enable_flap_detection=1
low_service_flap_threshold=5.0
high_service_flap_threshold=20.0
low_host_flap_threshold=5.0
high_host_flap_threshold=20.0
date_format=us
p1_file=/usr/local/nagios/bin/p1.pl
enable_embedded_perl=1
use_embedded_perl_implicitly=1
illegal_object_name_chars=`~!$%^&*|'"<>?,()=
illegal_macro_output_chars=`~$&|'"<>
use_regexp_matching=0
use_true_regexp_matching=0
admin_email=nagios@localhost
admin_pager=pagenagios@localhost
daemon_dumps_core=0
use_large_installation_tweaks=0
enable_environment_macros=1
debug_level=0
debug_verbosity=1
debug_file=/usr/local/nagios/var/nagios.debug
max_debug_file_size=1000000

接下来请看第二页: http://www.linuxidc.com/Linux/2013-08/88419p2.htm

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款