aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly@.no>2016-03-22 16:05:04 +0100
committerKristian Lyngstol <kly@kly@.no>2016-03-22 16:05:04 +0100
commit10271b0e95a424e191926a945fe785e9cce046c1 (patch)
tree9116f8c485fda55f02f20916d3db1c81fd8a7247
parent89c78bc9eab3b69fe31babe5e64f0343386f67be (diff)
NMS: Update schema to FAP
-rwxr-xr-xclients/ping.pl2
-rwxr-xr-xclients/snmpfetchng.pl4
-rwxr-xr-xweb/nms.gathering.org/api/public/switches2
-rwxr-xr-xweb/nms.gathering.org/api/read/switches-management3
-rwxr-xr-xweb/nms.gathering.org/api/write/switch-add2
-rwxr-xr-xweb/nms.gathering.org/api/write/switch-update3
6 files changed, 9 insertions, 7 deletions
diff --git a/clients/ping.pl b/clients/ping.pl
index 174342a..3f4139e 100755
--- a/clients/ping.pl
+++ b/clients/ping.pl
@@ -15,7 +15,7 @@ my $dbh = nms::db_connect();
$dbh->{AutoCommit} = 0;
$dbh->{RaiseError} = 1;
-my $q = $dbh->prepare("SELECT switch,host(ip) as ip,host(secondary_ip) as secondary_ip FROM switches WHERE ip is not null ORDER BY random()");
+my $q = $dbh->prepare("SELECT switch,host(mgmt_v4_addr) as ip,host(mgmt_v6_addr) as secondary_ip FROM switches WHERE mgmt_v4_addr is not null ORDER BY random()");
my $lq = $dbh->prepare("SELECT linknet,addr1,addr2 FROM linknets");
while (1) {
diff --git a/clients/snmpfetchng.pl b/clients/snmpfetchng.pl
index 36dd675..630347d 100755
--- a/clients/snmpfetchng.pl
+++ b/clients/snmpfetchng.pl
@@ -23,13 +23,13 @@ $dbh->{RaiseError} = 1;
my $qualification = <<"EOF";
(last_updated IS NULL OR now() - last_updated > poll_frequency)
AND (locked='f' OR now() - last_updated > '15 minutes'::interval)
-AND ip is not null
+AND mgmt_v4_addr is not null
EOF
# Borrowed from snmpfetch.pl
our $qswitch = $dbh->prepare(<<"EOF")
SELECT
- sysname,switch,host(ip) as ip,community,
+ sysname,switch,host(mgmt_v4_addr) as ip,community,
DATE_TRUNC('second', now() - last_updated - poll_frequency) AS overdue
FROM
switches
diff --git a/web/nms.gathering.org/api/public/switches b/web/nms.gathering.org/api/public/switches
index 7e7f10b..3aa8af8 100755
--- a/web/nms.gathering.org/api/public/switches
+++ b/web/nms.gathering.org/api/public/switches
@@ -12,7 +12,7 @@ use Data::Dumper;
$nms::web::cc{'max-age'} = "60";
-my $q2 = $nms::web::dbh->prepare('select switch,sysname,placement,ip,poll_frequency,community,last_updated from switches where placement is not null');
+my $q2 = $nms::web::dbh->prepare('select switch,sysname,placement,mgmt_v4_addr,mgmt_v6_addr,mgmt_v4_gw,mgmt_v4_netsize,mgmt_v6_gw,mgmt_v6_netsize,mgmt_vlan,traffic_vlan,last_config_fetch,current_mac,poll_frequency,community,last_updated,switchtype from switches where placement is not null');
$q2->execute();
while (my $ref = $q2->fetchrow_hashref()) {
diff --git a/web/nms.gathering.org/api/read/switches-management b/web/nms.gathering.org/api/read/switches-management
index b18c6cd..8235da7 100755
--- a/web/nms.gathering.org/api/read/switches-management
+++ b/web/nms.gathering.org/api/read/switches-management
@@ -12,7 +12,8 @@ use Data::Dumper;
$nms::web::cc{'max-age'} = "60";
-my $q2 = $nms::web::dbh->prepare('select sysname,ip,poll_frequency,subnet4,subnet6,distro,last_updated from switches ');
+#my $q2 = $nms::web::dbh->prepare('select sysname,ip,poll_frequency,subnet4,subnet6,distro,last_updated from switches ');
+my $q2 = $nms::web::dbh->prepare('select switch,sysname,mgmt_v4_addr,mgmt_v6_addr,mgmt_v4_gw,mgmt_v4_netsize,mgmt_v6_gw,mgmt_v6_netsize,mgmt_vlan,traffic_vlan,last_config_fetch,current_mac,poll_frequency,community,last_updated,switchtype from switches where placement is not null');
$q2->execute();
while (my $ref = $q2->fetchrow_hashref()) {
diff --git a/web/nms.gathering.org/api/write/switch-add b/web/nms.gathering.org/api/write/switch-add
index 48f62fc..411a76b 100755
--- a/web/nms.gathering.org/api/write/switch-add
+++ b/web/nms.gathering.org/api/write/switch-add
@@ -22,7 +22,7 @@ my @dups;
my $sth = $nms::web::dbh->prepare("SELECT sysname FROM switches WHERE sysname=?");
-my @fields = ('ip', 'sysname', 'last_updated', 'locked', 'poll_frequency', 'community', 'lldp_chassis_id', 'secondary_ip', 'subnet4', 'subnet6', 'placement', 'distro', 'secondary_ip');
+my @fields = ( 'community', 'current_mac', 'distro_name', 'distro_phy_port', 'lldp_chassis_id', 'mgmt_v4_addr', 'mgmt_v4_gw', 'mgmt_v4_netsize', 'mgmt_v6_addr', 'mgmt_v6_gw', 'mgmt_v6_netsize', 'mgmt_vlan', 'placement', 'poll_frequency', 'subnet4', 'subnet6', 'switchtype', 'sysname', 'traffic_vlan');
sub convertplace
{
diff --git a/web/nms.gathering.org/api/write/switch-update b/web/nms.gathering.org/api/write/switch-update
index 6507d2b..14c8773 100755
--- a/web/nms.gathering.org/api/write/switch-update
+++ b/web/nms.gathering.org/api/write/switch-update
@@ -22,7 +22,8 @@ my @dups;
my $sth = $nms::web::dbh->prepare("SELECT sysname FROM switches WHERE sysname=?");
-my @fields = ('ip', 'sysname', 'last_updated', 'locked', 'poll_frequency', 'community', 'lldp_chassis_id', 'secondary_ip', 'subnet4', 'subnet6', 'placement', 'distro', 'secondary_ip');
+
+my @fields = ( 'community', 'current_mac', 'distro_name', 'distro_phy_port', 'lldp_chassis_id', 'mgmt_v4_addr', 'mgmt_v4_gw', 'mgmt_v4_netsize', 'mgmt_v6_addr', 'mgmt_v6_gw', 'mgmt_v6_netsize', 'mgmt_vlan', 'placement', 'poll_frequency', 'subnet4', 'subnet6', 'switchtype', 'sysname', 'traffic_vlan');
sub convertplace
{