diff --git a/cores.sh b/cores.sh index 8c60997..5c85f58 100755 --- a/cores.sh +++ b/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}) diff --git a/cpu_load.sh b/cpu_load.sh index 8f5ebdb..c66e362 100755 --- a/cpu_load.sh +++ b/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) diff --git a/ifdescr.sh b/ifdescr.sh index 3ce244c..fb98b18 100755 --- a/ifdescr.sh +++ b/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 diff --git a/interface.sh b/interface.sh index 4056dea..30e32dd 100755 --- a/interface.sh +++ b/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} diff --git a/relayd.sh b/relayd.sh deleted file mode 100755 index e4343ce..0000000 --- a/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}" diff --git a/ticks.sh b/ticks.sh index 9102419..04041e8 100755 --- a/ticks.sh +++ b/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" diff --git a/uptime.sh b/uptime.sh index 05ca76f..bcc7056 100755 --- a/uptime.sh +++ b/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) diff --git a/version.sh b/version.sh index e1692cf..a48edcc 100755 --- a/version.sh +++ b/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} diff --git a/wrapper.sh b/wrapper.sh index 2b9e341..7141889 100755 --- a/wrapper.sh +++ b/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