码迷,mamicode.com
首页 > 其他好文 > 详细

solrcloud 数据监控

时间:2014-10-10 21:02:54      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:return   admin   监控   

#!/usr/bin/python
import json
import pycurl
import cStringIO

def work_url(ip):
        buf=cStringIO.StringIO()
        c=pycurl.Curl()
        c.setopt(c.URL,"http://%s:8983/solr/collection1/admin/mbeans?stats=true&wt=json&_=1409194287592"%ip)
        c.setopt(c.WRITEFUNCTION,buf.write)
        c.perform()
        a=buf.getvalue()
        buf.close()
        return a

if __name__ == ‘__main__‘:
        dict={}
        for i in range(4,10):
                ip=‘10.13.144.22‘+str(i)
                b=work_url(ip)
                data=json.loads(b)
                print data
                dict[ip]={}
                select_avgTimePerRequest=data[‘solr-mbeans‘][3][‘/select‘][‘stats‘][‘avgTimePerRequest‘]
                select_avgRequestsPerSecond=data[‘solr-mbeans‘][3][‘/select‘][‘stats‘][‘avgRequestsPerSecond‘]
                cache_document=data[‘solr-mbeans‘][7][‘documentCache‘][‘stats‘][‘cumulative_hitratio‘]
                dict[ip][‘select‘]={}
                dict[ip][‘select‘][‘avgTimePerRequest‘]=select_avgTimePerRequest
                dict[ip][‘select‘][‘avgRequestsPerSecond‘]=select_avgRequestsPerSecond
                dict[ip][‘select‘][‘hitratio‘]=cache_document
        print dict

本文出自 “expect批量同步数据” 博客,请务必保留此出处http://4249964.blog.51cto.com/4239964/1562177

solrcloud 数据监控

标签:return   admin   监控   

原文地址:http://4249964.blog.51cto.com/4239964/1562177

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!