Coder Social home page Coder Social logo

ludolph's People

Contributors

dn0 avatar ricco386 avatar xen0l 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ludolph's Issues

MUC settings

Add more MUC settings

  • room_users - will affect room member list
  • room_admins - will set affiliation
  • add support for @users, @admins keywords in settings file

Add user to roster

Add ability to tell Ludolph to add user to his roster list. Only admin should be able to add users.

Case sensitive commands

Currently commands are case sensitive, but on android mobile clients by default starts with capital letter which results in Ludolph not recognizing the command.

I think to improve UX commands should not be case sensitive:

  • to have 2 commands with same name is confusing
  • always press shift before command type on mobile is annoying

plugins version support

Add ability for version command to support parameter for plugin name and return plugin version number so 3rd party plugins doesnt have to implement version command and can used built in one.

Broadcast message

Add ability for admin, that he can send broadcast message to all users in Ludolph roster.

Add support for Windows

With small changes and some testing we should be able to support Windows operating system.
Known problems:

  • Windows does not support SIGHUP
  • KeyboardInterrupt may not work as expected

Separate muc command into separate plugin

Separate muc command into separate MUC plugin. Keep this plugin as a part of ludolph base plugins, just have it in separate file as this has potential to grow....

Zabbix plugin and graph support

Zabbix plugin should support obtaining graphs via Zabbix API. It should have the following synopsis:

graph <hostgroup/host> [@period]

keyword is a regular expression or pattern, which matches the graph for specific host/hostgroup.
period represents time period, e.g 1h will show data for the last hour.

Some interesting URLs:
https://www.zabbix.com/documentation/2.2/manual/api/reference/graph/get
https://github.com/sorah/hubot-zabbix/blob/master/scripts/hubot-zabbix.coffee

ack: allow processing multiple event IDs

At the moment, ack will process only one event ID at the time. ack should allow us to enter multiple event IDs (ack 87336 87337 will process alerts with ID 87336 and 873367) and should also support globbing, e.g 8736* for all events ID 8733*.

Reload command

Ludolph should support reload command, which will restart him. Optionally, this could be combined with upgrade. The implementation should be simple:

  1. Ludolph receives reload command and correctly exits
  2. Serverside component will detect it and bring him up. This can be any service manager (monit, systemd, SMF etc)
  3. Before starting ludolph, the startup script should try to update Ludolph's source code

Enabling PID in config does not create file

Setting path to PID file in config without running in daemon mode does not create PID file.

# PID file location. Required in daemon mode
pidfile = /run/ludolph/ludolph.pid

uptime command doesnt works in python3

ERROR sleekxmpp.xmlstream.xmlstream: Error processing event handler: <bound method LudolphBot.message of <main.LudolphBot object at 0xa4fb1cc>>
Traceback (most recent call last):
File "/home/rkellner/Projects/Ludolph/envs3/lib/python3.2/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1659, in _event_runner
func(*args)
File "bot.py", line 163, in message
return f(msg)
File "/home/rkellner/Projects/Ludolph/envs3/lib/python3.2/site-packages/ludolph-0.3.0-py3.2.egg/ludolph/command.py", line 44, in wrap
return msg.reply(out).send()
File "/home/rkellner/Projects/Ludolph/envs3/lib/python3.2/site-packages/sleekxmpp/xmlstream/stanzabase.py", line 1575, in send
self.stream.send(self, now=now)
File "/home/rkellner/Projects/Ludolph/envs3/lib/python3.2/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1240, in send
top_level=True)
File "/home/rkellner/Projects/Ludolph/envs3/lib/python3.2/site-packages/sleekxmpp/xmlstream/tostring.py", line 113, in tostring
output.append(tostring(child, tag_xmlns, stream))
File "/home/rkellner/Projects/Ludolph/envs3/lib/python3.2/site-packages/sleekxmpp/xmlstream/tostring.py", line 110, in tostring
output.append(escape(xml.text, use_cdata))
File "/home/rkellner/Projects/Ludolph/envs3/lib/python3.2/site-packages/sleekxmpp/xmlstream/tostring.py", line 147, in escape
return ''.join(text)
TypeError: sequence item 0: expected str instance, int found

Problems listing alerts after upgrade of zabbix to 2.2

