aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rwxr-xr-xinclude/config.pm5
-rwxr-xr-xinclude/nms.pm12
2 files changed, 16 insertions, 1 deletions
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.