Chinaunix首页 | 论坛 | 博客
  • 博客访问: 49162
  • 博文数量: 20
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 220
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-06 10:28
个人简介

原创文章,转载请注明出处,谢谢。

我的朋友

分类: LINUX

2014-03-09 22:48:19

利用python脚本部署zabbix支持gtalk报警

部署环境如下:

chenwei@sysop:~$ uname -a        
Linux sysop.raidcall.com.ru 3.5.0-45-generic #68~precise1-Ubuntu SMP Wed Dec 4 16:18:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

chenwei@sysop:~$ cat /etc/issue
Ubuntu 12.04.4 LTS \n \l

python版本:2.7

python脚本如下(send_gtalk.py): 注:脚本中“sysop,gmail, password”分别为监控的gmail账户和密码

#!/usr/bin/python
 
import sys
from pyxmpp.all import JID,Iq,Presence,Message,StreamError
from pyxmpp.jabber.client import JabberClient
from pyxmpp.streamtls import TLSSettings


class GTalk(JabberClient):
        def __init__(self, sid, spwd, msg):
                self.__msg = msg
                sid = JID(sid)
                if not sid.resource:
                        sid = JID(sid.node, sid.domain, 'raidcall')
                tls = TLSSettings(require=False, verify_peer=False)
                auth = ['sasl:PLAIN']
                JabberClient.__init__(self, sid, spwd, auth_methods=auth, tls_settings=tls)


        def login(self):
                self.connect()
                self.loop(1)


        def roster_updated(self,item=None):
                if not item:
                        for item in self.roster.get_items():
                                msg = Message(to_jid=item.jid, body=self.__msg, stanza_type="chat")
                                self.stream.send(msg)
                        self.disconnect()




if len(sys.argv) > 1:
        msg = sys.argv[1]
else:
        msg = ""
        while True:
                line = sys.stdin.readline()
                if not line:
                        break
                msg += line


gtalk = GTalk('sysop,gmail', 'password', msg)
gtalk.login()


脚本使用方法:执行python脚本 后面加发送的内容,例如:python send_gtalk.py “test message 


下面执行脚本 python send_gtalk.py “test message”

Traceback (most recent call last):
  File "send_gtalk.py", line 5, in
    from pyxmpp.all import JID,Iq,Presence,Message,StreamError
ImportError: No module named pyxmpp.all

出现报错,报错提示 ImportError: No module named pyxmpp.all

检查本地python环境,并且确定是否有正常安装模块包,经过检查发现没有,汗死。(模块包下载地址:)该脚本在我测试机cento环境测试通过,现在移植到生产机因为缺少模块无法运行,因此我需要重新搞过环境。

先wget 到最新的pyxmpp包到本地,并且解压,并安装 (安装方法详细请看目录下的readme文档)

chenwei@sysop:~$ cd pyxmpp-1.1.2/
chenwei@sysop:~/pyxmpp-1.1.2$ python configure.py
Checking for python version... 2.7.3 (default, Sep 26 2013, 20:03:06)  [GCC 4.6.3]
Checking for dnspython... version 1.11.1 found
Checking for libxml2 python bindings... not found
ERROR: You need libxml2 python bindings for PyXMPP

报错了,貌似安装pyXMPP要先安装 dnspython

因此再上(模块包下载地址:) wget一个下来先安装。

