LibreNMS working with InfluxDB

#1

I have been working to get LibreNMS set up with InfluxDB. I have created the DB in Influx and added the configs to config.php and validate.php does not show any errors. I have looked at the SERIES in the Influx DB librenms databse and I see that there something there but there isn’t any data associated with the series info.

When I debug the connection between LibreNMS and Influx I see the following error:

15:25:59.723808 IP (tos 0x0, ttl 64, id 57462, offset 0, flags [DF], proto TCP (6), length 52)
localhost.8086 > localhost.37620: Flags [F.], cksum 0xfe28 (incorrect -> 0x1937), seq 111586, ack 236829, win 6721, options [nop,nop,TS val 135066 ecr 135066], length 0
15:25:59.723824 IP (tos 0x0, ttl 64, id 38492, offset 0, flags [DF], proto TCP (6), length 52)
localhost.37620 > localhost.8086: Flags [.], cksum 0xfe28 (incorrect -> 0x2770), seq 236829, ack 111587, win 3080, options [nop,nop,TS val 135066 ecr 135066], length 0

When I look at the PCAP file I would expect to see a POST that contains data that looks like POST cpu,host=serverA,region=us_west value=0.64… But I just see Data: 706f6c6 etc.

I am not an Influx or LibreNMS guru so any help to figure this out would be greatly appreciated.

Thank you.

-Patrick

#2

@papatango71 While I am an InfluxDB guru I am not a LibreNMS guru. Can you share the full POST request that is getting set to InfluxDB? I will also say that that error message is coming out of LibreNMS not InfluxDB.

I also found this post on their forum that might help.

#3

Here is my config.php config for influxdb:

Added for InfluxDB

$config[‘influxdb’][‘enable’] = true;
$config[‘influxdb’][‘transport’] = ‘http’; # Default, other options: https, udp
$config[‘influxdb’][‘host’] = ‘127.0.0.1’;
$config[‘influxdb’][‘port’] = ‘8086’;
$config[‘influxdb’][‘db’] = ‘librenms’;

$config[‘influxdb’][‘username’] = ‘admin’;

$config[‘influxdb’][‘password’] = ‘admin’;

$config[‘influxdb’][‘timeout’] = 0; # Optional
$config[‘influxdb’][‘verifySSL’] = false; # Optional

I am not using any authentication at this point… i am just confirming this works. I went through the post you recommended and I have done everything that is listed there. Where would I get the full POST request that is being sent to InfluxDB…?? The POST that I see in my pcap is as follows:

POST /write?db=librenms&precision=m HTTP/1.1\r\n

Thank you.

-Patrick

#4

@papatango71 Are you seeing any errors in the influxdb logs? /var/log/influxdb/influxdb.log or journalctl -u influxdb

#5

Seeing the following errors using journalctl -u influxdb:

Jun 07 15:45:25 librenms influxd[1213]: [httpd] 127.0.0.1 - - [07/Jun/2017:15:45:25 +0000] “POST /write?db=librenms&precision=n HTTP/1.1” 204 0 “-” “GuzzleHttp/6.0.2 curl/7.47.0 PHP/7.0.18-0ubuntu0.16.04.1” 52f94a39-4b98-11e7-92d1-000000000000
Jun 07 15:45:25 librenms influxd[1213]: [httpd] 127.0.0.1 - - [07/Jun/2017:15:45:25 +0000] “POST /write?db=librenms&precision=n HTTP/1.1” 204 0 “-” “GuzzleHttp/6.0.2 curl/7.47.0 PHP/7.0.18-0ubuntu0.16.04.1” 52fa0ff0-4b98-11e7-92d2-000000000000
Jun 07 15:45:25 librenms influxd[1213]: [httpd] 127.0.0.1 - - [07/Jun/2017:15:45:25 +0000] “POST /write?db=librenms&precision=n HTTP/1.1” 204 0 “-” “GuzzleHttp/6.0.2 curl/7.47.0 PHP/7.0.18-0ubuntu0.16.04.1” 52fad41c-4b98-11e7-92d3-000000000000
Jun 07 15:45:25 librenms influxd[1213]: [httpd] 127.0.0.1 - - [07/Jun/2017:15:45:25 +0000] “POST /write?db=librenms&precision=n HTTP/1.1” 204 0 “-” “GuzzleHttp/6.0.2 curl/7.47.0 PHP/7.0.18-0ubuntu0.16.04.1” 52fb95b5-4b98-11e7-92d4-000000000000
Jun 07 15:45:25 librenms influxd[1213]: [httpd] 127.0.0.1 - - [07/Jun/2017:15:45:25 +0000] “POST /write?db=librenms&precision=n HTTP/1.1” 204 0 “-” “GuzzleHttp/6.0.2 curl/7.47.0 PHP/7.0.18-0ubuntu0.16.04.1” 52fc72ab-4b98-11e7-92d5-000000000000
Jun 07 15:45:25 librenms influxd[1213]: [httpd] 127.0.0.1 - - [07/Jun/2017:15:45:25 +0000] “POST /write?db=librenms&precision=n HTTP/1.1” 204 0 “-” “GuzzleHttp/6.0.2 curl/7.47.0 PHP/7.0.18-0ubuntu0.16.04.1” 52fd3806-4b98-11e7-92d6-000000000000

