linux客戶端需要的軟件有:nagios-plugins、nrpe
創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),上虞企業(yè)網(wǎng)站建設(shè),上虞品牌網(wǎng)站建設(shè),網(wǎng)站定制,上虞網(wǎng)站建設(shè)報價,網(wǎng)絡(luò)營銷,網(wǎng)絡(luò)優(yōu)化,上虞網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強企業(yè)競爭力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時我們時刻保持專業(yè)、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學習、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實用型網(wǎng)站。windows客戶端需要安裝:NSClient++.msi文件
Nagios服務(wù)器/usr/local/nagios/etc/objects目錄下放被監(jiān)控主機的cfg文件,使用use語句引用templates.cfg模板中的對象屬性,
linux中nagios配置詳解http://bbs.linuxtone.org/thread-2328-1-1.html
[root@centos objects]#vi /usr/local/nagios/etc/objects/windows.cfg
define host{
use windows-server ; Inherit default values from a template
host_name server ; The name we're giving to this host
alias My Windows Server ; A longer name associated with the host
address 192.168.0.8 ; IP address of the host
}
之后在/usr/local/nagios/etc/nagios.cfg文件中添加該路徑,重啟nagios服務(wù)就會在WEB出現(xiàn)。
上面是少量監(jiān)控的配置方法?!铩铩?/p>
檢查nagios配置文件語法錯誤:/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
★nagios服務(wù)器監(jiān)控linux主機的操作
Linux下Nagios的安裝與配置 http://www.cnblogs.com/mchina/archive/2013/02/20/2883404.html
必須下載安裝nrpe-2.*.tar.gz
tar xzf nrpe-2.8.1.tar.gz
cd nrpe-2.8.1
./configure
make all
make install-plugin
-------------------
tar xzf nrpe-2.8.1.tar.gz
cd nrpe-2.8.1
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
為被監(jiān)控遠程主機定義host和service
1、定義check_nrpe命令
在文件/usr/local/nagios/etc/objects/commands.cfg后面增加:
# 'check_nrpe' command definition
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$
}
2、創(chuàng)建/usr/local/nagios/etc/objects/remotehost.cfg
#host定義示例部分:
define host{
use linux-server
host_name remotehost
address 192.168.0.252
}
#Service定義示例部分:
define service{
use generic-service
service_description Root Partition
check_command check_nrpe!check_disk
}
3、添加此文件到nagios.cfg全局配置文件中
vi /usr/local/nagios/etc/nagios.cfg
cfg_file=/usr/local/nagios/etc/objects/remotehost.cfg
配置之前做好文件備份“/usr/local/nagios/etc/objects/*”和“nagios.cfg”
★★★★★添加大量被監(jiān)控主機方法
需要新建的文件:contactgroups.cfg contacts.cfg hostgroups.cfg hosts.cfg services.cfg timeperiods.cfg
參照http://sery.blog.51cto.com/10037/20520
◆vi /usr/local/nagios/etc/objects/hosts.cfg //主機配置文件路徑
define host{
host_name centos
alias centos
address 192.168.0.253
max_check_attempts 5
#check_interval 1
#retry_interval 1
check_period 24x7
contact_groups sa_groups
notification_interval 30
#first_notification_delay
notification_period 24x7
notification_options d,u,r
}
copy以上內(nèi)容,修改主機名和ip即可, 如:red-192.168.0.252
◆vi /usr/local/nagios/etc/objects/hostgroups.cfg //主機組配置文件路徑
define hostgroup{
hostgroup_name http_hosts
alias http_hosts
members red,centos
}
類似該文檔下面繼續(xù)添加。
也可以創(chuàng)建一個文件加入多個被監(jiān)控主機的信息
◆vi /usr/local/nagios/etc/objects/services.cfg //服務(wù)配置文件路徑
define service {
host_name centos
service_description check-host-alive
check_period 24x7
max_check_attempts 4
normal_check_interval 3
retry_check_interval 2
contact_groups http_hosts
notification_interval 10
notification_period 24x7
notification_options w,u,c,r
check_command check-host-alive //檢查主機是否存活
}
copy以上內(nèi)容,修改主機名和ip即可
◆vi timeperiods.cfg //監(jiān)視時段配置文件路徑
define timeperiod{
timeperiod_name 24x7
alias 24 Hours A Day, 7 Days A Week
sunday 00:00-24:00
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
}
◆vi contacts.cfg //聯(lián)系人配置文件路徑
define contact {
contact_name sa //不要有空格,使用tab鍵
alias system administrator
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands service-notify-by-sms,service-
notify-by-email //這個命令讀配置文件miscommands.cfg
host_notification_commands host-notify-by-email,host-noti
fy-by-sms //這個命令讀配置文件miscommands.cfg
email sery@163.com
pager 13333333333 //手機號,收報警短信
}
copy以上內(nèi)容,修改其他聯(lián)系人就是
◆vi contactgroups.cfg //聯(lián)系組配置文件路徑
define contactgroup {
contactgroup_name sagroup //不要用空格,使用tab鍵
alias system administrator group
members sa,sery //本例有2個成員
}
把以上所有創(chuàng)建的文件添加在nagios.cfg全局配置文件中
Starting nagios:This account is currently not available nagios啟動報錯
解決方法:
修改/etc/passwd
將/sbin/nologin改成/bin/bash
★★NRPE客戶端的安裝
http://blog.csdn.net/jiedushi/article/details/6524375
nagios 客戶端安裝LINUX
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
yum install xinetd
make install-xinetd
檢查NRPE正確安裝與否命令:/usr/local/nagios/libexec/check_nrpe -H localhost
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。