commit 2c6743b8db2ffec7c6e09457bd0259d143de2885 from: mischa date: Sat Sep 24 08:47:34 2022 UTC moved from snmp2c to snmp3 commit - 1b9785b66c1600dce99a740e68c47e6ad082de98 commit + 2c6743b8db2ffec7c6e09457bd0259d143de2885 blob - 8c60997c76bf9ae5b8f6033912122c814ffe07b1 blob + 5c85f58f428daf94ed09b54e6c54406e1a31bfb1 --- cores.sh +++ cores.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2019-2021 Mischa Peters +# Copyright (c) 2019-2022 Mischa Peters # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -16,7 +16,9 @@ # test -n "$1" || exit 1 HOST="$1" -COMMUNITY="public" +AUTHPASS="tropic shark reefs" +USER="random" +PRIVPASS="equ5xerhiffid7klevuk" RRDFILES="/home/mischa/rrd" IMAGES="/var/www/rrdtool/obsda.ms" WATERMARK="OpenBSD Amsterdam - https://obsda.ms" @@ -45,7 +47,7 @@ ${RRDTOOL} create ${RRDFILES}/${HOST}-cores.rrd \ RRA:MAX:0.5:1:20000 fi -snmp walk -v2c -c ${COMMUNITY} ${HOST} hrProcessorLoad | awk '{print $4}' > ${CPUINFO} +snmp walk -A "${AUTHPASS}" -l authPriv -u ${USER} -X "${PRIVPASS}" ${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}) blob - 8f5ebdb78add7b4fcc021b7e2ce53692efa4076d blob + c66e3624449bfc1b980973a1dee3eebf633d8564 --- cpu_load.sh +++ cpu_load.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2019-2021 Mischa Peters +# Copyright (c) 2019-2022 Mischa Peters # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -16,7 +16,9 @@ # test -n "$1" || exit 1 HOST="$1" -COMMUNITY="public" +AUTHPASS="tropic shark reefs" +USER="random" +PRIVPASS="equ5xerhiffid7klevuk" RRDFILES="/home/mischa/rrd" IMAGES="/var/www/rrdtool/obsda.ms" WATERMARK="OpenBSD Amsterdam - https://obsda.ms" @@ -35,7 +37,7 @@ ${RRDTOOL} create ${RRDFILES}/${HOST}-cpu.rrd \ RRA:MAX:0.5:1:20000 fi -snmp walk -v2c -c ${COMMUNITY} ${HOST} hrProcessorLoad | awk '{print $4}' > ${CPUINFO} +snmp walk -A "${AUTHPASS}" -l authPriv -u ${USER} -X "${PRIVPASS}" ${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) blob - 3ce244ca4c4864b2835aee9c6885f521ccb49bb7 blob + fb98b18933ab5036db0cef94bc18f378f65bfe73 --- ifdescr.sh +++ ifdescr.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2019-2021 Mischa Peters +# Copyright (c) 2019-2022 Mischa Peters # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -14,10 +14,12 @@ # 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 ifDescr +# Get list of interfaces with: snmp walk -A -l authPriv -u -X ifDescr # test -n "$1" || exit 1 HOST="$1" -COMMUNITY="public" +AUTHPASS="tropic shark reefs" +USER="random" +PRIVPASS="equ5xerhiffid7klevuk" -snmp walk -v2c -c ${COMMUNITY} ${HOST} ifDescr +snmp walk -A "${AUTHPASS}" -l authPriv -u ${USER} -X "${PRIVPASS}" ${HOST} ifDescr blob - 4056dea9863c02b42d0966ac1097cab23a81b15e blob + 30e32ddd3cf9dbe00e4f60bd4be1cd3dd051ef8e --- interface.sh +++ interface.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2019-2021 Mischa Peters +# Copyright (c) 2019-2022 Mischa Peters # # 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 ifDescr -# test -n "$1" || exit 1 test -n "$2" || exit 1 HOST="$1" INTERFACE="$2" -COMMUNITY="public" +AUTHPASS="tropic shark reefs" +USER="random" +PRIVPASS="equ5xerhiffid7klevuk" 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 -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}') +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}') ${RRDTOOL} update ${RRDFILES}/${HOST}-${INTERFACE}.rrd N:${IN}:${OUT} blob - e4343ce25a2fbbd1eff1be36b4ab0f5d28fdcf7d (mode 755) blob + /dev/null --- relayd.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2019-2020 Mischa Peters -# -# 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 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}" blob - 9102419318d0191ba4d594f0d62b60307c9cd291 blob + 04041e8da5bb6c56e293339d6b025af45051a554 --- ticks.sh +++ ticks.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2019-2021 Mischa Peters +# Copyright (c) 2019-2022 Mischa Peters # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,9 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # HOST="s1.obsda.ms" -COMMUNITY="public" +AUTHPASS="tropic shark reefs" +USER="random" +PRIVPASS="equ5xerhiffid7klevuk" #15259107187 / 8640000 = days (+remainder) = 176.6107855324074 #0.6107855324074 * 24 = hours (+remainder) = 14.65885277777778 @@ -23,7 +25,7 @@ COMMUNITY="public" #0.53116666666667 * 60 = seconds.milliseconds = 31.87 echo -TICKS=$(snmp get -v2c -c ${COMMUNITY} ${HOST} hrSystemUptime.0 | awk -F"[()]" '{print $2}') +TICKS=$(snmp get -A "${AUTHPASS}" -l authPriv -u ${USER} -X "${PRIVPASS}" ${HOST} hrSystemUptime.0 | awk -F"[()]" '{print $2}') echo "TICKS: $TICKS" TICKS="1193085988" blob - 05ca76f7cc91b339bb26db73d602af9b2a4c64ba blob + bcc7056a1ed77d441fd9bdc0972bd4cce21dd3fe --- uptime.sh +++ uptime.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2019-2021 Mischa Peters +# Copyright (c) 2019-2022 Mischa Peters # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -16,11 +16,13 @@ # test -n "$1" || exit 1 HOST="$1" -COMMUNITY="public" +AUTHPASS="tropic shark reefs" +USER="random" +PRIVPASS="equ5xerhiffid7klevuk" UPTIMEINFO="/tmp/${HOST}-uptime.txt" rm -rf ${UPTIMEINFO} -TICKS=$(snmp get -v2c -c ${COMMUNITY} ${HOST} hrSystemUptime.0 | awk -F"[()]" '{print $2}') +TICKS=$(snmp get -A "${AUTHPASS}" -l authPriv -u ${USER} -X "${PRIVPASS}" ${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) blob - e1692cfef2edf43c05ece52bc21fe2092112279b blob + a48edcc9caa96a08f3fd85673fc7f5d0e296406b --- version.sh +++ version.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2019-2021 Mischa Peters +# Copyright (c) 2019-2022 Mischa Peters # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -16,7 +16,9 @@ # test -n "$1" || exit 1 HOST="$1" -COMMUNITY="public" +AUTHPASS="tropic shark reefs" +USER="random" +PRIVPASS="equ5xerhiffid7klevuk" VERSIONINFO="/tmp/${HOST}-version.txt" -snmp get -v2c -c ${COMMUNITY} ${HOST} sysDescr.0 | awk '{print $6,$7}' > ${VERSIONINFO} +snmp get -A "${AUTHPASS}" -l authPriv -u ${USER} -X "${PRIVPASS}" ${HOST} sysDescr.0 | awk '{print $6,$7}' > ${VERSIONINFO} blob - 2b9e341af30a16f434e5ed44611945ed08ca416d blob + 714188902da09ab691964e93175bc2ec84537c75 --- wrapper.sh +++ wrapper.sh @@ -17,7 +17,7 @@ #*/5 * * * * -n /home/mischa/rrdtool/wrapper.sh # SCRIPTS="/home/mischa/rrdtool" -SERVERS="16 1" +SERVERS="18 1" MEGA="1 1" # SERVERS