CentOS 64安装Nagios_第1页
CentOS 64安装Nagios_第2页
CentOS 64安装Nagios_第3页
CentOS 64安装Nagios_第4页
CentOS 64安装Nagios_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、CentOS 6.4安装Nagios(中文版)一、安装1、基础环境安装(系统最小安装)yum install gcc glibc glibc-common gd gd-devel httpd推荐阅读:Nagios服务和性能监控 CentOS 6.2 使用Nagios nrpe监控本地与远程Linux主机 Nagios监控 CentOS 6.2安装配置Nagios Server CentOS 安装配置Nagios 监控服务器 RHEL下安装配置Nagios与Cacti服务 Nagios 的详细介绍:请点这里Nagios 的下载地址:请点这里2、 nagios和 nagios-plus的安装/us

2、r/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/includemake

3、all make installmake 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.userstar -zxvf nagios-plugins-1.4.16.tar.gz cd nagios-plus-1.4.16 ./co

4、nfigure -prefix=/usr/local/nagios -with-nagios-user=nagios -with-nagios-gourp=nagios make&&make installPS:当安装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 i

5、n 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.) make2: * check_http.o Error 1 make2: Leaving directory /data/nagios-plugins-1.4.16/plugins' make1: * all-recursive Error 1 make1: Leaving directo

6、ry /data/nagios-plugins-1.4.16' make: * all Error 2解决办法:12 1、yum -y install openssl openssl-devel 2、重新configure3、配置文件修改rootdb3 etc# pwd /usr/local/nagios/etcrootdb3 etc# tree . cgi.cfg #需要修改 htpasswd.users nagios.cfg #需要修改 nagiosgraph.cfg objects commands.cfg #需要修改 contacts.cfg #需要修改 localhost.c

7、fg printer.cfg switch.cfg templates.cfg #需要修改 timeperiods.cfg windows.cfg resource.cfgcgi.cfg内容如下:rootdb3 etc# cat cgi.cfg |grep -v "#" | awk "NF" main_config_file=/usr/local/nagios/etc/nagios.cfg physical_html_path=/usr/local/nagios/shareurl_html_path=/nagiosshow_context_help=0

8、use_pending_states=1 use_authentication=1 use_ssl_authentication=0 authorized_for_system_information=nagiosadmin,commandauthorized_for_configuration_information=nagiosadmin,commandauthorized_for_system_commands=nagiosadmin authorized_for_all_services=nagiosadmin authorized_for_all_hosts=nagiosadmin

9、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_

10、url_target=_blank lock_author_names=1 ttf_file=/usr/local/nagios/sbin/simhei.ttf statusmap_mod=2 nagios.cfg内容如下:rootyw_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=/us

11、r/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/cfgobject_cache_file=/usr/local/nagios/var/objects.cache precached_object_file=/usr/local/nagios/var/objects.preca

12、che 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 l

13、ock_file=/usr/local/nagios/var/nagios.lock temp_file=/usr/local/nagios/var/nagios.tmp temp_path=/tmpevent_broker_options=-1 log_rotation_method=d log_archive_path=/usr/local/nagios/var/archivesuse_syslog=1 log_notifications=1 log_service_retries=1 log_host_retries=1 log_event_handlers=1 log_initial_

14、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_res

15、ult_path=/usr/local/nagios/var/spool/checkresultsmax_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_i

16、nterval=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 u

17、se_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_lengt

18、h=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

19、 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_s

20、ervice_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_out

21、put_chars=$&|'"<> use_regexp_matching=0 use_true_regexp_matching=0 admin_email=nagioslocalhost admin_pager=pagenagioslocalhost 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.de

22、bug max_debug_file_size=1000000commands.cfg的内容如下:rootyw_monitor_db objects# cat commands.cfg |grep -v "#" | awk "NF" define command command_name notify-host-by-email command_line /usr/bin/printf "%b" "* Nagios *nnNotification Type: $NOTIFICATIONTYPE$nHost: $HOSTNAM

