Shinken module for exporting data to an InfluxDB server
The module requires the following:
- InfluxDB >= 0.9.0
- Shinken >= 2.4
- influxdb-python >= 2.0.1
Shinken module for exporting data to InfluxDB
License: GNU Affero General Public License v3.0
Metric name in the perfdata may include space character if you have some metrics as of : 'Pages printed'=15c
It should be interesting to remove all the space characters before storing the metric name in Influx ?
when shinken sends an event to influxdb I always get the error message 'unbalanced quotes'
[1438808575] ERROR: [broker-master] [influxdb broker] 400: unable to parse 'EVENT,event_type=NOTIFICATION,host_name=host1,service_description=_self_ contact="admin",notification_method="notify-host-by email",notification_type="HOST",output="Host down': unbalanced quotes
[1438808575] ERROR: [broker-master] [influxdb broker] Sending data Failed. Buffering state : 11 / 300
any idea why ? I can see output doesn't have the right quotes, but I can't find in the code what would do that. I tried something like output="{}".format(data['output']) but no luck.
Hello,
Could you release last version (after commit 03c1051
) to shinken modules for get ability install module by shinken cli.
Thanks.
Hi,
I'm not sure to completly understading what is happen to me but, maybe is not my fault.
In my InfluxDB, every entry is the DB got a date like this "1970-01-01T00:00:01.447302965Z"
Is this normal ? I've skipped something?
Thanks !
As explained between us and confirmed by influxdb people :
we should also use the check_command in the serie names we use to store the check metrics results.
So the serie name scheme becomes :
"metric_%s_%s" % (command_name, metric_name)
It would be really usefull if you can define a prefix (optional) at plugin configuration: prefix.host.service. It would fit better when you store data from different broker sources (the prefix would be the id of the site/implementation/area/realm etc.).
Please merge service alerts
and host alerts
Also be aware of www.cibc.com must be www_cibc_com
Hello,
How can i configure mod-influxdb for send only event message to influx without perfdata?
Thank you.
Shinken/influxdb/grafana newbie here.
I'm trying to get the combo to work but noticed that data ingested into influxdb have timestamps in seconds instead of nanoseconds and it's probably the reason I couldn't get grafana to plot anything useful for the metric_* series.
Running:
Module v1.0 from shinken.io
[1426316628] WARNING: [Shinken] Bad module file for /var/lib/shinken/modules/mod-influxdb/module.py : cannot check its properties['daemons'] attribute : 'module' object has no attribute 'properties'
[1426316628] WARNING: [Shinken] The module type influxdb-perfdata for influxdb was not found in modules!
Hi,
The module doesn't work with stable shinken (2.0.3) because the module shinken/misc/logevent.py is not present on the system:
https://github.com/savoirfairelinux/mod-influxdb/blob/master/module/module.py#L37
https://github.com/naparuba/shinken/tree/2.0.3/shinken/misc
The problem is that the shinken.io version of the module is also affected. So there is no stable influxdb module suitable if you want to work with the stable version of shinken.
In scheduler.log:
[1461664767] PASSIVE SERVICE CHECK: host1;service1;2;message
[1461664769] SERVICE ALERT: host1;service1;CRITICAL;HARD;1;message
In influxdb:
name: EVENT
-----------
time attempts event_type host_name output service_description state state_type alert_type
1461664767000000000 ALERT host1 message log_event CRITICAL HARD
1461664769000000000 1 ALERT host1 message\n log_event CRITICAL HARD SERVICE
Hi,
While playing around with InfluxDB and mod-influxdb to fill it with data from Shinken I've encountered a problem when filling it with ping data.
As you may or may not know, the type of a field in InfluxDB is defined by the first value written to it. (source) And this is where the problems start, because there is no standardized way that mod-influxdb writes data to the database, it's possible to get conflicts. In my case there are a bunch of hosts that are unreachable and thus the ping plugin (check_ping from nagios-plugins) returns a big number, which sets the field type to int64. Now my next host is actually online and returns a float. (24.78ms for example) When it tries to write this data, it gives a field type conflict.
I've come up with an ugly hack to work around this, but because testing of this hack is very limited, I have no idea if it will conflict with other nagios plugins.
In module.py at line 105 replace the for in statement with this one:
for mapping in fields_mappings:
if 'value' in mapping:
value = float(getattr(e, mapping[0], None))
else:
value = getattr(e, mapping[0], None)
if value is not None:
if 'value' in mapping:
fields[mapping[1]] = float(value)
else:
fields[mapping[1]] = value
What this does is check if the data that's about to be written is going to be written to the field "value". If it is, it makes the value a float.
I don't think this is a permanent fix for this problem, feel free to suggest something that would work better! (hopefully more compatible too)
Given that we store the metrics from the check commands directly in influx, in a serie whose name is exactly the one of the metric :
this normally prohibits us from using any other serie name for anything else because there is no restriction on a metric name (which would be a pity) (as far as it's a valid identifier eventually ?)
but we already need the "ALERT" serie to store the hosts & services state changes so we have a problem houston.
If we prefix every serie corresponding to a metric by say "metric_" then problem is gone.
Hello,
I'm testing your module with a fresh install of shinken. I have set only one host on my shinken for test purpose. After configuration of your plugins, how to check if it's works ?
I have set process_perfdata on shinken config, added the module on broker.conf, and then, no logging information on broker.log (execpt this : Correctly loaded mod-influxdb as a very-new-style shinken module :) )
Next, i can't see any data on influxdb (with a tcpdump or a query).
Do you have any method to check if all is fine ?
Thanks in advance, and thanks for your module !
Regards.
I had a problem after a bad restart of my Shinken and as a side effect I got many exceptions in the module :
[1432292887] WARNING: [broker-master] Back trace of this kill: Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/Shinken-2.4_rc4-py2.7.egg/shinken/daemons/brokerdaemon.py", line 276, in manage_brok
mod.manage_brok(b)
File "/usr/local/lib/python2.7/site-packages/Shinken-2.4_rc4-py2.7.egg/shinken/basemodule.py", line 243, in manage_brok
return manage(brok)
File "/usr/local/libexec/shinken/modules/mod-influxdb/module.py", line 215, in manage_host_check_result_brok
"address": self.host_config[host_name]['address'],
KeyError: u'lachassagne'
Is it possible to add custom influxdb tags for shinken service's series ?
Maybe a predefined field of service configuration can be used to do this ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.