最新消息:

nagios redis监控

监控 admin 5281浏览 0评论

实际环境如下:

10.0.0.167: 6380

10.0.0.165: 6379/6380

1. 下载redis监控插件

下载链接地址:

http://exchange.nagios.org/directory/Plugins/Databases/check_redis-2Epl/details

https://github.com/willixix/WL-NagiosPlugins

2. 定义监控命令

在commands.cfg添加下面内容:

# check redis
define command {
        command_name    check_redis
        command_line    $USER1$/check_redis.pl -H $HOSTADDRESS$ -p $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -f
}

3. 定义主机

define host{
        use             linux-server  ; Inherit default values from a template
        host_name       10.0.0.165    ; The name we're giving to this host
        alias           redis-linux    ; A longer name associated with the host
        address         10.0.0.165    ; IP address of the host
        }

define host{
        use             linux-server  ; Inherit default values from a template
        host_name       10.0.0.167    ; The name we're giving to this host
        alias           redis-linux    ; A longer name associated with the host
        address         10.0.0.167    ; IP address of the host
        }

4. 定义主机组

define hostgroup {
        hostgroup_name  Redis_Servers
        alias           Redis Servers
        members         10.0.0.165,10.0.0.167
}

5. 定义服务组

define servicegroup{
        servicegroup_name  Redisservices
        alias           Redis services
        }

6. 定义监控项

# vim redis-server.cfg
define service {
      use                     generic-service,nagiosgraph
      hostgroup_name          Redis_Servers
      service_description     Redis Client
      check_command           check_redis!6379!'connected_clients,blocked_clients,client_longest_output_list,client_biggest_input_buf'!100,5,~,~!500,10,~,~
      host_name               !10.0.0.167
      servicegroups           Redisservices
}

define service {
      use                     generic-service,nagiosgraph
      hostgroup_name          Redis_Servers
      service_description     Redis Client 6380
      check_command           check_redis!6380!'connected_clients,blocked_clients,client_longest_output_list,client_biggest_input_buf'!100,5,~,~!500,10,~,~
      servicegroups           Redisservices
}

define service {
      use                     generic-service,nagiosgraph
      hostgroup_name          Redis_Servers
      service_description     Redis Memory
      check_command           check_redis!6379!'used_memory_human,used_memory_peak_human'!~,~!~,~
      host_name               !10.0.0.167
      servicegroups           Redisservices
}

define service {
      use                     generic-service,nagiosgraph
      hostgroup_name          Redis_Servers
      service_description     Redis Memory 6380
      check_command           check_redis!6380!'used_memory_human,used_memory_peak_human'!~,~!~,~
      servicegroups           Redisservices
}

define service {
      use                     generic-service,nagiosgraph
      hostgroup_name          Redis_Servers
      service_description     Redis CPU
      check_command           check_redis!6379!'used_cpu_sys,used_cpu_user,used_cpu_sys_children,used_cpu_user_children'!~,~,~,~!~,~,~,~ ;未定义监控报警阀值
      host_name               !10.0.0.167  ;排除10.0.0.167这台
      servicegroups           Redisservices
}

define service {
      use                     generic-service,nagiosgraph
      hostgroup_name          Redis_Servers
      service_description     Redis CPU 6380
      check_command           check_redis!6380!'used_cpu_sys,used_cpu_user,used_cpu_sys_children,used_cpu_user_children'!~,~,~,~!~,~,~,~
      servicegroups           Redisservices
}

7. 主机组图

nagios-redis-1

8. 服务组图

nagios-redis-2

9. 具体项

nagios-redis-3

 

转载请注明:爱开源 » nagios redis监控

您必须 登录 才能发表评论!