23、E$nState: $HOSTSTATE$nAddress: $HOSTADDRESS$nInfo: $HOSTOUTPUT$nnDate/Time: $LONGDATETIME$n" | /bin/mail -s "* $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ *" $CONTACTEMAIL$ define command command_name notify-service-by-email command_line /usr/bin/printf "Host: $HOSTA

24、LIAS$nService: $SERVICEDESC$nAddress: $HOSTADDRESS$nState: $SERVICESTATE$nDate/Time: $LONGDATETIME$nInfo:$SERVICEOUTPUT$n持续时间:$SERVICEDURATION$" | mail -s " $HOSTALIAS$ $SERVICESTATE$" $CONTACTEMAIL$ define command command_name notify-service-by-email-163 command_line /usr/bin/printf

25、"Host: $HOSTALIAS$nService: $SERVICEDESC$nAddress: $HOSTADDRESS$nState: $SERVICESTATE$nDate/Time: $LONGDATETIME$nInfo:$SERVICEOUTPUT$n持续时间:$SERVICEDURATION$" | mail -s " $HOSTALIAS$ $SERVICESTATE$" $CONTACTEMAIL$ define command command_name notify-service-by-email-164 command_lin

26、e /usr/local/nagios/bin/send_message.sh $CONTACTEMAIL$ $_SERVICETYPE$ $HOSTALIAS$-$SERVICEDESC$ info:$SERVICEOUTPUT$ Duration:$SERVICEDURATION$ define command command_name check_mysql command_line $USER1$/check_mysql -H $HOSTADDRESS$ -u nagios -d nagios -p 123456 define command command_name check_my

27、sql_slave command_line $USER1$/check_mysql -H $HOSTADDRESS$ -P13267 -S -uroot -p123456 -s /data/mysql/nagios/logs/mysql.sock define command command_name check-host-alive command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5 define command command_name check_local_disk co

28、mmand_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$ define command command_name check_local_load command_line $USER1$/check_load -w $ARG1$ -c $ARG2$ define command command_name check_local_procs command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$ define command command_name check_

29、local_users command_line $USER1$/check_users -w $ARG1$ -c $ARG2$ define command command_name check_local_swap command_line $USER1$/check_swap -w $ARG1$ -c $ARG2$ define command command_name check_local_mrtgtraf command_line $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$ def

30、ine command command_name check_ftp command_line $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$ define command command_name check_hpjd command_line $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$ define command command_name check_snmp command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$ define command comma

31、nd_name check_http command_line $USER1$/check_http -H $HOSTADDRESS$ $ARG1$ define command command_name check_ssh command_line $USER1$/check_ssh $ARG1$ $HOSTADDRESS$ define command command_name check_dhcp command_line $USER1$/check_dhcp $ARG1$ define command command_name check_ping command_line $USER

32、1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5 define command command_name check_pop command_line $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$ define command command_name check_imap command_line $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$ define command command_name check_smtp command_line $USE

33、R1$/check_smtp -H $HOSTADDRESS$ $ARG1$ define command command_name check_tcp command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$ define command command_name check_udp command_line $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$ define command command_name check_nt command_line $USER

34、1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$ define command command_name check_dig command_line $USER1$/check_dig -H $HOSTADDRESS$ -T $ARG4$ -l $ARG1$ -w $ARG2$ -c $ARG3$ define command command_name process-host-perfdata command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$t$HO

35、STNAME$t$HOSTSTATE$t$HOSTATTEMPT$t$HOSTSTATETYPE$t$HOSTEXECUTIONTIME$t$HOSTOUTPUT$t$HOSTPERFDATA$n" >> /usr/local/nagios/var/host-perfdata.out define command command_name process-service-perfdata command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$t$HOSTNAME$t$SERVICEDESC$

