aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rwxr-xr-xinclude/config.pm8
-rwxr-xr-xinclude/nms.pm12
2 files changed, 18 insertions, 2 deletions
diff --git a/include/config.pm b/include/config.pm
index a45caf9..9a881ed 100755
--- a/include/config.pm
+++ b/include/config.pm
@@ -5,12 +5,18 @@ package nms::config;
# DB
our $db_name = "nms";
-our $db_host = "db";
+our $db_host = "localhost";
our $db_username = "nms";
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";
+our $influx_database = "gondul";
+
# 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.