ZhuoRoger / redismon

Redis monitor plugin for Open-Falcon
132 stars 67 forks source link

IndexError: list index out of rang #5

Open xul487290 opened 7 years ago

xul487290 commented 7 years ago

单独运行python redis_cluster.py 没有问题,Python redis_server.py也没有问题,但运行python redis_monitor.py 有如下报错 Traceback (most recent call last): File "redis_monitor.py", line 122, in main() File "redis_monitor.py", line 119, in main redis_falcon_monitor.send_data() File "redis_monitor.py", line 88, in send_data redis_cluser_info_dict = redis_cluster_info.collect_cluster_info() File "/usr/local/LeMonitor/falcon-agent/plugin/Redis/redismon/bin/redis_cluster.py", line 48, in collect_cluster_info cluster_info_dict_all[item_list[0]] = item_list[1] IndexError: list index out of range

xul487290 commented 7 years ago
def collect_cluster_info(self):
    """Collect cluster info metrics.
        "The redis-cli must be in the command PATH!!!"      

    Returns:
        cluster_info_dict: redis cluster metrics dict.
    """ 
    cluster_command = "redis-cli -h " + self.addr + " -p " + str(self.port) + " --password " + self.password  + "cluster info"
    if (self.password == ""):   # If password is empty, replcate the password arg
        cluster_command = cluster_command.replace("--password"," ")
    cluster_info = commands.getoutput(cluster_command)  
    cluster_info_list =  cluster_info.replace("\r\n"," ").replace("\r","").split(" ")

此处cluster_command变量不能得到数据,--password是不是应该是-a

banlilin commented 5 years ago

这个应该是cluster哪个文件里面的redis-cli命令找不到 写绝对路径吧