36、t$SERVICESTATE$t$SERVICEATTEMPT$t$SERVICESTATETYPE$t$SERVICEEXECUTIONTIME$t$SERVICELATENCY$t$SERVICEOUTPUT$t$SERVICEPERFDATA$n" >> /usr/local/nagios/var/service-perfdata.out define command command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ contacts.cfg的内容如下

37、:123456789101112131415161718 rootyw_monitor_db objects# cat contacts.cfg |grep -v "#" | awk "NF" define contact use generic-contact-163 contact_name zhaohaijun-mail alias zhaohaijun-mail email navyaijm define contact use generic-contact-164 contact_name navyaijm-call alias navyai

38、jm-call emaildefine contactgroup contactgroup_name ops_admin alias ops_admin members navyaijm-call,navyaijm-mail templates.cfg的内容如下:rootyw_monitor_db objects# cat templates.cfg |grep -v "#" | awk "NF" define contact name generic-contact ; The name of this contact tem

39、plate service_notification_period 24x7 ; service notifications can be sent anytime host_notification_period 24x7 ; host notifications can be sent anytime service_notification_options w,u,c,r,f,s ; send notifications for all service states, flapping events, and scheduled downtime events host_notifica

40、tion_options d,u,r,f,s ; send notifications for all host states, flapping events, and scheduled downtime events service_notification_commands notify-service-by-email ; send service notifications via email host_notification_commands notify-host-by-email ; send host notifications via email register 0

41、; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE! define contact name generic-contact-163 ; The name of this contact template service_notification_period 24x7 ; service notifications can be sent anytime host_notification_period 24x7 ; host notifications can be sent anytime s

42、ervice_notification_options w,u,c,r,f,s ; send notifications for all service states, flapping events, and scheduled downtime events host_notification_options d,u,r,f,s ; send notifications for all host states, flapping events, and scheduled downtime events service_notification_commands notify-servic

43、e-by-email-163 ; send service notifications via email host_notification_commands notify-host-by-email ; send host notifications via email register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE! define contact name generic-contact-164 ; The name of this contact template

44、service_notification_period 24x7 ; service notifications can be sent anytime host_notification_period 24x7 ; host notifications can be sent anytime service_notification_options w,u,c,r,f,s ; send notifications for all service states, flapping events, and scheduled downtime events host_notification_o

45、ptions d,u,r,f,s ; send notifications for all host states, flapping events, and scheduled downtime events service_notification_commands notify-service-by-email-164 ; send service notifications via email host_notification_commands notify-host-by-email ; send host notifications via email register 0 ;

46、DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE! define host name generic-host ; The name of this host template notifications_enabled 1 ; Host notifications are enabled event_handler_enabled 1 ; Host event handler is enabled flap_detection_enabled 1 ; Flap detection is enable

47、d failure_prediction_enabled 1 ; Failure prediction is enabled process_perf_data 1 ; Process performance data retain_status_information 1 ; Retain status information across program restarts retain_nonstatus_information 1 ; Retain non-status information across program restarts notification_period 24x

48、7 ; Send host notifications at any timeregister 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE! define host name linux-server ; The name of this host template use generic-host ; This template inherits other values from the generic-host template check_period 24x7 ; By defaul

49、t, Linux hosts are checked round the clock check_interval 5 ; Actively check the host every 5 minutes retry_interval 1 ; Schedule host check retries at 1 minute intervals active_checks_enabled 0 max_check_attempts 10 ; Check each Linux host 10 times (max) check_command check-host-alive ; Default com

50、mand to check Linux hosts notification_period workhours ; Linux ops_admin hate to be woken up, so we only notify during the day ; Note that the notification_period variable is being overridden from ; the value that is inherited from the generic-host template! notification_interval 120 ; Resend notifications every 2 hours notification_options d,u,r ; Only send notifications for specific host states contact_groups ops_admin ; Notifications get sent to the ops_admin by default register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A RE

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论