使用Nagios-Plugins-Memcached 进行监控memcached
2011-01-24 16:17
429 查看
监控memcache的运行状态有好几种实现方式。在这里我只介绍用Nagios-Plugins-Memcached 进行监控memcached。
该插件是用prel 进行开发的所以系统上必须要安装Perl 环境,并且同时保证服务器能够上网, cpanplugin 安装
CPAN的使用
默认情况下使用cpan命令安装时,如果依赖其他的软件包时cpan就会停止,但是如果使用CPANPLUS来进行安装时,就能能自动安装依赖项的模板
#cpan CPANPLUS
Are you ready for manual configuration? [yes]
CPAN build and cache directory? [/root/.cpan]
Cache size for build directory (in MB)? [10]
Perform cache scanning (atstart or never)? [atstart]
Cache metadata (yes/no)? [yes]
Your terminal expects ISO-8859-1 (yes/no)? [yes]
File to save your history? [/root/.cpan/histfile]
Number of lines to save? [100]
Policy on building prerequisites (follow, ask or ignore)? [ask]
Where is your gzip program? [/bin/gzip]
Where is your tar program? [/bin/tar]
Where is your unzip program? [/usr/bin/unzip]
Where is your make program? [/usr/bin/make]
Where is your links program? [/usr/bin/links]
Where is your wget program? [/usr/bin/wget]
Warning: ncftpget not found in PATH
Where is your ncftpget program? []
Warning: ncftp not found in PATH
Where is your ncftp program? []
Where is your ftp program? [/usr/kerberos/bin/ftp]
Where is your gpg program? [/usr/bin/gpg]
What is your favorite pager program? [/usr/bin/less]
What is your favorite shell? [/bin/bash]
Select your continent (or several nearby continents) [] 2 注: 这是选择地区
Select your country (or several nearby countries) [] 1 注:这选国家
2 首先下载Nagios-Plugins-Memcached-0.02.tar.gz,解压
wget http://search.cpan.org/CPAN/authors/id/Z/ZI/ZIGOROU/Nagios-Plugins-Memcached-0.02.tar.gz
#tar xvf Nagios-Plugins-Memcached-0.02.tar.gz
3 安装
#cd Nagios-Plugins-Memcached-0.0.2
#perl Makefile.pl
*** Module::AutoInstall version 1.03
*** Checking for Perl dependencies...
[Core Features]
- Carp::Clan ...missing.
- Cache::Memcached ...missing.
- FindBin ...loaded. (1.47)
- Nagios::Plugin ...missing.
- Time::HiRes ...loaded. (1.9717)
==> Auto-install the 3 mandatory module(s) from CPAN? [y]
#make install
4 查找安装后的check_memcached 的插件,并把该插件拷贝到nagios的插件的目录下面
#whereis check_memcached
#cp /usr/bin/check_memcached /usr/local/nagios/libexec
#chmod +x /usr/local/nagios/libexec/check_memcached
5 当然在用nagios 进行监控memcached 的方法方法分别是
首先定命令在nagios 命令文件command.cfg后面添加一下
define command{
command_name check_memcached_response
command_line $USER1$/check_memcached -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$
}
define command{
command_name check_memcached_size
command_line $USER1$/check_memcached -H $HOSTADDRESS$ --size-warning $ARG1$ --size-critical $ARG2$
}
define command{
command_name check_memcached_hit
command_line $USER1$/check_memcached -H $HOSTADDRESS$ --hit-warning $ARG1$ --hit-critical $ARG2$
}
6 定义主机
define host{
use linux-box-remote
host_name mysqllinux186
alias Memcache
address 192.168.1.186
}
define service{
use generic-service
host_name mysqllinux186
service_description Memcached
check_command check_memcached_response!30!40
}
define service{
use generic-service
host_name mysqllinux186
service_description Memcached_size
check_command check_memcached_size!30!40
}
define service{
use generic-service
host_name mysqllinux186
service_description Memcached_hit
check_command check_memcached_hit!40!30
}
#/usr/local/nagios/bin/nagio -v /usr/local/nagios/etc/nagios.cfg
检测配置文件是不是有错误,如果没有错误,并重启nagios
本文出自 “Richard Shen运维/架构” 博客,请务必保留此出处http://lxsym.blog.51cto.com/1364623/484850
该插件是用prel 进行开发的所以系统上必须要安装Perl 环境,并且同时保证服务器能够上网, cpanplugin 安装
CPAN的使用
默认情况下使用cpan命令安装时,如果依赖其他的软件包时cpan就会停止,但是如果使用CPANPLUS来进行安装时,就能能自动安装依赖项的模板
#cpan CPANPLUS
Are you ready for manual configuration? [yes]
CPAN build and cache directory? [/root/.cpan]
Cache size for build directory (in MB)? [10]
Perform cache scanning (atstart or never)? [atstart]
Cache metadata (yes/no)? [yes]
Your terminal expects ISO-8859-1 (yes/no)? [yes]
File to save your history? [/root/.cpan/histfile]
Number of lines to save? [100]
Policy on building prerequisites (follow, ask or ignore)? [ask]
Where is your gzip program? [/bin/gzip]
Where is your tar program? [/bin/tar]
Where is your unzip program? [/usr/bin/unzip]
Where is your make program? [/usr/bin/make]
Where is your links program? [/usr/bin/links]
Where is your wget program? [/usr/bin/wget]
Warning: ncftpget not found in PATH
Where is your ncftpget program? []
Warning: ncftp not found in PATH
Where is your ncftp program? []
Where is your ftp program? [/usr/kerberos/bin/ftp]
Where is your gpg program? [/usr/bin/gpg]
What is your favorite pager program? [/usr/bin/less]
What is your favorite shell? [/bin/bash]
Select your continent (or several nearby continents) [] 2 注: 这是选择地区
Select your country (or several nearby countries) [] 1 注:这选国家
2 首先下载Nagios-Plugins-Memcached-0.02.tar.gz,解压
wget http://search.cpan.org/CPAN/authors/id/Z/ZI/ZIGOROU/Nagios-Plugins-Memcached-0.02.tar.gz
#tar xvf Nagios-Plugins-Memcached-0.02.tar.gz
3 安装
#cd Nagios-Plugins-Memcached-0.0.2
#perl Makefile.pl
*** Module::AutoInstall version 1.03
*** Checking for Perl dependencies...
[Core Features]
- Carp::Clan ...missing.
- Cache::Memcached ...missing.
- FindBin ...loaded. (1.47)
- Nagios::Plugin ...missing.
- Time::HiRes ...loaded. (1.9717)
==> Auto-install the 3 mandatory module(s) from CPAN? [y]
#make install
4 查找安装后的check_memcached 的插件,并把该插件拷贝到nagios的插件的目录下面
#whereis check_memcached
#cp /usr/bin/check_memcached /usr/local/nagios/libexec
#chmod +x /usr/local/nagios/libexec/check_memcached
5 当然在用nagios 进行监控memcached 的方法方法分别是
首先定命令在nagios 命令文件command.cfg后面添加一下
define command{
command_name check_memcached_response
command_line $USER1$/check_memcached -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$
}
define command{
command_name check_memcached_size
command_line $USER1$/check_memcached -H $HOSTADDRESS$ --size-warning $ARG1$ --size-critical $ARG2$
}
define command{
command_name check_memcached_hit
command_line $USER1$/check_memcached -H $HOSTADDRESS$ --hit-warning $ARG1$ --hit-critical $ARG2$
}
6 定义主机
define host{
use linux-box-remote
host_name mysqllinux186
alias Memcache
address 192.168.1.186
}
define service{
use generic-service
host_name mysqllinux186
service_description Memcached
check_command check_memcached_response!30!40
}
define service{
use generic-service
host_name mysqllinux186
service_description Memcached_size
check_command check_memcached_size!30!40
}
define service{
use generic-service
host_name mysqllinux186
service_description Memcached_hit
check_command check_memcached_hit!40!30
}
#/usr/local/nagios/bin/nagio -v /usr/local/nagios/etc/nagios.cfg
检测配置文件是不是有错误,如果没有错误,并重启nagios
本文出自 “Richard Shen运维/架构” 博客,请务必保留此出处http://lxsym.blog.51cto.com/1364623/484850
相关文章推荐
- 【JMeter】JMeter使用plugins插件进行服务器性能监控
- 【JMeter】JMeter使用plugins插件进行服务器性能监控
- Memcached全面解析并使用zabbix进行监控
- nagios 通过Nagios-Plugins-Memcached插件监控memcached服务器
- Memcached全面解析并使用zabbix进行监控
- 使用nagios监控交换机端口流量,对低于阈值的流量进行报警
- 使用nagios来监控memcached
- 【JMeter】JMeter使用plugins插件进行服务器性能监控
- SQL Server 手把手教你使用profile进行性能监控
- 使用Shell脚本对Linux系统和进程资源进行监控
- 使用memcached进行内存缓存
- 使用stats detail命令进行memcached的细粒度统计
- 关于nagios系统下使用shell脚本自定义监控插件的编写
- 如何使用Nagios实现网络监控?
- 使用memcached进行内存缓存(转)
- 使用python+cron对php状态进行定时监控
- 使用shell脚本进行服务器系统监控——系统负载监控(2)
- 使用nagios监控io,内存
- 使用memcached进行内存缓存
- 使用memcached进行内存缓存