From eabcf10ede6f9eee77b85f537cef023f89111f9d Mon Sep 17 00:00:00 2001 From: "Ole Mathias Aa. Heggem" Date: Sun, 5 Nov 2017 23:33:04 +0100 Subject: influx/chart and ansible --- include/config.pm | 5 +++++ include/nms.pm | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/config.pm b/include/config.pm index a45caf9..624770a 100755 --- a/include/config.pm +++ b/include/config.pm @@ -11,6 +11,11 @@ our $db_password = "risbrod"; our $graphite_host = "graphite"; our $graphite_port = "2003"; +# Influx +our $influx_host = "http://localhost:8086"; +our $influx_username = "admin"; +our $influx_password = "admin"; + # Max SNMP polls to fire off at the same time. our $snmp_max = 20; diff --git a/include/nms.pm b/include/nms.pm index 3133042..ce304d8 100755 --- a/include/nms.pm +++ b/include/nms.pm @@ -5,6 +5,7 @@ use DBI; use Data::Dumper; use FileHandle; use JSON; +use AnyEvent::InfluxDB; package nms; use base 'Exporter'; @@ -26,7 +27,16 @@ sub db_connect { $nms::config::db_username, $nms::config::db_password, {AutoCommit => 0}) or die "Couldn't connect to database"; - return $dbh; + return $dbh; +} + +sub influx_connect { + my $ix = AnyEvent::InfluxDB->new( + server => $nms::config::influx_host, + username => $nms::config::influx_username, + password => $nms::config::influx_password, + ) or die "Couldn't connect to InfluxDB"; + return $ix; } # A few utilities to convert from SNMP binary address format to human-readable. -- cgit v1.2.3