Redis之使用python脚本监控队列长度

  编辑python脚本redis_conn.py

#!/usr/bin/env python
#ending:utf-8
import redis
def redis_conn():
    pool = redis.ConnectionPool(host="192.168.56.11",port=6379,db=3,password=123456)
    conn = redis.Redis(connection_pool=pool)
    data = conn.llen("system-log-5611")
    print(data)
redis_conn()

  安装python的redis支持模块

yum -y install epel-release
yum -y install python-pip
pip install redis

  运行

  然后可以通过zabbix调用这个脚本监控队列长度设置阀值报警

原文地址:https://www.cnblogs.com/minseo/p/9189764.html

时间: 2024-07-30 23:36:43

Redis之使用python脚本监控队列长度的相关文章

一个简单的监控redis性能的python脚本

一个简单的监控redis性能的python脚本 上一篇已经讲了如何监控memcached了,现在也顺带讲如何监控redis. 首先介绍下监控redis那些信息: Redis ping:检验ping Redis alive:查看检查端口是否alive Redis connections:查看连接数 Redis blockedClients:正在等待阻塞客户端数量 Redis connectionsUsage:redis的连接使用率 Redis memoryUsage:redis内存使用量 Redi

shell vs python脚本监控http请求

各写一个shell和python脚本来监控http请求,并在服务不可用的时候重启服务. 监控的连接为: http://192.168.1.101:5022/product http://192.168.1.101:5024/module shell脚本如下,配合crontab计划任务每一分钟执行一次检查: #!/bin/bash # This shell is used to moniter 192.168.1.101 port 5022 & 5024 date  #在crontab里用来记录l

使用python脚本监控指定域名解析

python脚本:                                                                                                                  21,0-1        All #!/usr/bin/python # -*- coding: utf-8 -*- #此脚本用于检测域名解析是否正常 import os namelist = {'www.51cto.com':'218.11.0.91

使用python脚本监控weblogic

1.python的脚本如下: 1 ############################################################################### 2 #created on 2013-07-09 3 #author : zhaolijun 4 #used to get weblogic server runtime infomation 5 #wls_ver:weblogic 10.3.5.0 6 #########################

python脚本监控docker容器

脚本功能: 监控CPU使用率 监控内存使用状况 监控网络流量 #!/usr/bin/env  python # --*-- coding:UTF-8 --*-- import  sys import  tab import  re import  os import  time from docker  import Client import  commands keys_container_stats_list = ['blkio_stats', 'precpu_stats', 'netwo

python脚本监控磁盘空间

写了个python小程序,监控磁盘空间,前面部分网上也有很多,写博客的目的是记录下来,已供自己后面使用,思路就是用pexpect 这个模块,ssh到不同的机器上,查到磁盘空间,最后对查到的结果进行处理,然后存到mysql数据中.以下是代码: #coding=utf8 import pexpect import getpass,os,sys import re,datetime, time def ssh_command (user, host, password, command): ssh_n

python脚本 监控MySQL slave 状态

#!/usr/bin/python#!gbk import osimport sys mysqlbase = '/usr/bin/mysql'host = 'ip'user = 'root'passw = 'xxxxxx'info = os.popen(mysqlbase+' -h %s -u%s -p%s -e "show slave status\G"|grep -E "Slave_IO_Running|Slave_SQL_Running|Seconds_Behind_M

监控redis和zookpeer服务脚本 并且python发送邮件

监控rediszookpeer #!/bin/bash name=`cat /etc/salt/minion | grep "^id" | awk '{print $2}'` ipaddr=`/sbin/ifconfig | grep "inet addr" | egrep -v "10\.|127\." | awk  -F'[: ]+' '{print $4}'` function checkRedis(){     ps="`ps 

用 Python 脚本实现对 Linux 服务器的监控

hon 分享到:8 原文出处: 曹江华 目前 Linux 下有一些使用 Python 语言编写的 Linux 系统监控工具 比如 inotify-sync(文件系统安全监控软件).glances(资源监控工具)在实际工作中,Linux 系统管理员可以根据自己使用的服务器的具体情况编写一下简单实用的脚本实现对 Linux 服务器的监控. 本文介绍一下使用 Python 脚本实现对 Linux 服务器 CPU 内存 网络的监控脚本的编写. Python 版本说明 Python 是由 Guido va