There isn’t anything being logged in /var/log/influxdb.

-Patrick

#6

@papatango71The 204 indicates successful writes. Are you seeing data in InfluxDB?

$ influx
> use librenms
> show measurements
#7

root@librenms:/opt/librenms# influx
Connected to http://localhost:8086 version 1.2.4
InfluxDB shell version: 1.2.4

use librenms
Using database librenms
show measurements
name: measurements
name


bgp
cbgp
cefswitching
cipsec_flow
fortigate_cpu
fortigate_sessions
hr_processes
hr_users
ipSystemStats
ipsectunnel
mempool
netstats-icmp
netstats-ip
netstats-ip_forward
netstats-snmp
netstats-tcp
netstats-udp
ntp
ospf-statistics
ping-perf
poller-perf
ports
processors
sensor
sla
storage
ucd_cpu
ucd_load
ucd_mem
uptime

When I connect with grafana and look for the data I am not seeing anything.

#8

It looks like the data is getting there. Are you connected to the right database in Grafana?

#9

I have a basic query written in grafana and I am not seeing any data. i would assume that even without any math to change this from octets to bits I should still see something in the graph…

#10

Connecting to librenms without issues…

#11

Have you tried running the same query in the influx cli?

#12

I have not… I will give that a try… I am a newb at Influx so this may take me a few times to get this correct… :slight_smile:

1 Like
#13

It does look like the data is making it into Influx… Dumb question… What measurements holds the interface bandwidth statistics…?? I looked under port but that does not look to be correct… Any help would be greatly appreciated.

Thank you.

#14

I am getting close… I am able to get data pulled from the ports section in regards to bandwidth measurements:

select INOCTETS from ports where hostname=‘pr01.xxx.xxx’ and ifName=‘Bundle-Ether20’ limit 10
name: ports
time INOCTETS


1496849123860976425 7.6012331215949e+14
1496849419356264131 7.6013245585627e+14
1496849725987836120 7.6014099246521e+14
1496850026394534483 7.6015981561484e+14
1496850325443260816 7.6016875240205e+14
1496850627268916599 7.6017653085436e+14
1496850923191686220 7.6018537147324e+14
1496851229178957782 7.6019686444285e+14
1496851527558451467 7.6021006722896e+14
1496851830822554692 7.6022312604583e+14

When I try and graph this out in Grafana it looks pretty funky. I have selected bits/sec for the Axes. Below is the image that shows the queries for INOCTETS & OUTOCTETS. Any help to figure this out would be greatly appreciated.

#15

@papatango71 I don’t know what your traffic patterns look like so I don’t really know what funky looks like. That looks like there is a dip at night which I would assume is expected.

#16

Sorry… I should have been clear. I am trying to convert this from octets to bits/second but it is now showing up correctly. I am not sure if my math is incorrect or if I am missing an equation some where…

-Patrick

#17

Have you tried SELECT INOCTETS / 8 as bits FROM ports WHERE hostname = 'foo' and ifName = 'bar' LIMIT 10?

#18

Updated the query with the correct hostname, etc. and it is working.

SELECT INOCTETS / 8 as bits FROM ports WHERE hostname = ‘pr01.xx.xx.net’ and ifName = ‘Bundle-Ether20’ limit 10;
name: ports
time bits


1496849123860976425 9.501541401993625e+13
1496849419356264131 9.501655698203375e+13
1496849725987836120 9.501762405815125e+13
1496850026394534483 9.5019976951855e+13
1496850325443260816 9.502109405025625e+13
1496850627268916599 9.5022066356795e+13
1496850923191686220 9.5023171434155e+13
1496851229178957782 9.502460805535625e+13
1496851527558451467 9.502625840362e+13
1496851830822554692 9.502789075572875e+13

When I try and run the query that is built in Grafana on Influx I get the following error:

SELECT mean(“INOCTETS”) FROM “ports” WHERE “hostname” = ‘pr01.xxx.xx.net’ AND “ifName” = ‘Bundle-Ether20’ AND $timeFilter GROUP BY time($__interval) fill(null) limit 10;
ERR: error parsing query: missing parameter: timeFilter

#19

@papatango71 It seems your initial issue has been long since solved. Is this a seperate issue? Also this seems like a Grafana question.