Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
JR Dalrymple
/
pf_interface_usage
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
22689d9f
authored
Nov 01, 2015
by
JR Dalrymple
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bash script gone
parent
08e8aa1f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
65 deletions
+0
-65
check_snmp_usage.sh
+0
-65
No files found.
check_snmp_usage.sh
deleted
100755 → 0
View file @
08e8aa1f
#!/bin/sh
#SNMP OIDs we'll care about:
dateTimeNowOID
=
"HOST-RESOURCES-MIB::hrSystemDate.0"
interfaceTableOID
=
"IF-MIB::ifDescr"
interfaceInBytesOID
=
"IF-MIB::ifInOctets"
interfaceOutBytesOID
=
"IF-MIB::ifOutOctets"
snmpget
=
`
which snmpget
`
snmpwalk
=
`
which snmpwalk
`
interfaceList
=()
usage
()
{
echo
" Usage:
$0
-i interface -l limit"
echo
"
$0
-h (shows this message)"
echo
"Replace <interface> with the interface you want to monitor"
echo
"Replace <limit> with your monthly badwidth allotment measured in bytes"
}
nagiosExit
()
{
echo
$2
case
$1
in
OK
)
exit
0
;;
WARNING
)
exit
1
;;
CRITICAL
)
exit
2
;;
UNKNOWN
)
exit
3
;;
*
)
exit
255
;;
esac
}
if
[
"$#"
-lt
1
]
;
then
nagiosExit UNKNOWN
"You must supply some parameters"
fi
# GET ARGS
while
getopts
H:i:l:h o
do case
"
$o
"
in
H
)
host
=
"
$OPTARG
"
;;
i
)
interface
=
"
$OPTARG
"
;;
l
)
limit
=
"
$OPTARG
"
;;
h
)
usage
nagiosExit UNKNOWN
" "
;;
esac
done
shift
$OPTIND
-1
# Grab the list of interfaces from the host and figure out
# the index of the array we're interested in
walk
=
"
$snmpwalk
-v2c -c public
$host
$interfaceTableOID
"
interfaceList
=(
"
$(
$walk
)
"
)
for
element
in
"
${
interfaceList
[@]
}
"
do
echo
"Hello diaf
$element
\n
"
tempArray
=(
$element
)
done
nagiosExit
"OK"
""
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment