1.解決時間同步問題
成都創(chuàng)新互聯公司一直通過網站建設和網站營銷幫助企業(yè)獲得更多客戶資源。 以"深度挖掘,量身打造,注重實效"的一站式服務,以成都做網站、成都網站制作、移動互聯產品、成都營銷網站建設服務為核心業(yè)務。十多年網站制作的經驗,使用新網站建設技術,全新開發(fā)出的標準網站,不但價格便宜而且實用、靈活,特別適合中小公司網站制作。網站管理系統簡單易用,維護方便,您可以完全操作網站資料,是中小公司快速網站建設的選擇。
uptime
2.安裝Nagios所需要的基礎包
yum -y install openssl-devel
3.創(chuàng)建nagios 用戶
useradd nagios
4.下載安裝最新nagios插件
wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
tar zxvf nagios-plugins-1.5.tar.gz
cd nagios-plugins-1.5
./configure--with-nagios-user=nagios--with-nagios-group=nagios
make && make install
5.更改目錄權限:
chown nagios.nagios /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/libexec
6.安裝nrpe插件
wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz/download
tar zxvf nrpe-2.15.tar.gz
cd nrpe-2.15
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
7.將NRPE deamon作為xinetd 下的一個服務運行
yum -y install xinetd
make install-xinetd
顯示如下
可以看到創(chuàng)建了這個文件/etc/xinetd.d/nrpe,編輯這個腳本:
vim /etc/xinetd.d/nrpe
8.編輯/etc/services這個文件,添加nrpe服務
vim /etc/services
在最后添加如下:
#Local services
nrpe 5666/tcp #nrpe
重啟xinetd的服務:
service xinetd restart
查看nrpe是否已經啟動:
[root@wordpress nrpe-2.15]# netstat -at |grep nrpe
tcp 0 0 *:nrpe *:* LISTEN
[root@wordpress nrpe-2.15]# netstat -an |grep 5666
tcp 0 0 :::5666 :::* LIST
查看nrpe 是否正常工作
/usr/local/nagios/libexec/check_nrpe -H localhost
8.查看nrpe的監(jiān)控命令:
vim /usr/local/nagios/etc/nrpe.cfg
上面這5行定義的命令分別是檢測登陸用戶數,cpu負載,sda1的容量,僵尸進程,總進程數
9.配置監(jiān)控端:
先安裝openssl-devel
yum -y install openssl-devel
安裝nrpe
tar -zxvf nrpe-2.8.1.tar.gz
cd nrpe-2.8.1
./configure --enable-ssl --with-ssl-lib=/usr/lib/
make all
make install-plugin
只運行之一步就行了,因為只需要check_nrpe這個插件
測試與被監(jiān)控機的通信:
/usr/local/nagios/libexec/check_nrpe -H 192.168.1.243
返回nrpe的版本說明通信正常
10.在command.cfg里添加外部構件nrpe
vi /usr/local/nagios/etc/objects/commands.cfg
添加
#check nrpe
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
配置被監(jiān)控主機:
vim /usr/local/nagios/etc/nagios.cfg
添加:
cfg_file=/usr/local/nagios/etc/objects/mylinux.cfg
11.配置mylinux.cfg
cd /usr/local/nagios/etc/objects/
touch mylinux.cfg
chown nagios.nagios mylinux.cfg
vim mylinux.cfg
寫入如下:
define host{
use linux-server
host_name mylinux
alias mylinux
address 192.168.1.243
}
define service{
use generic-service
host_name mylinux
service_description HTTP
check_command check_http
}
define service{
use generic-service
host_name mylinux
service_description SSH
check_command check_ssh
}
define service{
use generic-service
host_name mylinux
service_description check-swap
check_command check_nrpe!check_swap
}
define service{
use generic-service
host_name mylinux
service_description check-load
check_command check_nrpe!check_load
}
define service{
use generic-service
host_name mylinux
service_description check-disk
check_command check_nrpe!check_disk
}
define service{
use generic-service
host_name mylinux
service_description check-users
check_command check_nrpe!check_users
}
define service{
use generic-service
host_name mylinux
service_description otal_procs
check_command check_nrpe!check_total_procs
}
檢查配置文件是否錯誤:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
12.重啟nagios: service nagios restart
13.查看web
完成!
新聞標題:nagios監(jiān)控linux主機
當前地址:http://aaarwkj.com/article0/igigio.html
成都網站建設公司_創(chuàng)新互聯,為您提供標簽優(yōu)化、定制網站、小程序開發(fā)、網站導航、域名注冊、網站設計
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