chenwei@sysop:~/dnspython-1.11.1$ sudo python setup.py install
running install
running build
running build_py
running install_lib
creating /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/hash.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/renderer.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/rdataset.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/inet.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/entropy.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/set.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/namedict.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/name.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/ttl.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/node.py -> /usr/local/lib/python2.7/dist-packages/dns
creating /usr/local/lib/python2.7/dist-packages/dns/rdtypes
creating /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/CNAME.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/AFSDB.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/DNAME.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/SPF.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/DLV.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/RT.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/ISDN.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/X25.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/LOC.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/RP.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/RRSIG.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/CERT.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/SOA.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/PTR.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/HIP.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/TLSA.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/MX.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/DS.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/NSEC.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/GPOS.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/NSEC3PARAM.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/SSHFP.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/HINFO.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/__init__.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/NS.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/NSEC3.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/DNSKEY.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/ANY/TXT.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY
copying build/lib.linux-x86_64-2.7/dns/rdtypes/txtbase.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes
copying build/lib.linux-x86_64-2.7/dns/rdtypes/mxbase.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes
copying build/lib.linux-x86_64-2.7/dns/rdtypes/nsbase.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes
creating /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN
copying build/lib.linux-x86_64-2.7/dns/rdtypes/IN/A.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN
copying build/lib.linux-x86_64-2.7/dns/rdtypes/IN/NSAP_PTR.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN
copying build/lib.linux-x86_64-2.7/dns/rdtypes/IN/WKS.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN
copying build/lib.linux-x86_64-2.7/dns/rdtypes/IN/PX.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN
copying build/lib.linux-x86_64-2.7/dns/rdtypes/IN/NAPTR.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN
copying build/lib.linux-x86_64-2.7/dns/rdtypes/IN/AAAA.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN
copying build/lib.linux-x86_64-2.7/dns/rdtypes/IN/KX.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN
copying build/lib.linux-x86_64-2.7/dns/rdtypes/IN/NSAP.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN
copying build/lib.linux-x86_64-2.7/dns/rdtypes/IN/APL.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN
copying build/lib.linux-x86_64-2.7/dns/rdtypes/IN/DHCID.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN
copying build/lib.linux-x86_64-2.7/dns/rdtypes/IN/IPSECKEY.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN
copying build/lib.linux-x86_64-2.7/dns/rdtypes/IN/__init__.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN
copying build/lib.linux-x86_64-2.7/dns/rdtypes/IN/SRV.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN
copying build/lib.linux-x86_64-2.7/dns/rdtypes/dsbase.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes
copying build/lib.linux-x86_64-2.7/dns/rdtypes/__init__.py -> /usr/local/lib/python2.7/dist-packages/dns/rdtypes
copying build/lib.linux-x86_64-2.7/dns/resolver.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/tokenizer.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/reversename.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/rcode.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/ipv4.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/edns.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/dnssec.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/tsigkeyring.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/rrset.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/wiredata.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/opcode.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/update.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/zone.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/rdatatype.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/version.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/tsig.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/exception.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/message.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/ipv6.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/e164.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/query.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/flags.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/rdata.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/__init__.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/grange.py -> /usr/local/lib/python2.7/dist-packages/dns
copying build/lib.linux-x86_64-2.7/dns/rdataclass.py -> /usr/local/lib/python2.7/dist-packages/dns
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/hash.py to hash.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/renderer.py to renderer.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdataset.py to rdataset.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/inet.py to inet.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/entropy.py to entropy.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/set.py to set.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/namedict.py to namedict.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/name.py to name.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/ttl.py to ttl.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/node.py to node.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/CNAME.py to CNAME.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/AFSDB.py to AFSDB.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/DNAME.py to DNAME.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/SPF.py to SPF.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/DLV.py to DLV.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/RT.py to RT.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/ISDN.py to ISDN.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/X25.py to X25.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/LOC.py to LOC.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/RP.py to RP.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/RRSIG.py to RRSIG.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/CERT.py to CERT.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/SOA.py to SOA.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/PTR.py to PTR.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/HIP.py to HIP.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/TLSA.py to TLSA.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/MX.py to MX.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/DS.py to DS.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/NSEC.py to NSEC.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/GPOS.py to GPOS.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/NSEC3PARAM.py to NSEC3PARAM.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/SSHFP.py to SSHFP.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/HINFO.py to HINFO.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/NS.py to NS.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/NSEC3.py to NSEC3.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/DNSKEY.py to DNSKEY.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/ANY/TXT.py to TXT.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/txtbase.py to txtbase.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/mxbase.py to mxbase.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/nsbase.py to nsbase.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN/A.py to A.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN/NSAP_PTR.py to NSAP_PTR.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN/WKS.py to WKS.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN/PX.py to PX.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN/NAPTR.py to NAPTR.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN/AAAA.py to AAAA.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN/KX.py to KX.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN/NSAP.py to NSAP.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN/APL.py to APL.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN/DHCID.py to DHCID.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN/IPSECKEY.py to IPSECKEY.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/IN/SRV.py to SRV.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/dsbase.py to dsbase.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdtypes/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/resolver.py to resolver.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/tokenizer.py to tokenizer.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/reversename.py to reversename.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rcode.py to rcode.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/ipv4.py to ipv4.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/edns.py to edns.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/dnssec.py to dnssec.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/tsigkeyring.py to tsigkeyring.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rrset.py to rrset.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/wiredata.py to wiredata.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/opcode.py to opcode.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/update.py to update.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/zone.py to zone.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdatatype.py to rdatatype.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/version.py to version.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/tsig.py to tsig.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/exception.py to exception.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/message.py to message.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/ipv6.py to ipv6.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/e164.py to e164.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/query.py to query.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/flags.py to flags.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdata.py to rdata.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/grange.py to grange.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/dns/rdataclass.py to rdataclass.pyc
running install_egg_info
Writing /usr/local/lib/python2.7/dist-packages/dnspython-1.11.1.egg-info

继续安装PyXMPP
chenwei@sysop:~/pyxmpp-1.1.2$ python configure.py
Checking for python version... 2.7.3 (default, Sep 26 2013, 20:03:06)  [GCC 4.6.3]
Checking for dnspython... version 1.11.1 found
Checking for libxml2 python bindings... not found
ERROR: You need libxml2 python bindings for PyXMPP

还是报错,这次缺少了libxml2包,我现在找回pyXMPP的安装文档看下还需要什么包,再一次过来整,这样子一步步来效率明显不行。

以下是安装文档说明:

For PyXMPP you will need:
 - `Python <`__. Python 2.6 required.
  - `libxml2 <`__. Recent release (>=2.6.11) with python
    bindings is required. Additionally, all development files for libxml2 (usually in
    separate libxml2-devel package) are recommended for compilation of PyXMPP for best performance.
    PyXMPP 1.0 was tested with libxml2-2.7.6.
  - `dnspython <`__. 
    PyXMPP 1.0 was tested with version 1.6.0.

就是剩下这个包了。

安装完毕测试正常。

脚本测试正常后,要在zabbix上配置media,新建一个gtalk的报警项目,再添加到action。

脚本保存,根据zabbix-server的配置文件存在。


阅读(1207) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~