成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

配置Nagios監控服務器(圖)

運維 系統運維
部署Nagios監控服務器:什么是Nagios呢? Linux下的系統監控Nagios是怎樣進行運行的呢?Nagios能夠運行在Linux/Unix平臺上,同時提供一個可選的基于WEB界面以方便系統管理人員查看網絡狀態,各種系統問題,以及日志等等。本文講述的是部署Nagios監控服務器。

  部署Nagios監控服務器:

  (一)下載所需軟件包

  1.nagios.3.2.0.tar.gz Nagios的主程序

  1.   [root@UnixHot src]# wget http://prdownloads.sourceforge.n ... nagios.3.2.0.tar.gz  
  2.  

  2.nagios-plugins-1.4.13.tar.gz Nagios 的插件

  1.   [root@UnixHot src]# wget http://prdownloads.sourceforge.n ... ugins-1.4.13.tar.gz  
  2.  

  3.nrpe-2.12.tar.gz 代理檢測程序

  1.   [root@UnixHot src]# wget http://prdownloads.sourceforge.n ... os/nrpe-2.12.tar.gz  
  2.  
  3.   [root@UnixHot src]# ls  
  4.  
  5.   nagios-3.2.0.tar.gz nagios-plugins-1.4.13.tar.gz nrpe-2.12.tar.gz  
  6.  

  (二)安裝Nagios

  官方的安裝文檔:http://nagios.sourceforge.net/docs/3_0/quickstart-fedora.html

  1.安裝前的依賴檢查

  1.   [root@UnixHot ~]# rpm -q httpd php gcc glibc glibc-common gd gd-devel  
  2.  

  2.創建Nagios賬戶和組

  1.   [root@UnixHot src]# useradd -m nagios  
  2.  
  3.   [root@UnixHot src]#groupadd nagcmd  
  4.  
  5.   [root@UnixHot src]# usermod -a -G nagcmd nagios  
  6.  
  7.   [root@UnixHot src]#usermod -a -G nagcmd apache  
  8.  

  3.編譯安裝

  1.   [root@UnixHot src]# tar xvf nagios-3.2.0.tar.gz  
  2.  
  3.   [root@UnixHot src]# cd nagios-3.2.0  
  4.  

  至于每一步的具體意思,我不再詳述,因為運行完畢后,提示信息會明確的告訴你,它干了什么,是怎么干的。當然,還有一個***的辦法,就是看Makefile文件,里面都會有注釋的。

  參考Makefile文件

  1.   [root@UnixHot nagios-3.2.0]# less Makefile  
  2.  
  3.   [root@UnixHot nagios-3.2.0]# ./configure --with-command-group=nagcmd \  
  4.  
  5.   --with-nagios-user=nagios \  
  6.  
  7.   --with-nagios-group=nagios  
  8.  
  9.   [root@UnixHot nagios-3.2.0]# make all  
  10.  
  11.   [root@UnixHot nagios-3.2.0]# make install  
  12.  
  13.   [root@UnixHot nagios-3.2.0]# make install-init (生成init啟動腳本)  
  14.  
  15.   [root@UnixHot nagios-3.2.0]# make install-config (生成一些模板配置文件)  
  16.  
  17.   [root@UnixHot nagios-3.2.0]# make install-commandmode (設置相應的權限)  
  18.  
  19.   [root@UnixHot nagios-3.2.0]# make install-webconf (生成Apache配置文件nagios.conf)  
  20.  

  4.為Nagios設置Web驗證的密碼

  (注意***次添加用戶用-c選項,以后再添加千萬別在用這個選項了,會覆蓋以前的所有用戶的,這個在RHCE考前沖刺我已經講了。)

  1.   [root@UnixHot nagios-3.2.0]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin  
  2.  

  5.設置Nagios的開機啟動

  1.   [root@UnixHot ~]# chkconfig --add nagios  
  2.  
  3.   [root@UnixHot ~]# chkconfig nagios on  
  4.  

  6.修改SELinux

  兩種方法:

  ***種最直接,關閉SELinux,對于SELinux不是很熟悉的用戶,請選擇此。

  1.   [root@UnixHot nagios-3.2.0]# cat /etc/sysconfig/selinux  
  2.  
  3.   SELINUX=disabled 
  4.  

  第二種給打上正確的安全脈絡。

  1.   chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/  
  2.  
  3.   chcon -R -t httpd_sys_content_t /usr/local/nagios/share/  
  4.  

  (三)安裝Nagios的插件nagios-plugin

  插件是Nagios擴展功能的強大武器,一般好的軟件,都支持插件擴展,你可以根據實際的應用,自己開發插件。

  1.   [root@UnixHot src]# tar xvf nagios-plugins-1.4.13.tar.gz  
  2.  
  3.   [root@UnixHot src]# cd nagios-plugins-1.4.13  
  4.  
  5.   [root@UnixHot nagios-plugins-1.4.13]# ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios  
  6.  
  7.   [root@UnixHot nagios-plugins-1.4.13]# make && make install  
  8.  

  (四)配置檢測主機是否存活

  1.配置文件概述

  如果安裝上面的步驟,安裝完成后,配置文件在安裝時放在了/usr/local/nagios/etc/目錄下

  1.   [root@UnixHot ~]# cd /usr/local/nagios/etc  
  2.  
  3.   [root@UnixHot etc]# ls -l  
  4.  
  5.   -rw-rw-r-- 1 nagios nagios 11408 08-30 11:55 cgi.cfg (CGI配置文件)  
  6.  
  7.   -rw-r--r-- 1 root root 26 08-30 11:56 htpasswd.users (Apache的驗證密碼文件)  
  8.  
  9.   -rw-rw-r-- 1 nagios nagios 43776 08-30 11:55 nagios.cfg (主配置文件)  
  10.  
  11.   drwxrwxr-x 2 nagios nagios 4096 08-30 11:55 objects (對象定義文件目錄)  
  12.  
  13.   -rw-rw---- 1 nagios nagios 1340 08-30 11:55 resource.cfg (資源配置文件)  
  14.  

  我們修要修改的的是nagios.cfg 和 objects 目錄下的文件,來檢測主機是否存活。

  2.主配置文件nagios.cfg的配置

  主配置文件的內容很多,對于這個版本,我們需要修改和添加的主要是對象配置文件,即:cfg_file=

  1.   cfg_file=/usr/local/nagios/etc/objects/commands.cfg (命令定義文件)  
  2.  
  3.   cfg_file=/usr/local/nagios/etc/objects/contacts.cfg (聯系人信息定義文件)  
  4.  
  5.   cfg_file=/usr/local/nagios/etc/objects/contactgroups.cfg (添加此行聯系人組定義文件)  
  6.  
  7.   cfg_file=/usr/local/nagios/etc/objects/hosts.cfg (添加此行 主機定義文件)  
  8.  
  9.   cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg (添加此行 主機組定義文件)  
  10.  
  11.   cfg_file=/usr/local/nagios/etc/objects/services.cfg (添加此行 服務定義文件)  
  12.  
  13.   cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg (時間周期定義文件)  
  14.  
  15.   cfg_file=/usr/local/nagios/etc/objects/templates.cfg  
  16.  
  17.   # Definitions for monitoring the local (Linux) host  
  18.  
  19.   #cfg_file=/usr/local/nagios/etc/objects/localhost.cfg (注釋掉此行)  
  20.  

  3.主機定義文件的配置

  1.   [root@UnixHot etc]# vi objects/hosts.cfg  
  2.  
  3.   define host{  
  4.  
  5.   host_name Nagios-Server  
  6.  
  7.   alias Nagios Server  
  8.  
  9.   address 192.168.0.206  
  10.  
  11.   check_command check-host-alive  
  12.  
  13.   check_interval 5  
  14.  
  15.   retry_interval 1  
  16.  
  17.   max_check_attempts 5  
  18.  
  19.   check_period 24x7  
  20.  
  21.   process_perf_data 0  
  22.  
  23.   retain_nonstatus_information 0  
  24.  
  25.   contact_groups sagroup  
  26.  
  27.   notification_interval 30  
  28.  
  29.   notification_period 24x7  
  30.  
  31.   notification_options d,u,r  
  32.  
  33.   }  
  34.  
  35.   define host{  
  36.  
  37.   host_name Java-Server  
  38.  
  39.   alias Java Server  
  40.  
  41.   address 192.168.0.157  
  42.  
  43.   check_command check-host-alive  
  44.  
  45.   check_interval 5  
  46.  
  47.   retry_interval 1  
  48.  
  49.   max_check_attempts 5  
  50.  
  51.   check_period 24x7  
  52.  
  53.   process_perf_data 0  
  54.  
  55.   retain_nonstatus_information 0  
  56.  
  57.   contact_groups sagroup  
  58.  
  59.   notification_interval 30  
  60.  
  61.   notification_period 24x7  
  62.  
  63.   notification_options d,u,r  
  64.  
  65.   }  
  66.  
  67.   define host{  
  68.  
  69.   host_name Oracle-Server  
  70.  
  71.   alias Oracle Server  
  72.  
  73.   address 192.168.0.155  
  74.  
  75.   check_command check-host-alive  
  76.  
  77.   check_interval 5  
  78.  
  79.   retry_interval 1  
  80.  
  81.   max_check_attempts 5  
  82.  
  83.   check_period 24x7  
  84.  
  85.   process_perf_data 0  
  86.  
  87.   retain_nonstatus_information 0  
  88.  
  89.   contact_groups sagroup  
  90.  
  91.   notification_interval 30  
  92.  
  93.   notification_period 24x7  
  94.  
  95.   notification_options d,u,r  
  96.  
  97.   }  
  98.  
  99.   define host{  
  100.  
  101.   host_name MySQL-Server  
  102.  
  103.   alias MySQL Server  
  104.  
  105.   address 192.168.0.100  
  106.  
  107.   check_command check-host-alive  
  108.  
  109.   check_interval 5  
  110.  
  111.   retry_interval 1  
  112.  
  113.   max_check_attempts 5  
  114.  
  115.   check_period 24x7  
  116.  
  117.   process_perf_data 0  
  118.  
  119.   retain_nonstatus_information 0  
  120.  
  121.   contact_groups sagroup  
  122.  
  123.   notification_interval 30  
  124.  
  125.   notification_period 24x7  
  126.  
  127.   notification_options d,u,r  
  128.  
  129.   }  
  130.  

  4.主機組定義文件的配置

  1.   [root@UnixHot etc]# vi objects/hostgroups.cfg  
  2.  
  3.   define hostgroup {  
  4.  
  5.   hostgroup_name System-Admin  
  6.  
  7.   alias system Admin  
  8.  
  9.   members Nagios-Server,Oracle-Server,Java-Server,MySQL-Server  
  10.  
  11.   }  
  12.  

  5.服務定義文件的配置

  1.   [root@UnixHot etc]# vi objects/services.cfg  
  2.  
  3.   define service {  
  4.  
  5.   host_name Nagios-Server  
  6.  
  7.   service_description check-host-alive  
  8.  
  9.   check_period 24x7  
  10.  
  11.   max_check_attempts 4  
  12.  
  13.   normal_check_interval 3  
  14.  
  15.   retry_check_interval 2  
  16.  
  17.   contact_groups sagroup  
  18.  
  19.   notification_interval 10  
  20.  
  21.   notification_period 24x7  
  22.  
  23.   notification_options w,u,c,r  
  24.  
  25.   check_command check-host-alive  
  26.  
  27.   }  
  28.  
  29.   define service {  
  30.  
  31.   host_name Oracle-Server  
  32.  
  33.   service_description check-host-alive  
  34.  
  35.   check_period 24x7  
  36.  
  37.   max_check_attempts 4  
  38.  
  39.   normal_check_interval 3  
  40.  
  41.   retry_check_interval 2  
  42.  
  43.   contact_groups sagroup  
  44.  
  45.   notification_interval 10  
  46.  
  47.   notification_period 24x7  
  48.  
  49.   notification_options w,u,c,r  
  50.  
  51.   check_command check-host-alive  
  52.  
  53.   }  
  54.  
  55.   define service {  
  56.  
  57.   host_name Java-Server  
  58.  
  59.   service_description check-host-alive  
  60.  
  61.   check_period 24x7  
  62.  
  63.   max_check_attempts 4  
  64.  
  65.   normal_check_interval 3  
  66.  
  67.   retry_check_interval 2  
  68.  
  69.   contact_groups sagroup  
  70.  
  71.   notification_interval 10  
  72.  
  73.   notification_period 24x7  
  74.  
  75.   notification_options w,u,c,r  
  76.  
  77.   check_command check-host-alive  
  78.  
  79.   }  
  80.  
  81.   define service {  
  82.  
  83.   host_name MySQL-Server  
  84.  
  85.   service_description check-host-alive  
  86.  
  87.   check_period 24x7  
  88.  
  89.   max_check_attempts 4  
  90.  
  91.   normal_check_interval 3  
  92.  
  93.   retry_check_interval 2  
  94.  
  95.   contact_groups sagroup  
  96.  
  97.   notification_interval 10  
  98.  
  99.   notification_period 24x7  
  100.  
  101.   notification_options w,u,c,r  
  102.  
  103.   check_command check-host-alive  
  104.  
  105.   }  
  106.  

  6.聯系組定義文件配置

  1.   [root@UnixHot etc]# vi objects/contactgroups.cfg  
  2.  
  3.   define contactgroup {  
  4.  
  5.   contactgroup_name sagroup  
  6.  
  7.   alias system administrator group  
  8.  
  9.   members nagiosadmin  
  10.  
  11.   }  
  12.  

  7.修改目錄的所有者

  1.   [root@UnixHot etc]# chown -R nagios:nagios objects/  
  2.  

  8.檢測配置文件是否正確

  1.   [root@UnixHot etc]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg  
  2.  
  3.   Total Warnings: 0  
  4.  
  5.   Total Errors: 0  
  6.  

  如果都是0說明配置成功了,如果有錯誤,好好檢查一下。

  9.啟動Nagios服務

  1.   [root@UnixHot etc]# /etc/init.d/httpd restart  
  2.  
  3.   [root@UnixHot etc]# /etc/init.d/nagios start  
  4.  

  (五)***部分功能測試

  在瀏覽器輸入網址:http://192.168.0.206/nagios/

  

 

  ***部分的功能已經實現了,就是簡單的監控四臺服務器是否存活,當然,對于系統監控來說,這是遠遠不夠的。配置Nagios監控服務器OK