The following traceback is returned:

Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1601, in _threaded_event_wrapper
    func(*args)
  File "/usr/lib/python2.6/site-packages/ludolph/bot.py", line 412, in message
    out = f_cmd(msg)
  File "/usr/lib/python2.6/site-packages/ludolph/plugins/zabbix.py", line 41, in wrap
    return fun(obj, msg, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/ludolph/command.py", line 81, in wrap
    out = fun(obj, msg, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/ludolph/plugins/zabbix.py", line 183, in alerts
    if trigger['error'] or int(trigger['value_flags']):
KeyError: 'value_flags'

Ludolph sometimes disconnects himself from the xmpp server

This happens to me once in a while, resulting in disconnect of the bot from the xmpp server. Bot has to be restarted manually then.

sep 29 18:02:11 mon ludolph[11243]: 2017-09-29 18:02:11,670 INFO     sleekxmpp.xmlstream.xmlstream: Waiting for </stream:stream> from server
sep 29 18:02:17 mon ludolph[11243]: 2017-09-29 18:02:17,758 ERROR    sleekxmpp.xmlstream.xmlstream: Could not connect to ----omitted----. Socket Error #111: Connection refused
sep 29 18:02:29 mon ludolph[11243]: 2017-09-29 18:02:29,414 INFO     sleekxmpp.xmlstream.xmlstream: Negotiating TLS
sep 29 18:02:29 mon ludolph[11243]: 2017-09-29 18:02:29,414 INFO     sleekxmpp.xmlstream.xmlstream: Using SSL version: TLS 1.0
sep 29 18:02:29 mon ludolph[11243]: 2017-09-29 18:02:29,485 WARNING  sleekxmpp.xmlstream.cert: Could not find pyasn1 and pyasn1_modules. SSL certificate COULD NOT BE VERIFIED.
sep 29 18:02:29 mon ludolph[11243]: 2017-09-29 18:02:29,662 INFO     sleekxmpp.features.feature_bind.bind: JID set to: ludolph@----omitted----
sep 29 18:02:29 mon ludolph[11243]: 2017-09-29 18:02:29,671 WARNING  sleekxmpp.xmlstream.cert: Could not find pyasn1 and pyasn1_modules. SSL certificate expiration COULD NOT BE VERIFIED.
sep 29 18:02:59 mon ludolph[11243]: 2017-09-29 18:02:59,681 WARNING  sleekxmpp.xmlstream.handler.waiter: Timed out waiting for IqWait_ff00ec05-153b-47af-a778-ff8da3ba834c-22
sep 29 18:03:29 mon ludolph[11243]: 2017-09-29 18:03:29,695 WARNING  sleekxmpp.xmlstream.handler.waiter: Timed out waiting for IqWait_ff00ec05-153b-47af-a778-ff8da3ba834c-23
sep 29 18:03:29 mon ludolph[11243]: 2017-09-29 18:03:29,696 ERROR    sleekxmpp.xmlstream.xmlstream: Error processing event handler: <bound method LudolphBot._session_start of <ludolph.bot.LudolphBot object at
sep 29 18:03:29 mon ludolph[11243]: Traceback (most recent call last):
sep 29 18:03:29 mon ludolph[11243]: File "/usr/lib/python2.7/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1708, in _event_runner
sep 29 18:03:29 mon ludolph[11243]: func(*args)
sep 29 18:03:29 mon ludolph[11243]: File "/usr/lib/python2.7/site-packages/ludolph/bot.py", line 795, in _session_start
sep 29 18:03:29 mon  ludolph[11243]: self.client.get_roster()
sep 29 18:03:29 mon  ludolph[11243]: File "/usr/lib/python2.7/site-packages/sleekxmpp/clientxmpp.py", line 263, in get_roster
sep 29 18:03:29 mon  ludolph[11243]: response = iq.send(block, timeout, callback)
sep 29 18:03:29 mon ludolph[11243]: File "/usr/lib/python2.7/site-packages/sleekxmpp/stanza/iq.py", line 233, in send
sep 29 18:03:29 mon ludolph[11243]: raise IqTimeout(self)
sep 29 18:03:29 mon  ludolph[11243]: IqTimeout
sep 29 18:03:29 mon  ludolph[11243]: 2017-09-29 18:03:29,697 ERROR    sleekxmpp.basexmpp: Request timed out: <iq type="get" id="ff00ec05-153b-47af-a778-ff8da3ba834c-23"><query xmlns="jabber:iq:roster" /></iq>
sep 29 18:03:29 mon  ludolph[11243]: 2017-09-29 18:03:29,698 WARNING  sleekxmpp.basexmpp: You should catch IqTimeout exceptions

'LudolphBot' object has no attribute 'abort'

CRITICAL ludolph.bot: Unhandled exception!
Traceback (most recent call last):
File "./bin/ludolph", line 10, in
ludolph.bot.main()
File "/home/rkellner/Projects/Ludolph/ludolph/bot.py", line 456, in main
if xmpp.connect(tuple(address), use_tls=use_tls, use_ssl=use_ssl):
File "/usr/lib/python2.7/site-packages/sleekxmpp/clientxmpp.py", line 159, in connect
reattempt=reattempt)
File "/usr/lib/python2.7/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 432, in connect
func=self._connect)
File "/usr/lib/python2.7/site-packages/sleekxmpp/thirdparty/statemachine.py", line 69, in transition
func=func, args=args, kwargs=kwargs)
File "/usr/lib/python2.7/site-packages/sleekxmpp/thirdparty/statemachine.py", line 107, in transition_any
return_val = func(_args,__kwargs) if func is not None else True
File "/usr/lib/python2.7/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 519, in _connect
self.socket.connect(self.address)
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(_args)
File "/home/rkellner/Projects/Ludolph/ludolph/bot.py", line 175, in shutdown
return self.abort()
AttributeError: 'LudolphBot' object has no attribute 'abort'

