Compare commits

..

No commits in common. "master" and "0.1.1" have entirely different histories.

3 changed files with 18 additions and 137 deletions

View File

@ -4,97 +4,8 @@
"tlsEnable": "false",
"topic": "snmp"
},
"interval": 60,
"interval": 10,
"snmpEndpoints": [
{
"endpoint": "172.16.13.10",
"label": "david",
"community": "public",
"oidTopics": [
{
"oid": ".1.3.6.1.4.1.2021.10.1.3.1",
"label": "load1",
"diff": "false"
},
{
"oid": ".1.3.6.1.2.1.31.1.1.1.6.2",
"label": "lan-in",
"diff": "true"
},
{
"oid": ".1.3.6.1.2.1.31.1.1.1.7.2",
"label": "lan-in-pkts",
"diff": "true"
},
{
"oid": ".1.3.6.1.2.1.31.1.1.1.10.2",
"label": "lan-out",
"diff": "true"
},
{
"oid": ".1.3.6.1.2.1.31.1.1.1.11.2",
"label": "lan-out-pkts",
"diff": "true"
},
{
"oid": ".1.3.6.1.4.1.9676.1",
"label": "time-req-pkts",
"diff": "true"
}
]
},
{
"endpoint": "172.16.13.11",
"label": "harrison",
"community": "public",
"oidTopics": [
{
"oid": ".1.3.6.1.4.1.2021.10.1.3.1",
"label": "load1",
"diff": "false"
},
{
"oid": ".1.3.6.1.4.1.9676.123.1.4",
"label": "stratum",
"diff": "false"
},
{
"oid": ".1.3.6.1.4.1.9676.123.1.7",
"label": "rootdisp",
"diff": "false"
},
{
"oid": ".1.3.6.1.4.1.9676.123.2.3",
"label": "ss-reset",
"diff": "false"
},
{
"oid": ".1.3.6.1.4.1.9676.123.2.10",
"label": "processed-pkts",
"diff": "true"
},
{
"oid": ".1.3.6.1.2.1.31.1.1.1.6.2",
"label": "lan-in",
"diff": "true"
},
{
"oid": ".1.3.6.1.2.1.31.1.1.1.7.2",
"label": "lan-in-pkts",
"diff": "true"
},
{
"oid": ".1.3.6.1.2.1.31.1.1.1.10.2",
"label": "lan-out",
"diff": "true"
},
{
"oid": ".1.3.6.1.2.1.31.1.1.1.11.2",
"label": "lan-out-pkts",
"diff": "true"
}
]
},
{
"endpoint": "172.16.3.1",
"label": "router",
@ -111,6 +22,23 @@
"diff": "true"
}
]
},
{
"endpoint": "172.16.3.3",
"label": "switch-cluster",
"community": "public",
"oidTopics": [
{
"oid": ".1.3.6.1.2.1.31.1.1.1.6.1",
"label": "uplink-in",
"diff": "true"
},
{
"oid": ".1.3.6.1.2.1.31.1.1.1.10.1",
"label": "uplink-out",
"diff": "true"
}
]
}
]
}

View File

@ -19,7 +19,6 @@ type variable_t struct {
Variable string `json:"variable"`
Value string `json:"value"`
Unit string `json:"unit"`
Status string `json:"status"`
}
type message_t struct {
@ -133,7 +132,6 @@ func Start() {
Variable: oidTopic.OID,
Value: convertedValue,
Unit: "",
Status: "",
}
message.Variables[oidTopic.Label] = v

View File

@ -1,45 +0,0 @@
#!/bin/bash
COMMUNITY=""
HOST=""
BASE_OID=""
while getopts "c:h:b:" option; do
case $option in
c) COMMUNITY=$OPTARG
;;
h) HOST=$OPTARG
;;
b) BASE_OID=$OPTARG
;;
?)
echo "Usage $0 -c COMMUNITY -h HOST -b BASE_OID"
exit 1
;;
esac
done
if [ "$COMMUNITY" = "" ]; then
echo "Set a community using -c"
exit 1
fi
if [ "$HOST" = "" ]; then
echo "Set a host using -h"
exit 1
fi
if [ "$BASE_OID" = "" ]; then
echo "Set a base oid using -b"
exit 1
fi
snmpwalk -v 2c -c $COMMUNITY -On $HOST $BASE_OID | while read -r line; do
oid=`echo $line | awk '{print $1}'`
textoid=`snmptranslate $oid`
value=`echo $line | cut -d ' ' -f 3-`
echo "$oid ($textoid): $value"
done