【編輯推薦】

Ubuntu安裝運行Nagios

運維監控Nagios

驗證Nagios的工作狀態(圖)

責任編輯:zhaolei 來源: deepin
相關推薦

2011-03-23 15:13:08

Nagios監控Oracle

2011-03-25 14:40:33

Nagios監控

2011-03-23 10:17:26

2011-03-21 14:53:27

Nagios監控Linux

2011-04-06 14:24:21

Nagios監控Linux

2011-03-22 15:17:14

Nagios安裝

2011-03-22 09:07:13

Nagios監控Linux

2011-03-23 13:29:46

Debian安裝Nagios

2011-03-23 15:13:08

Nagios監控oracle

2011-03-25 15:24:40

Nagios監控

2011-08-22 12:25:08

nagios

2011-04-06 15:05:56

nagios監控Linux

2011-03-28 16:37:38

2011-03-24 10:59:10

Nagios監控mysql

2011-08-22 11:33:48

nagios

2011-04-06 14:24:28

nagios監控Linux

2011-03-23 12:44:06

Nagios監控

2011-03-22 15:17:14

Nagios安裝

2011-08-22 11:00:17

nagios

2011-03-22 15:17:13

Nagios監控
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 日日夜夜精品视频 | 在线观看国产精品一区二区 | 国产三级网站 | 日本不卡一区二区三区 | 麻豆av网| 最新超碰| 亚洲成人综合网站 | 国产免费看 | 欧洲免费视频 | 亚洲高清在线观看 | 黄色在线免费看 | 国产一区二区影院 | 精品视频在线播放 | 亚洲日韩第一页 | 伊人久久在线 | 性xxxxx| 国产成人精品一区二区三区 | 国产综合久久 | 一区视频在线免费观看 | 伊人焦久影院 | 日韩国产免费观看 | 欧美v日韩| 国产精品久久久久久久久久免费 | 日韩在线国产 | 成人免费精品视频 | 在线日韩精品视频 | 亚洲国产精品一区二区三区 | 欧美日韩综合 | 欧美日日 | 午夜视频免费在线观看 | 日韩中文字幕视频 | jdav视频在线观看免费 | 欧美精品成人 | 国产高清精品一区二区三区 | 久久久青草婷婷精品综合日韩 | 欧美国产日韩一区二区三区 | 亚洲欧洲视频 | 亚洲一区二区久久 | 欧美日韩精品综合 | 国产在线精品一区二区 | 男女激情网|