監(jiān)控Web服務(wù):
創(chuàng)新互聯(lián)基于成都重慶香港及美國等地區(qū)分布式IDC機房數(shù)據(jù)中心構(gòu)建的電信大帶寬,聯(lián)通大帶寬,移動大帶寬,多線BGP大帶寬租用,是為眾多客戶提供專業(yè)服務(wù)器托管報價,主機托管價格性價比高,為金融證券行業(yè)川西大數(shù)據(jù)中心,ai人工智能服務(wù)器托管提供bgp線路100M獨享,G口帶寬及機柜租用的專業(yè)成都idc公司。在window server2003上安裝IIS
然后我們在nagios上做配置
命令配置里面默認有http
define command{
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}
配置主機和服務(wù),主機之前已經(jīng)配置好了,所以我們添加一個服務(wù)就可以
[nagios@node4 ~]$ cd/usr/local/nagios/etc/objects/
[nagios@node4objects]$ vim windows.cfg
define service{
use generic-service
host_name winserver
service_description Web_server
check_command check_http
}
重啟nagios服務(wù)
[root@node4 objects]#service nagios restart
Running configurationcheck...done.
Stopping nagios:done.
Starting nagios:done.
然后現(xiàn)在我們在nagios管理界面上看到新加入的web服務(wù)了
監(jiān)控mysql服務(wù)
在node4上安裝mysql-server
# yum install mysql-server -y
啟動mysqld服務(wù)
# service mysqldstart
Initializing MySQLdatabase: Installing MySQL systemtables...
OK
Filling helptables...
OK
To start mysqld atboot time you have to copy
support-files/mysql.serverto the right place for your system
PLEASE REMEMBER TOSET A PASSWORD FOR THE MySQL root USER !
To do so, start theserver, then issue the following commands:
/usr/bin/mysqladmin-u root password 'new-password'
/usr/bin/mysqladmin-u root -h node4.example.com password 'new-password'
Alternatively you canrun:
/usr/bin/mysql_secure_installation
which will also giveyou the option of removing the test
databases andanonymous user created by default. Thisis
strongly recommendedfor production servers.
See the manual formore instructions.
You can start theMySQL daemon with:
cd /usr ;/usr/bin/mysqld_safe &
You can test theMySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ;perl mysql-test-run.pl
Please report anyproblems with the /usr/bin/mysqlbug script!
[ OK ]
Starting mysqld: [ OK ]
# chkconfig mysqld on
然后給mysql設(shè)置管理員密碼
# mysqladmin -u root -p password wiker #修改密碼為wiker
Enter password: #直接回車,默認的root密碼是空
[root@node4 ~]# mysql -u root -pwiker #測試下登陸
Welcome to the MySQLmonitor. Commands end with ; or \g.
Your MySQL connectionid is 11
Server version:5.1.52 Source distribution
Copyright (c) 2000,2010, Oracle and/or its affiliates. All rights reserved.
This software comeswith ABSOLUTELY NO WARRANTY. This is free software,
and you are welcometo modify and redistribute it under the GPL v2 license
Type 'help;' or '\h'for help. Type '\c' to clear the current input statement.
mysql> showdatabases;
+--------------------+
| Database |
+--------------------+
| information_schema|
| mysql |
| test |
+--------------------+
3 rows in set (0.01sec)
但是我們發(fā)現(xiàn)我們沒有check_mysql這個插件:
[root@node4 libexec]#pwd
/usr/local/nagios/libexec
[root@node4 libexec]#ls
check_apt check_imap check_pop
check_breeze check_ircd check_procs
check_by_ssh check_load check_real
check_clamd check_log check_rpc
check_cluster check_mailq check_sensors
check_dhcp check_mrtg check_smtp
check_dig check_mrtgtraf check_ssh
check_disk check_nagios check_swap
check_disk_smb check_nntp check_tcp
check_dns check_nrpe check_time
check_dummy check_nt check_udp
check_file_age check_ntp check_ups
check_flexlm check_ntp_peer check_users
check_ftp check_ntp_time check_wave
check_http check_nwstat negate
check_icmp check_oracle process_perfdata.pl
check_ide_smart check_overcr urlize
check_ifoperstatus check_ping utils.pm
check_ifstatus check_pnp_rrds.pl utils.sh
因為check_mysql這個插件需要依賴mysql-devel包才能生效,所以我們需要安裝這個包,然后重新編譯nagios的插件
# yum installmysql-devel -y
[root@node4nagios-plugins-1.5]# ./configure--with-nagios-user=nagios --with-nagios-group=nagios
[root@node4nagios-plugins-1.5]# make ; make install
[root@node4nagios-plugins-1.5]# cd /usr/local/nagios/libexec/
[root@node4 libexec]#ls
check_apt check_load check_real
check_breeze check_log check_rpc
check_by_ssh check_mailq check_sensors
check_clamd check_mrtg check_simap
check_cluster check_mrtgtraf check_smtp
check_dhcp check_mysql check_spop
check_dig check_mysql_query check_ssh
check_disk check_nagios check_ssmtp
check_disk_smb check_nntp check_swap
check_dns check_nntps check_tcp
check_dummy check_nrpe check_time
check_file_age check_nt check_udp
check_flexlm check_ntp check_ups
check_ftp check_ntp_peer check_users
check_http check_ntp_time check_wave
check_icmp check_nwstat negate
check_ide_smart check_oracle process_perfdata.pl
check_ifoperstatus check_overcr urlize
check_ifstatus check_ping utils.pm
check_imap check_pnp_rrds.pl utils.sh
check_ircd check_pop
check_jabber check_procs
首先我們定義commands
[root@node4 libexec]#cd /usr/local/nagios/etc/objects/
[root@node4 objects]#vim commands.cfg
define command {
command_name check_mysql
command_line $USER1$/check_mysql -H $HOSTADDRESS$ -u$ARG1$ -p $ARG2$
}
然后定義主機上的服務(wù)
[root@node4 objects]#vim localhost.cfg
define service{
use local-service,services-pnp
host_name localhost
service_description Mysql-server
check_command check_mysql!root!wiker
}
然后檢查語法
[root@node4 objects]#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
……………………………………..
Total Warnings: 0
Total Errors: 0
然后重啟nagios服務(wù)
[root@node4 objects]#service nagios restart
Running configurationcheck...done.
Stopping nagios:done.
Starting nagios:done.
然后進入nagios界面,你就會看到我們加入的mysql服務(wù)
另外有需要云服務(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)用場景需求。
當(dāng)前標(biāo)題:Nagios添加服務(wù)監(jiān)控-創(chuàng)新互聯(lián)
當(dāng)前鏈接:http://bm7419.com/article6/gecig.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗、網(wǎng)站排名、移動網(wǎng)站建設(shè)、網(wǎng)站導(dǎo)航、網(wǎng)頁設(shè)計公司、營銷型網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容