added hosts
This commit is contained in:
parent
36320daa4b
commit
59aa26cf9c
73
relayd.sh
Executable file
73
relayd.sh
Executable file
@ -0,0 +1,73 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright (c) 2019-2020 Mischa Peters <mischa @ openbsd.amsterdam>
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, and distribute this software for any
|
||||||
|
# purpose with or without fee is hereby granted, provided that the above
|
||||||
|
# copyright notice and this permission notice appear in all copies.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
#
|
||||||
|
# Get list of interfaces with: snmpctl snmp walk <host> community public oid ifDescr
|
||||||
|
#
|
||||||
|
test -n "$1" || exit 1
|
||||||
|
test -n "$2" || exit 1
|
||||||
|
HOST="$1"
|
||||||
|
INTERFACE="relayd"
|
||||||
|
COMMUNITY="public"
|
||||||
|
RRDFILES="/home/mischa/relayd"
|
||||||
|
WATERMARK="OpenBSD Amsterdam - https://obsda.ms"
|
||||||
|
IMAGES="/var/www/rrdtool/obsda.ms"
|
||||||
|
RRDTOOL="/usr/local/bin/rrdtool"
|
||||||
|
NOW=$(date "+%Y-%m-%d %H:%M:%S %Z" | sed 's/:/\\:/g')
|
||||||
|
|
||||||
|
if ! test -f "${RRDFILES}/${HOST}-${INTERFACE}.rrd"
|
||||||
|
then
|
||||||
|
echo "Creating ${RRDFILES}/${HOST}-${INTERFACE}.rrd"
|
||||||
|
${RRDTOOL} create ${RRDFILES}/${HOST}-${INTERFACE}.rrd \
|
||||||
|
--step 300 \
|
||||||
|
DS:ds0:COUNTER:600:0:1250000000 \
|
||||||
|
DS:ds1:COUNTER:600:0:1250000000 \
|
||||||
|
RRA:AVERAGE:0.5:1:600 \
|
||||||
|
RRA:AVERAGE:0.5:6:700 \
|
||||||
|
RRA:AVERAGE:0.5:24:775 \
|
||||||
|
RRA:AVERAGE:0.5:288:797 \
|
||||||
|
RRA:MAX:0.5:1:600 \
|
||||||
|
RRA:MAX:0.5:6:700 \
|
||||||
|
RRA:MAX:0.5:24:775 \
|
||||||
|
RRA:MAX:0.5:288:797
|
||||||
|
fi
|
||||||
|
|
||||||
|
IN=$(snmpctl snmp get ${HOST} community ${COMMUNITY} oid ifInOctets.${INTERFACE} | cut -d= -f2)
|
||||||
|
OUT=$(snmpctl snmp get ${HOST} community ${COMMUNITY} oid ifOutOctets.${INTERFACE} | cut -d= -f2)
|
||||||
|
DESCR="TEST"
|
||||||
|
|
||||||
|
${RRDTOOL} update ${RRDFILES}/${HOST}-${INTERFACE}.rrd N:${IN}:${OUT}
|
||||||
|
|
||||||
|
${RRDTOOL} graph ${IMAGES}/${HOST}-${INTERFACE}.png \
|
||||||
|
--start -43200 \
|
||||||
|
--title "${HOST} - ${VERSION} - ${DESCR}" \
|
||||||
|
--vertical-label "Bits per Second" \
|
||||||
|
--watermark "${WATERMARK}" \
|
||||||
|
--color BACK#ffffff \
|
||||||
|
--border 0 \
|
||||||
|
DEF:IN=${RRDFILES}/${HOST}-${INTERFACE}.rrd:ds0:AVERAGE \
|
||||||
|
DEF:OUT=${RRDFILES}/${HOST}-${INTERFACE}.rrd:ds1:AVERAGE \
|
||||||
|
CDEF:IN_CDEF="IN,8,*" \
|
||||||
|
CDEF:OUT_CDEF="OUT,8,*" \
|
||||||
|
AREA:IN_CDEF#00FF00:"In " \
|
||||||
|
GPRINT:IN_CDEF:MAX:"Max\:%5.2lf %s" \
|
||||||
|
GPRINT:IN_CDEF:AVERAGE:"Average\:%5.2lf %s" \
|
||||||
|
GPRINT:IN_CDEF:LAST:" Current\:%5.2lf %s\n" \
|
||||||
|
LINE2:OUT_CDEF#0000FF:"Out" \
|
||||||
|
GPRINT:OUT_CDEF:MAX:"Max\:%5.2lf %s" \
|
||||||
|
GPRINT:OUT_CDEF:AVERAGE:"Average\:%5.2lf %s" \
|
||||||
|
GPRINT:OUT_CDEF:LAST:" Current\:%5.2lf %s\n" \
|
||||||
|
COMMENT:"\\n" \
|
||||||
|
COMMENT:" Up for ${UPTIME} at ${NOW}"
|
@ -18,9 +18,9 @@
|
|||||||
#
|
#
|
||||||
SCRIPTS="/home/mischa/rrdtool"
|
SCRIPTS="/home/mischa/rrdtool"
|
||||||
|
|
||||||
for i in $(jot 11); do ${SCRIPTS}/uptime.sh s${i}.obsda.ms; done
|
for i in $(jot 14); do ${SCRIPTS}/uptime.sh s${i}.obsda.ms; done
|
||||||
for i in $(jot 11); do ${SCRIPTS}/version.sh s${i}.obsda.ms; done
|
for i in $(jot 14); do ${SCRIPTS}/version.sh s${i}.obsda.ms; done
|
||||||
for i in $(jot 11); do ${SCRIPTS}/cpu_load.sh s${i}.obsda.ms; done
|
for i in $(jot 14); do ${SCRIPTS}/cpu_load.sh s${i}.obsda.ms; done
|
||||||
${SCRIPTS}/interface.sh s1.obsda.ms 12
|
${SCRIPTS}/interface.sh s1.obsda.ms 12
|
||||||
${SCRIPTS}/interface.sh s2.obsda.ms 6
|
${SCRIPTS}/interface.sh s2.obsda.ms 6
|
||||||
${SCRIPTS}/interface.sh s3.obsda.ms 12
|
${SCRIPTS}/interface.sh s3.obsda.ms 12
|
||||||
@ -32,3 +32,6 @@ ${SCRIPTS}/interface.sh s8.obsda.ms 12
|
|||||||
${SCRIPTS}/interface.sh s9.obsda.ms 12
|
${SCRIPTS}/interface.sh s9.obsda.ms 12
|
||||||
${SCRIPTS}/interface.sh s10.obsda.ms 12
|
${SCRIPTS}/interface.sh s10.obsda.ms 12
|
||||||
${SCRIPTS}/interface.sh s11.obsda.ms 12
|
${SCRIPTS}/interface.sh s11.obsda.ms 12
|
||||||
|
${SCRIPTS}/interface.sh s12.obsda.ms 8
|
||||||
|
${SCRIPTS}/interface.sh s13.obsda.ms 8
|
||||||
|
${SCRIPTS}/interface.sh s14.obsda.ms 8
|
||||||
|
Loading…
Reference in New Issue
Block a user