Nagios添加服务监控
2014-03-02 01:45
309 查看
监控Web服务:在window server2003上安装IIS然后我们在nagios上做配置命令配置里面默认有httpdefine command{ command_name check_http command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$ }配置主机和服务,主机之前已经配置好了,所以我们添加一个服务就可以[nagios@node4 ~]$ cd/usr/local/nagios/etc/objects/[nagios@node4objects]$ vim windows.cfgdefine service{ use generic-service host_name winserver service_description Web_server check_command check_http }重启nagios服务[root@node4 objects]#service nagios restartRunning configurationcheck...done.Stopping nagios:done.Starting nagios:done.然后现在我们在nagios管理界面上看到新加入的web服务了
监控mysql服务在node4上安装mysql-server# yum install mysql-server -y启动mysqld服务# service mysqldstartInitializing MySQLdatabase: Installing MySQL systemtables...OKFilling helptables...OK
To start mysqld atboot time you have to copysupport-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 testdatabases andanonymous user created by default. Thisisstrongly 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.plcd /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设置管理员密码# mysqladmin -u root -p password wiker #修改密码为wikerEnter password: #直接回车,默认的root密码是空[root@node4 ~]# mysql -u root -pwiker #测试下登陆Welcome to the MySQLmonitor. Commands end with ; or \g.Your MySQL connectionid is 11Server 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)但是我们发现我们没有check_mysql这个插件:[root@node4 libexec]#pwd/usr/local/nagios/libexec[root@node4 libexec]#lscheck_apt check_imap check_popcheck_breeze check_ircd check_procscheck_by_ssh check_load check_realcheck_clamd check_log check_rpccheck_cluster check_mailq check_sensorscheck_dhcp check_mrtg check_smtpcheck_dig check_mrtgtraf check_sshcheck_disk check_nagios check_swapcheck_disk_smb check_nntp check_tcpcheck_dns check_nrpe check_timecheck_dummy check_nt check_udpcheck_file_age check_ntp check_upscheck_flexlm check_ntp_peer check_userscheck_ftp check_ntp_time check_wavecheck_http check_nwstat negatecheck_icmp check_oracle process_perfdata.plcheck_ide_smart check_overcr urlizecheck_ifoperstatus check_ping utils.pmcheck_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]#lscheck_apt check_load check_realcheck_breeze check_log check_rpccheck_by_ssh check_mailq check_sensorscheck_clamd check_mrtg check_simapcheck_cluster check_mrtgtraf check_smtpcheck_dhcp check_mysql check_spopcheck_dig check_mysql_query check_sshcheck_disk check_nagios check_ssmtpcheck_disk_smb check_nntp check_swapcheck_dns check_nntps check_tcpcheck_dummy check_nrpe check_timecheck_file_age check_nt check_udpcheck_flexlm check_ntp check_upscheck_ftp check_ntp_peer check_userscheck_http check_ntp_time check_wavecheck_icmp check_nwstat negatecheck_ide_smart check_oracle process_perfdata.plcheck_ifoperstatus check_overcr urlizecheck_ifstatus check_ping utils.pmcheck_imap check_pnp_rrds.pl utils.shcheck_ircd check_popcheck_jabber check_procs首先我们定义commands[root@node4 libexec]#cd /usr/local/nagios/etc/objects/[root@node4 objects]#vim commands.cfgdefine command { command_name check_mysql command_line $USER1$/check_mysql -H $HOSTADDRESS$ -u$ARG1$ -p $ARG2$}然后定义主机上的服务[root@node4 objects]#vim localhost.cfgdefine 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: 0Total Errors: 0然后重启nagios服务[root@node4 objects]#service nagios restartRunning configurationcheck...done.Stopping nagios:done.Starting nagios:done.然后进入nagios界面,你就会看到我们加入的mysql服务
本文出自 “IT没有圈” 博客,请务必保留此出处http://wiker.blog.51cto.com/8481872/1365751
监控mysql服务在node4上安装mysql-server# yum install mysql-server -y启动mysqld服务# service mysqldstartInitializing MySQLdatabase: Installing MySQL systemtables...OKFilling helptables...OK
To start mysqld atboot time you have to copysupport-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 testdatabases andanonymous user created by default. Thisisstrongly 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.plcd /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设置管理员密码# mysqladmin -u root -p password wiker #修改密码为wikerEnter password: #直接回车,默认的root密码是空[root@node4 ~]# mysql -u root -pwiker #测试下登陆Welcome to the MySQLmonitor. Commands end with ; or \g.Your MySQL connectionid is 11Server 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)但是我们发现我们没有check_mysql这个插件:[root@node4 libexec]#pwd/usr/local/nagios/libexec[root@node4 libexec]#lscheck_apt check_imap check_popcheck_breeze check_ircd check_procscheck_by_ssh check_load check_realcheck_clamd check_log check_rpccheck_cluster check_mailq check_sensorscheck_dhcp check_mrtg check_smtpcheck_dig check_mrtgtraf check_sshcheck_disk check_nagios check_swapcheck_disk_smb check_nntp check_tcpcheck_dns check_nrpe check_timecheck_dummy check_nt check_udpcheck_file_age check_ntp check_upscheck_flexlm check_ntp_peer check_userscheck_ftp check_ntp_time check_wavecheck_http check_nwstat negatecheck_icmp check_oracle process_perfdata.plcheck_ide_smart check_overcr urlizecheck_ifoperstatus check_ping utils.pmcheck_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]#lscheck_apt check_load check_realcheck_breeze check_log check_rpccheck_by_ssh check_mailq check_sensorscheck_clamd check_mrtg check_simapcheck_cluster check_mrtgtraf check_smtpcheck_dhcp check_mysql check_spopcheck_dig check_mysql_query check_sshcheck_disk check_nagios check_ssmtpcheck_disk_smb check_nntp check_swapcheck_dns check_nntps check_tcpcheck_dummy check_nrpe check_timecheck_file_age check_nt check_udpcheck_flexlm check_ntp check_upscheck_ftp check_ntp_peer check_userscheck_http check_ntp_time check_wavecheck_icmp check_nwstat negatecheck_ide_smart check_oracle process_perfdata.plcheck_ifoperstatus check_overcr urlizecheck_ifstatus check_ping utils.pmcheck_imap check_pnp_rrds.pl utils.shcheck_ircd check_popcheck_jabber check_procs首先我们定义commands[root@node4 libexec]#cd /usr/local/nagios/etc/objects/[root@node4 objects]#vim commands.cfgdefine command { command_name check_mysql command_line $USER1$/check_mysql -H $HOSTADDRESS$ -u$ARG1$ -p $ARG2$}然后定义主机上的服务[root@node4 objects]#vim localhost.cfgdefine 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: 0Total Errors: 0然后重启nagios服务[root@node4 objects]#service nagios restartRunning configurationcheck...done.Stopping nagios:done.Starting nagios:done.然后进入nagios界面,你就会看到我们加入的mysql服务
本文出自 “IT没有圈” 博客,请务必保留此出处http://wiker.blog.51cto.com/8481872/1365751
相关文章推荐
- 关于nagios监控系统添加主机和服务脚本
- nagios+centreon总结之第五章――nagios+centreon添加监控服务
- 关于nagios监控系统添加主机和服务脚本
- nagios服务监控添加总结
- 安装nagios 图形添加监控主机和服务的软件nconf
- 一起搭建linux监控平台之nagios(四)监控端添加服务
- 关于nagios监控系统添加主机和服务脚本
- nagios监控添加check_http服务
- Centreon+Nagios实战第八篇——Nagios+Centreon添加监控服务
- nagios+centreon总结之第五章——nagios+centreon添加监控服务
- 在nagios里面添加要监控的主机和要监控的服务以及系统参数
- zabbix系列(四)Zabbix3.0.4添加对Nginx服务的监控
- 监控之--Nagios如何监控本地主机及本地服务
- Nagios+Nconf 监控主机和服务
- nagios 监控远端服务公共数据
- Nagios添加时间监控
- nagios监控mysql服务示例
- nagios监控服务的安装和配置
- 使用nagios监控oracle服务 推荐
- nagios2------添加监控对象