erigones / Ludolph

Python Jabber Bot
Other
40 stars 7 forks source link

zabbix 2.4 issues #26

Closed ricco386 closed 9 years ago

ricco386 commented 9 years ago

ALERTS works fine when none present, but with existing alert command fails:

2015-04-18 19:08:00,546 INFO     ludolph.plugins.zabbix_api: [1429384080.55-00013] Calling Zabbix API method "event.get"
2015-04-18 19:08:02,436 INFO     ludolph.plugins.zabbix_api: [1429384080.55-00014] Zabbix API method "event.get" finished in 1.89011 seconds
2015-04-18 19:08:02,448 ERROR    sleekxmpp.xmlstream.xmlstream: Error processing event handler: <bound method LudolphBot.message of <ludolph.bot.LudolphBot object at 0x2700e70>>
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 1645, in _threaded_event_wrapper
    func(*args)
  File "/usr/local/lib/python2.7/dist-packages/ludolph/bot.py", line 414, in message
    out = f_cmd(msg)
  File "/usr/local/lib/python2.7/dist-packages/ludolph/plugins/zabbix.py", line 40, in wrap
    return fun(obj, msg, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ludolph/command.py", line 82, in wrap
    out = fun(obj, msg, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ludolph/plugins/zabbix.py", line 203, in alerts
    dt = self.zapi.get_datetime(trigger['lastchange'])
KeyError: 'lastchange'
2015-04-18 19:08:02,505 ERROR    sleekxmpp.stanza.rootstanza: Error handling {jabber:client}message stanza
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 1645, in _threaded_event_wrapper
    func(*args)
  File "/usr/local/lib/python2.7/dist-packages/ludolph/bot.py", line 414, in message
    out = f_cmd(msg)
  File "/usr/local/lib/python2.7/dist-packages/ludolph/plugins/zabbix.py", line 40, in wrap
    return fun(obj, msg, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ludolph/command.py", line 82, in wrap
    out = fun(obj, msg, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ludolph/plugins/zabbix.py", line 203, in alerts
    dt = self.zapi.get_datetime(trigger['lastchange'])
KeyError: 'lastchange'
2015-04-18 19:08:02,511 ERROR    sleekxmpp.basexmpp: 'lastchange'
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/sleekxmpp/xmlstream/xmlstream.py", line 1645, in _threaded_event_wrapper
    func(*args)
  File "/usr/local/lib/python2.7/dist-packages/ludolph/bot.py", line 414, in message
    out = f_cmd(msg)
  File "/usr/local/lib/python2.7/dist-packages/ludolph/plugins/zabbix.py", line 40, in wrap
    return fun(obj, msg, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ludolph/command.py", line 82, in wrap
    out = fun(obj, msg, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ludolph/plugins/zabbix.py", line 203, in alerts
    dt = self.zapi.get_datetime(trigger['lastchange'])
KeyError: 'lastchange'

OUTAGE add command does not works, I am unabe to set outage:

R: outage add CASE TARS: ERROR: Integer required R: outage add 192.168.82.70 TARS: ERROR: Integer required R: outage add 10084 TARS: ERROR: Host/Group not found

Unfortunately there is no error in log. List outage works fine.

Since alerts is not working I am not able to test ack, other commands seems to work fine.

dn0 commented 9 years ago

The missing lastchange field should be fixed in commit 833ff5f.

The outage add command requires at least two parameters: host/group name or search string and duration in seconds.

ricco386 commented 9 years ago

Tested updated code and seems working fine