Added compatability discovery for older zabbix agents

This commit is contained in:
Eric Renfro 2013-07-16 16:58:32 -04:00
parent b49d28ecf3
commit 23897d552b
2 changed files with 54 additions and 0 deletions

24
scripts/fs-discovery Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/perl
$first = 1;
print "{\n";
print "\t\"data\":[\n\n";
for (`cat /proc/mounts`)
{
($fsname, $fstype) = m/\S+ (\S+) (\S+)/;
$fsname =~ s!/!\\/!g;
print "\t,\n" if not $first;
$first = 0;
print "\t{\n";
print "\t\t\"{#FSNAME}\":\"$fsname\",\n";
print "\t\t\"{#FSTYPE}\":\"$fstype\"\n";
print "\t}\n";
}
print "\n\t]\n";
print "}\n";

30
scripts/net-discovery Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
numDevices=0
for x in `/sbin/ifconfig | grep Link | awk '{print $1}' | sort | egrep -v 'inet6|lo'`
do
#MAC=$(/sbin/ifconfig $x | grep "Link" | egrep -v inet6\|lo | awk '{print $5}')
#IP=$(/sbin/ifconfig $x | grep "inet addr" | cut -d: -f2 | cut -d' ' -f1)
#SPEED=$(/sbin/ethtool $x 2>/dev/null | grep "Speed" | cut -d: -f2 | sed 's/^[ \t]*//')
#LINK=$(/sbin/ethtool $x 2>/dev/null | grep "Link detected" | cut -d: -f2 | sed 's/^[ \t]*//')
if [[ $numDevices -eq 0 ]]; then
echo "{"
echo " \"data\":["
fi
if [[ -n "$x" ]]; then
echo " { \"{#IFNAME}\":\"$x\" },"
#echo -e $x"\t\t"$MAC"\t"$IP"\t"$SPEED"\t"$LINK
fi
let "numDevices++"
done
if [[ $numDevices -gt 0 ]]; then
echo " ]"
echo "}"
exit 0
else
exit 1
fi