From 09ea945c3908fd42e90eb64c194d9af11d174206 Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Tue, 12 Apr 2016 18:01:32 +0200 Subject: Actual initial import Fetched from tgmanage. --- tools/add_switches.txt.pl | 17 +++++++++++++++++ tools/deplist.sh | 22 ++++++++++++++++++++++ tools/get_mibs.sh | 15 +++++++++++++++ 3 files changed, 54 insertions(+) create mode 100755 tools/add_switches.txt.pl create mode 100755 tools/deplist.sh create mode 100755 tools/get_mibs.sh (limited to 'tools') 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} -- cgit v1.2.3