監控軟體nagios之配置檔案詳解

2021-09-21 09:55:49 字數 3433 閱讀 4818

1.nagios根目錄

[root@tong1 nagios-4.0.8]# ll

total 28

drwxrwxr-x.  2 nagios nagios 4096 apr  1 14:50 bin    --二進位制檔案

drwxrwxr-x.  3 nagios nagios 4096 apr  1 15:27 etc   --配置檔案

drwxr-xr-x.  2 root   root   4096 apr  1 15:23 include   --包含檔案

drwxrwxr-x.  2 nagios nagios 4096 apr  1 15:23 libexec     --外掛程式檔案

drwxrwxr-x.  2 nagios nagios 4096 apr  1 15:03 sbin  --cgi檔案

drwxrwxr-x. 11 nagios nagios 4096 apr  1 15:23 share   --網頁檔案和文件

drwxrwxr-x.  5 nagios nagios 4096 apr  1 15:34 var    --鎖檔案和日誌檔案

[root@tong1 nagios-4.0.8]#

2.templates.cfg配置檔案(定義監控中重複的引數)

[root@tong1 nagios-4.0.8]# cd etc/

[root@tong1 etc]# ll

total 68

-rw-rw-r--. 1 nagios nagios 12027 apr  1 14:53 cgi.cfg     --cgi配置檔案

-rw-r--r--. 1  nagios ngios      19 apr   1 14:52 htpasswd    --認證檔案 

-rw-rw-r--. 1 nagios nagios 44637 apr  1 14:50 nagios.cfg    --主配置檔案

drwxrwxr-x. 2 nagios nagios  4096 apr  1 15:27 objects      --主機定義檔案

-rw-rw----. 1 nagios nagios  1324 apr  1 14:50 resource.cfg    --資源管理檔案

[root@tong1 etc]# ll objects/

total 48

-rw-rw-r--. 1 nagios nagios  7700 apr  1 14:50 commands.cfg     --定義命令檔案

-rw-rw-r--. 1 nagios nagios  2138 apr  1 14:50 contacts.cfg   --定義聯絡人和聯絡人組

-rw-rw-r--. 1 nagios nagios  5375 apr  1 14:50 localhost.cfg  --本地主機的監控檔案

-rw-rw-r--. 1 nagios nagios  3096 apr  1 14:50 printer.cfg     --監控列印檔案模板

-rw-rw-r--. 1 nagios nagios  3265 apr  1 14:50 switch.cfg     --監控交換機檔案模板

-rw-rw-r--. 1 nagios nagios 10621 apr  1 14:50 templates.cfg   --作為資源引用檔案

-rw-rw-r--. 1 nagios nagios  3180 apr  1 14:50 timeperiods.cfg    --定義監控時間段

-rw-rw-r--. 1 nagios nagios  3991 apr  1 14:50 windows.cfg   --監控windows主機模板[root@tong1 etc]# cd objects/

[root@tong1 objects]# vim templates.cfg     --此檔案是固定的,是所有檔案中的相同配置(定義後可以不在其它配置檔案中定義了)

define contact

define host

define host

define host

define host

define host

define service

3.resource.cfg配置檔案(變數定義檔案)

[root@tong1 objects]# vim ../resource.cfg

$user1$=/usr/local/nagios-4.0.8/libexec    --外掛程式的路徑

4.commands.cfg配置檔案(加入新的監控命令)

[root@tong1 objects]# vim commands.cfg

define command

5.host.cfg配置檔案(預設不存在,被監控主機位址和資訊)

[root@tong1 objects]# vim host.cfg

define host      

#定義乙個主機組  

define hostgroup  

6.services.cfg配置檔案(預設不存在,主要定義主機資源和服務)

[root@tong1 objects]# vim services.cfg

define service  

7.contacts.cfg配置檔案(定義聯絡人和聯絡組)

[root@tong1 objects]# vim contacts.cfg

define contact 

define contactgroup

8.timeperiods.cfg配置檔案(定義監控時間段)

[root@tong1 objects]# vim timeperiods.cfg

define timeperiod

# 'workhours' timeperiod definition

define timeperiod

9.nagios.cfg配置檔案(核心配置檔案,所有的配置檔案必須要在這個配置檔案中引用進來)

[root@tong1 objects]# vim ../nagios.cfg

cfg_file=/usr/local/nagios-4.0.8/etc/objects/commands.cfg

cfg_file=/usr/local/nagios-4.0.8/etc/objects/contacts.cfg

cfg_file=/usr/local/nagios-4.0.8/etc/objects/timeperiods.cfg

cfg_file=/usr/local/nagios-4.0.8/etc/objects/templates.cfg

10.檢查配置檔案是否有異常

[root@tong1 objects]# /usr/local/nagios-4.0.8/bin/nagios -v /usr/local/nagios-4.0.8/etc/objects/localhost.cfg

監控軟體nagios之安裝

1.安裝軟體依賴包和建立nagios使用者 root tong1 yum install gcc gcc c make y root tong1 groupadd g 500 nagios root tong1 useradd r u 500 s sbin nologin g nagios nagi...

Nagios 監控軟體

過程如下 解壓nagios tar zvxf nagios 3.2.1.tar.gz cd nagios 3.2.1 編譯 configure with command group nagcmd make all 安裝nagios,初始化指令碼及配置檔案,nagios將會被安裝至 usr local...

Nagios 監控軟體安裝

一,軟體安裝 ll rwxrwxr x 1 root root 9097591 2009 12 31 nagios 20091231.tar.bz2 1 解壓軟體包 tar jxvf nagios 20091231.tar.bz2 2.安裝 soft monitoring nagios nagios...