Remind command does not list scheduled jobs

I have setup an standard reminder, that works and also executes fine. However when trying to list existing reminders it doesnt works:

(10:47:46) Richard: remind add +1 test
(10:47:46) dunajko:  Scheduled job ID 2 scheduled at 2017-02-15T10:48:00 
(10:47:54) Richard: remind
(10:47:54) dunajko:  0 jobs are scheduled 

Remind command

Create remind command that will send message at specified time.

Colorful messages

Explore possibilities of colorful messages in XMPP

Tabulate is great, but works only with monospaced fonts. Adding colors to some messages (especially zabbix commands output) would improve readability and maybe we could get rid of tabulate (#5).

Outage should support more hosts

At the moment, we can set outage only on one host or host group. It should be possible to set outage on multiple hosts in one command, e.g "outage HostA HostB HostD 60".

"at" command

Implement at command, using the internal cron thread. It should work like the classic unix at command.

Maximum character limit overflow

Maximum character limit of Zabbix API actions is limited to 128. This should be fixed somehow.

How to reproduce:

  1. run outage a 60

and it should output something like this:
ERROR: Zabbix API error ((u'Error -32500: Application error., Value "'Maintenance for _XXXX - 1398111039'" is too long for field "name" - 194 characters. Allowed length is 128 characters. while sending {"params": {"maintenance_type": 0, "description": "[email protected]", "timeperiods": [{"timeperiod_type": 0, "start_date": "1398111039", "period": 3600}], "active_till": "1398114639", "active_since": "1398111039", "hostids": ["10355", "10449", "10451", "10452"], "name": "Maintenance for XXXX - 1398111039"}, "jsonrpc": "2.0", "method": "maintenance.create", "auth": "***", "id": 74}', -32500))

Create new "commands" plugin

The commands plugin will make it possible to create new commands associated with OS commands/scripts only by editing ludolph's configuration file.

It will allow us to create an update command, thus it will surpass the issue #22.

zabbix 2.4 issues

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.

ERROR: Command failed due to internal programming error: 'NoneType' object has no attribute 'crontab'

Ludolph responds with an error when crontab is disabled and user is setting at command:

ERROR    ludolph.utils: 'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/Users/ricco/Erigones/Ludolph/ludolph/utils.py", line 49, in wrap
    return fun(*args, **kwargs)
  File "/Users/ricco/Erigones/Ludolph/ludolph/bot.py", line 199, in _db_load_item
    data = self.db.get(name, None)
AttributeError: 'NoneType' object has no attribute 'get

We shouldn't show at command in help when cron is not enabled, and when user executes it anyway tell him to contact admin to enable cron option.

When cron is enabled at command works fine.

Create RPM package

Create RPM package for the project and add it to the Fedora (possibly EPEL).

Switch from pipe file to socket

Switch from pipe file to socket

  • Add listen setting to configuration file and remove pipe_file
    • Depending on the listen config option use UNIX or INET socket
    • Rename the pipe_mode option to socket_mode and use it with UNIX socket
  • Update howtos in wiki

broadcast message send to Ludolph in infinite loop

When Ludolph receives command to broadcast message, he broacsat to everyone in the roster, eg. to himself as well... This causes to execute broadcasted message as command, Ludolph does not understad and send help, problem is that ludolph is communicating with himself which creates an infinite loop.

"outage" command

We should implement "outage" command, which will disable alerting of hosts I am doing maintenance on. This should be done via the Zabbix API.

SIGHUP config reload

Add support for configuration reloading (SIGHUP)

  • add init() method to LudolphBot and LudolphPlugin classes. Will be used for config loading and called on init and reload
  • add HUP signal support
  • add reload sub-command to init scripts

When user is in DND, Ludolph should postpone all alerts and reminders

Even though the alert is customizable in zabbix, sometimes user uses the Do not disturb status in the xmpp client. In this case, ludolph should not notify user.
A nice to have feature would be that the missed alerts and reminders will be shown after the person changes state from DND.

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.