Giter Club home page Giter Club logo

zabbixpythonapi's People

Contributors

mrlyc avatar pengyao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zabbixpythonapi's Issues

python2.6环境下的问题

如果python环境是2.6的话,会出现下面的提示

zapi.py:29: DeprecationWarning: object.__new__() takes no parameters
  cls._state[cls] = super(ZabbixAPI, cls).__new__(cls, *args, **kw)

然后会出现lastclock不按预期结果的问题,好多都是0

我的main方法如下:

if __name__ == "__main__":
    hostMap = {
                    "12077":"test1",
                    "12078":"test2",
           }
    zapi = ZabbixAPI(url='', user='', password='‘)
    if not zapi.is_login():
        zapi.login()
    itemData= zapi.Item.get(
                                     {
                                        "output": "extend",
                                        "hostids": hostMap.keys(),
                                        "webitems":True,
                                        "search": {
                                            "key_": "web.test.error"
                                        },
                                      }
                         )
    for i in itemData:
        print i

python2.7的话一切正常 :)

不是重要的问题,仅反馈一下

==========================分割线===============================
好像事情没那么简单,可能是我那台虚拟机的问题 😢

ZabbixAPI Err: The "user.login" method must be called without the "auth" parameter

Zabbix 2.4

ZabbixAPI Err: The "user.login" method must be called without the "auth" parameter

def json_obj(self, method, params):
    obj = { 'jsonrpc' : '2.0',
            'method'  : method,
            'params'  : params,
            'id'      : self.__id}
    ##### Zabbix 2.4 #####
    if self.isLogin():
        obj['auth'] = self.__auth
    ######################
    return json.dumps(obj)

Need better example of use

The example of use in the README.md doesn't work.

from zapi import ZabbixAPI
ZAPI = ZabbixAPI(url='http://localhost/zabbix', user=UNAME, password=PWORD)
ZAPI.login()

Traceback (most recent call last):
  File "zapi_example.py", line 8, in <module>
    ZAPI.login()
  File "./zapi.py", line 50, in login
    raise ZabbixAPIException(e)
zapi.ZabbixAPIException: The "user.login" method must be called without the "auth" parameter.

I'm not passing any parameters to the .login() method.

调试问题

我想调试这段代码,其中graphid:49931,hostids[16913,17411]这些指的是啥。?

Report some warning when create ZabbixAPI Object

# python -c "from zabbix.zapi import *;zapi=ZabbixAPI(url='http://your.zabbix.address', user='admin', password='zabbix')"

/usr/lib/python2.6/site-packages/zabbix/zapi.py:25: DeprecationWarning: object.__new__() takes no parameters
  cls._state[cls] = super(ZabbixAPI, cls).__new__(cls, *args, **kw)

OS: CentOS 6.4 X86_64
Python: 2.6.6

Example in README.md does not work

This is a follow-up to #5 which I can't reopen.
The example in README.md still does not work.

zapi.host.get({'hostids':[hostid],'output':'extend'})
Traceback (most recent call last):
  File "zapi_example.py", line 18, in <module>
    zapi.host.get({'hostids':[hostid],'output':'extend'})
  File "/root/zabbix_api/zapi.py", line 43, in __getattr__
    raise ZabbixAPIException('No such API object: %s' % name)
zapi.ZabbixAPIException: No such API object: host

print zapi.getHostByHostid(hostid)
Traceback (most recent call last):
  File "zapi_example.py", line 20, in <module>
    print zapi.getHostByHostid(hostid)
  File "/root/zabbix_api/zapi.py", line 43, in __getattr__
    raise ZabbixAPIException('No such API object: %s' % name)
zapi.ZabbixAPIException: No such API object: getHostByHostid

Using Python 2.7.6 and Zabbix 2.4.5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.