Compare commits
No commits in common. "5851e9cb55d25753149b3a1717b7259ab0ebd278" and "1b9785b66c1600dce99a740e68c47e6ad082de98" have entirely different histories.
5851e9cb55
...
1b9785b66c
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +0,0 @@
|
||||
snmp.conf
|
8
cores.sh
8
cores.sh
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2019-2022 Mischa Peters <mischa @ openbsd.amsterdam>
|
||||
# Copyright (c) 2019-2021 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
|
||||
@ -16,9 +16,7 @@
|
||||
#
|
||||
test -n "$1" || exit 1
|
||||
HOST="$1"
|
||||
AUTHPASS="tropic shark reefs"
|
||||
USER="random"
|
||||
PRIVPASS="equ5xerhiffid7klevuk"
|
||||
COMMUNITY="public"
|
||||
RRDFILES="/home/mischa/rrd"
|
||||
IMAGES="/var/www/rrdtool/obsda.ms"
|
||||
WATERMARK="OpenBSD Amsterdam - https://obsda.ms"
|
||||
@ -47,7 +45,7 @@ ${RRDTOOL} create ${RRDFILES}/${HOST}-cores.rrd \
|
||||
RRA:MAX:0.5:1:20000
|
||||
fi
|
||||
|
||||
snmp walk -A "${AUTHPASS}" -l authPriv -u ${USER} -X "${PRIVPASS}" ${HOST} hrProcessorLoad | awk '{print $4}' > ${CPUINFO}
|
||||
snmp walk -v2c -c ${COMMUNITY} ${HOST} hrProcessorLoad | awk '{print $4}' > ${CPUINFO}
|
||||
CORES=$(cat ${CPUINFO} | wc -l)
|
||||
ACT_CORES=$((${CORES}/2))
|
||||
CPU_LOAD=$(cat ${CPUINFO} | paste -s -d: - | cut -d: -f1-${ACT_CORES})
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2019-2022 Mischa Peters <mischa @ openbsd.amsterdam>
|
||||
# Copyright (c) 2019-2021 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
|
||||
@ -16,9 +16,7 @@
|
||||
#
|
||||
test -n "$1" || exit 1
|
||||
HOST="$1"
|
||||
AUTHPASS="tropic shark reefs"
|
||||
USER="random"
|
||||
PRIVPASS="equ5xerhiffid7klevuk"
|
||||
COMMUNITY="public"
|
||||
RRDFILES="/home/mischa/rrd"
|
||||
IMAGES="/var/www/rrdtool/obsda.ms"
|
||||
WATERMARK="OpenBSD Amsterdam - https://obsda.ms"
|
||||
@ -37,7 +35,7 @@ ${RRDTOOL} create ${RRDFILES}/${HOST}-cpu.rrd \
|
||||
RRA:MAX:0.5:1:20000
|
||||
fi
|
||||
|
||||
snmp walk -A "${AUTHPASS}" -l authPriv -u ${USER} -X "${PRIVPASS}" ${HOST} hrProcessorLoad | awk '{print $4}' > ${CPUINFO}
|
||||
snmp walk -v2c -c ${COMMUNITY} ${HOST} hrProcessorLoad | awk '{print $4}' > ${CPUINFO}
|
||||
CORES=$(grep -cv "^0$" ${CPUINFO})
|
||||
CPU_LOAD_SUM=$(awk '{sum += $1} END {print sum}' ${CPUINFO})
|
||||
CPU_LOAD=$(echo "scale=2; ${CPU_LOAD_SUM}/${CORES}" | bc -l)
|
||||
|
10
ifdescr.sh
10
ifdescr.sh
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2019-2022 Mischa Peters <mischa @ openbsd.amsterdam>
|
||||
# Copyright (c) 2019-2021 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
|
||||
@ -14,12 +14,10 @@
|
||||
# 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: snmp walk -A <authpass> -l authPriv -u <user> -X <privpass> <host> ifDescr
|
||||
# Get list of interfaces with: snmp walk -v2c -c public <host> ifDescr
|
||||
#
|
||||
test -n "$1" || exit 1
|
||||
HOST="$1"
|
||||
AUTHPASS="tropic shark reefs"
|
||||
USER="random"
|
||||
PRIVPASS="equ5xerhiffid7klevuk"
|
||||
COMMUNITY="public"
|
||||
|
||||
snmp walk -A "${AUTHPASS}" -l authPriv -u ${USER} -X "${PRIVPASS}" ${HOST} ifDescr
|
||||
snmp walk -v2c -c ${COMMUNITY} ${HOST} ifDescr
|
||||
|
14
interface.sh
14
interface.sh
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2019-2022 Mischa Peters <mischa @ openbsd.amsterdam>
|
||||
# Copyright (c) 2019-2021 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
|
||||
@ -14,13 +14,13 @@
|
||||
# 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: snmp walk -v2c -c public <host> ifDescr
|
||||
#
|
||||
test -n "$1" || exit 1
|
||||
test -n "$2" || exit 1
|
||||
HOST="$1"
|
||||
INTERFACE="$2"
|
||||
AUTHPASS="tropic shark reefs"
|
||||
USER="random"
|
||||
PRIVPASS="equ5xerhiffid7klevuk"
|
||||
COMMUNITY="public"
|
||||
RRDFILES="/home/mischa/rrd"
|
||||
WATERMARK="OpenBSD Amsterdam - https://obsda.ms"
|
||||
IMAGES="/var/www/rrdtool/obsda.ms"
|
||||
@ -46,9 +46,9 @@ ${RRDTOOL} create ${RRDFILES}/${HOST}-${INTERFACE}.rrd \
|
||||
RRA:MAX:0.5:288:797
|
||||
fi
|
||||
|
||||
IN=$(snmp walk -A "${AUTHPASS}" -l authPriv -u ${USER} -X "${PRIVPASS}" ${HOST} ifInOctets.${INTERFACE} | awk '{print $4}')
|
||||
OUT=$(snmp walk -A "${AUTHPASS}" -l authPriv -u ${USER} -X "${PRIVPASS}" ${HOST} ifOutOctets.${INTERFACE} | awk '{print $4}')
|
||||
DESCR=$(snmp walk -A "${AUTHPASS}" -l authPriv -u ${USER} -X "${PRIVPASS}" ${HOST} ifDescr.${INTERFACE} | awk '{print $4}')
|
||||
IN=$(snmp walk -v2c -c ${COMMUNITY} ${HOST} ifInOctets.${INTERFACE} | awk '{print $4}')
|
||||
OUT=$(snmp walk -v2c -c ${COMMUNITY} ${HOST} ifOutOctets.${INTERFACE} | awk '{print $4}')
|
||||
DESCR=$(snmp walk -v2c -c ${COMMUNITY} ${HOST} ifDescr.${INTERFACE} | awk '{print $4}')
|
||||
|
||||
${RRDTOOL} update ${RRDFILES}/${HOST}-${INTERFACE}.rrd N:${IN}:${OUT}
|
||||
|
||||
|
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}"
|
@ -1,13 +0,0 @@
|
||||
AUTHPASS="password123"
|
||||
USER="mgmt"
|
||||
PRIVPASS="321drowssap"
|
||||
RRDFILES="/home/mischa/rrd"
|
||||
IMAGES="/var/www/rrdtool/obsda.ms"
|
||||
WATERMARK="OpenBSD Amsterdam - https://obsda.ms"
|
||||
RRDTOOL="/usr/local/bin/rrdtool"
|
||||
CPUINFO="/tmp/${HOST}-cpu.txt"
|
||||
UPTIMEINFO="/tmp/${HOST}-uptime.txt"
|
||||
VERSIONINFO="/tmp/${HOST}-version.txt"
|
||||
UPTIME=$(cat /tmp/${HOST}-uptime.txt)
|
||||
VERSION=$(cat /tmp/${HOST}-version.txt)
|
||||
NOW=$(date "+%Y-%m-%d %H:%M:%S %Z" | sed 's/:/\\:/g')
|
8
ticks.sh
8
ticks.sh
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2019-2022 Mischa Peters <mischa @ openbsd.amsterdam>
|
||||
# Copyright (c) 2019-2021 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
|
||||
@ -15,9 +15,7 @@
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
HOST="s1.obsda.ms"
|
||||
AUTHPASS="tropic shark reefs"
|
||||
USER="random"
|
||||
PRIVPASS="equ5xerhiffid7klevuk"
|
||||
COMMUNITY="public"
|
||||
|
||||
#15259107187 / 8640000 = days (+remainder) = 176.6107855324074
|
||||
#0.6107855324074 * 24 = hours (+remainder) = 14.65885277777778
|
||||
@ -25,7 +23,7 @@ PRIVPASS="equ5xerhiffid7klevuk"
|
||||
#0.53116666666667 * 60 = seconds.milliseconds = 31.87
|
||||
|
||||
echo
|
||||
TICKS=$(snmp get -A "${AUTHPASS}" -l authPriv -u ${USER} -X "${PRIVPASS}" ${HOST} hrSystemUptime.0 | awk -F"[()]" '{print $2}')
|
||||
TICKS=$(snmp get -v2c -c ${COMMUNITY} ${HOST} hrSystemUptime.0 | awk -F"[()]" '{print $2}')
|
||||
echo "TICKS: $TICKS"
|
||||
|
||||
TICKS="1193085988"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2019-2022 Mischa Peters <mischa @ openbsd.amsterdam>
|
||||
# Copyright (c) 2019-2021 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
|
||||
@ -16,13 +16,11 @@
|
||||
#
|
||||
test -n "$1" || exit 1
|
||||
HOST="$1"
|
||||
AUTHPASS="tropic shark reefs"
|
||||
USER="random"
|
||||
PRIVPASS="equ5xerhiffid7klevuk"
|
||||
COMMUNITY="public"
|
||||
UPTIMEINFO="/tmp/${HOST}-uptime.txt"
|
||||
|
||||
rm -rf ${UPTIMEINFO}
|
||||
TICKS=$(snmp get -A "${AUTHPASS}" -l authPriv -u ${USER} -X "${PRIVPASS}" ${HOST} hrSystemUptime.0 | awk -F"[()]" '{print $2}')
|
||||
TICKS=$(snmp get -v2c -c ${COMMUNITY} ${HOST} hrSystemUptime.0 | awk -F"[()]" '{print $2}')
|
||||
DAYS=$(echo "${TICKS}/8640000" | bc -l)
|
||||
HOURS=$(echo "0.${DAYS##*.} * 24" | bc -l)
|
||||
MINUTES=$(echo "0.${HOURS##*.} * 60" | bc -l)
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2019-2022 Mischa Peters <mischa @ openbsd.amsterdam>
|
||||
# Copyright (c) 2019-2021 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
|
||||
@ -16,9 +16,7 @@
|
||||
#
|
||||
test -n "$1" || exit 1
|
||||
HOST="$1"
|
||||
AUTHPASS="tropic shark reefs"
|
||||
USER="random"
|
||||
PRIVPASS="equ5xerhiffid7klevuk"
|
||||
COMMUNITY="public"
|
||||
VERSIONINFO="/tmp/${HOST}-version.txt"
|
||||
|
||||
snmp get -A "${AUTHPASS}" -l authPriv -u ${USER} -X "${PRIVPASS}" ${HOST} sysDescr.0 | awk '{print $6,$7}' > ${VERSIONINFO}
|
||||
snmp get -v2c -c ${COMMUNITY} ${HOST} sysDescr.0 | awk '{print $6,$7}' > ${VERSIONINFO}
|
||||
|
@ -17,7 +17,7 @@
|
||||
#*/5 * * * * -n /home/mischa/rrdtool/wrapper.sh
|
||||
#
|
||||
SCRIPTS="/home/mischa/rrdtool"
|
||||
SERVERS="18 1"
|
||||
SERVERS="16 1"
|
||||
MEGA="1 1"
|
||||
|
||||
# SERVERS
|
||||
|
Loading…
Reference in New Issue
Block a user