Nagios 監控軟體

2021-09-01 10:51:02 字數 3348 閱讀 4838

過程如下:

——解壓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 #make install #make install-init #make install-config #make install-commandmode

——安裝web介面,介面將會安裝到 /usr/local/nagios/share ( http 配置檔案預設新增到 /etc/httpd/conf.d/nagios.conf,如果沒有則執行:

——建立http認證使用者登入nagios,使用者名稱nagiosadmin,密碼123456

#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

——重啟apache

——安裝nagios外掛程式

#tar -zvxf nagios-plugins-1.4.14.tar.gz

#cd nagios-plugins-1.4.14

#./configure --with-nagios-user=nagios --with-nagios-group=nagios #make && make install

——配置nagios管理員接受告警資訊的郵箱,寫入管理員郵箱 #vim /usr/local/nagios/etc/objects/contacts.cfg email [email protected] ; ——校驗nagios配置檔案,驗證配置是否有誤 #/usr/local/nagios/bin/nagios -v

——啟動nagios,配置在系統啟動時執行nagios

——執行nagion

#service nagios start

四、登陸到web介面

輸入使用者名稱密碼:nagiosadmin 123456,http://localhost/nagios/

=search&itemid=74&searchword=postfix

#!/bin/bash

##check_postque -w 10 -c 30 -w 1000000 -c 3000000 -p postfix"

#state_ok=0

state_warning=1

state_critical=2

state_unknown=3

exitstatus=3

#接受10個引數

if [ "$#" == "10" ]; then

arg=$

w=$2

c=$4

w=$6

c=$8

mail_empty="mail queue is empty"

mails=`postqueue -c /etc/$arg -p`

# if ; then

if [ "$mails" == "$mail_empty" ]; then

exitstatus=$state_ok

echo "ok : $mail_empty"

else

crt=`postqueue -c /etc/$arg -p | grep kbytes | sed -e 's/^.*--.//g' | awk ''`

msg=`postqueue -c /etc/$arg -p | grep kbytes | sed -e 's/^.*--.//g' | awk ''`

if [ $msg -gt $c -o $crt -gt $c ]; then

exitstatus=$state_critical

echo "critical : queue has $ messages in $ kbytes, higher then critical limit."

elif [ $msg -gt $w -o $crt -gt $w ] ; then

exitstatus=$state_warning

echo "warning : queue has $msg messages in $crt kbytes, higher then warning limit."

else

exitstatus=$state_ok

echo "ok : mail queue has $msg messages in $crt kbytes."

fifi

# else

# exitstatus=$state_critical

# echo "critical : mail system is down "

# fi

else

echo " "

echo "please provide parameters to work with."

echo "help : ./check_postque -w 10 -c 30 -w 1000000 -c 3000000 -p postfix"

echo "where :"

echo " -w = request warning limit"

echo " -c = request critical limit"

echo " -w = message size warning limit"

echo " -c = message size critical limit"

echo " -p = postfix instance name"

echo " "

fi

exit $exitstatus

接著修改郵件伺服器的nrpe.cfg檔案,增加如下command監控:

-c 5000000 -p postfix

#佇列數大於50告警,100嚴重告警。郵件大小總計300m告警,郵件大小總計500m嚴重告警

define command

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...

監控軟體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 簡介 是乙個開源軟體,可以監控網路裝置網路流量 linux windows主機狀態,甚至可以監控印表機 它可以執行在linux上或windows上 基於瀏覽器的web介面方便運維人員檢視監控專案的狀態 支援web介面配置 管理操作 支援簡訊 郵件通知 可以自定義指令碼實現自定義化監控 ...