aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/add_switches.txt.pl17
-rwxr-xr-xtools/deplist.sh22
-rwxr-xr-xtools/get_mibs.sh15
3 files changed, 54 insertions, 0 deletions
diff --git a/tools/add_switches.txt.pl b/tools/add_switches.txt.pl
new file mode 100755
index 0000000..635e356
--- /dev/null
+++ b/tools/add_switches.txt.pl
@@ -0,0 +1,17 @@
+#!/usr/bin/perl
+# Usage: ./add_switches.txt.pl < switches.txt > switches.json
+#
+# Parses switches.txt into json currently just throws it to stdout
+#
+# Actually adding them to a DB comes later.
+
+use strict;
+use warnings;
+use Data::Dumper;
+use lib '../include';
+use JSON;
+use nms::util;
+
+my @switches = parse_switches_txt(*STDIN);
+
+print JSON::XS::encode_json(\@switches);
diff --git a/tools/deplist.sh b/tools/deplist.sh
new file mode 100755
index 0000000..cd2ecc0
--- /dev/null
+++ b/tools/deplist.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# Generate a dependency list for debian packages needed to work
+#
+# This is ... somewhat extensive. And a good incentive for people to clean
+# up their mess.
+
+(
+cat <<_EOF_
+use lib '../include';
+use lib '../web/streamlib';
+_EOF_
+find ../ -name '*pl' -exec egrep '^use ' {} \; | sort | uniq
+cat <<_EOF_
+foreach my \$key (keys %INC) {
+ if (\$INC{\$key} =~ m/^\./) {
+ next;
+ }
+ print \$INC{\$key} . "\n";
+}
+_EOF_
+) | perl 2>/dev/null | xargs realpath | xargs dpkg -S | awk '{print $1}' | sed 's/:$//' | sort | uniq
diff --git a/tools/get_mibs.sh b/tools/get_mibs.sh
new file mode 100755
index 0000000..7c8cc52
--- /dev/null
+++ b/tools/get_mibs.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+ORIGPWD=$PWD
+TMP=$(mktemp -d)
+set -x
+set -e
+cd $TMP
+wget ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
+tar xvzf v2.tar.gz --strip-components=2
+mkdir -p mibs
+
+cp v2/* mibs/
+mv mibs ${ORIGPWD}/
+cd ${ORIGPWD}
+rm -rf ${TMP}