commit d6cb721e8a449107c61c7176d67f647e63976284 from: mischa date: Fri Apr 23 21:57:34 2021 UTC Replaced snmpctl with snmp, thank you for the reminder Rafael commit - a5c4099f58fd6d1de0a9ae3333c92bcaeb35c6c7 commit + d6cb721e8a449107c61c7176d67f647e63976284 blob - a42eb1b43812bcadeb82b4c5f4f2587e34d58791 blob + 72fe4d5e4ae521e74af8384752843fd9b4c3f227 --- cores.sh +++ cores.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2019-2020 Mischa Peters +# Copyright (c) 2019-2021 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 @@ -45,7 +45,7 @@ ${RRDTOOL} create ${RRDFILES}/${HOST}-cores.rrd \ RRA:MAX:0.5:1:20000 fi -snmpctl snmp walk ${HOST} community ${COMMUNITY} oid hrProcessorLoad | cut -d= -f2 > ${CPUINFO} +snmp walk -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}) blob - a8e88462631bc4924cf0993d500620ebdba684b6 blob + be4731c04802600943100a21bc992b019be099c0 --- cpu_load.sh +++ cpu_load.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2019-2020 Mischa Peters +# Copyright (c) 2019-2021 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 @@ -35,7 +35,7 @@ ${RRDTOOL} create ${RRDFILES}/${HOST}-cpu.rrd \ RRA:MAX:0.5:1:20000 fi -snmpctl snmp walk ${HOST} community ${COMMUNITY} oid hrProcessorLoad | cut -d= -f2 > ${CPUINFO} +snmp walk -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) blob - e75f05682d22961548fa0bede0d570d5f9dc472b blob + 2fac40387e9e01c3c544ba4e4e6d51098b8982af --- interface.sh +++ interface.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2019-2020 Mischa Peters +# Copyright (c) 2019-2021 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,7 +14,7 @@ # 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 +# Get list of interfaces with: snmp walk -c public ifDescr # test -n "$1" || exit 1 test -n "$2" || exit 1 @@ -46,9 +46,9 @@ ${RRDTOOL} create ${RRDFILES}/${HOST}-${INTERFACE}.rrd 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=$(snmpctl snmp get ${HOST} community ${COMMUNITY} oid ifDescr.${INTERFACE} | cut -d= -f2 | tr -d '"') +IN=$(snmp walk -c ${COMMUNITY} ${HOST} ifInOctets.${INTERFACE} | awk '{print $4}') +OUT=$(snmp walk -c ${COMMUNITY} ${HOST} ifOutOctets.${INTERFACE} | awk '{print $4}') +DESCR=$(snmp walk -c ${COMMUNITY} ${HOST} ifDescr.${INTERFACE} | awk '{print $4}') ${RRDTOOL} update ${RRDFILES}/${HOST}-${INTERFACE}.rrd N:${IN}:${OUT} blob - 3e4446989b7f7ca6936d2ce634021d1c3cd79b04 blob + 312297087c634da67044e121b87b6b7146c01d30 --- ticks.sh +++ ticks.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2019 Mischa Peters +# Copyright (c) 2019-2021 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,6 +15,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # HOST="s1.obsda.ms" +COMMUNITY="public" #15259107187 / 8640000 = days (+remainder) = 176.6107855324074 #0.6107855324074 * 24 = hours (+remainder) = 14.65885277777778 @@ -22,7 +23,7 @@ HOST="s1.obsda.ms" #0.53116666666667 * 60 = seconds.milliseconds = 31.87 echo -TICKS=$(snmpctl snmp get ${HOST} oid hrSystemUptime.0 | cut -d= -f2) +TICKS=$(snmp get -c ${COMMUNITY} ${HOST} hrSystemUptime.0 | awk -F"[()]" '{print $2}') echo "TICKS: $TICKS" TICKS="1193085988" blob - e57e4cc8c0855eb72e5dda9098aaaed056ae834c blob + e6a57c4bb4a28944cda06e4ab412780a2328caa8 --- uptime.sh +++ uptime.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2019-2020 Mischa Peters +# Copyright (c) 2019-2021 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 @@ -20,7 +20,7 @@ COMMUNITY="public" UPTIMEINFO="/tmp/${HOST}-uptime.txt" rm -rf ${UPTIMEINFO} -TICKS=$(snmpctl snmp get ${HOST} community ${COMMUNITY} oid hrSystemUptime.0 | cut -d= -f2) +TICKS=$(snmp get -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) blob - 76489f8b7149f33ecc16a0c42f0482042156c681 blob + ac539f26d0cc98215a96ae80932e5d04516dfb28 --- version.sh +++ version.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2019-2020 Mischa Peters +# Copyright (c) 2019-2021 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 @@ -19,4 +19,4 @@ HOST="$1" COMMUNITY="public" VERSIONINFO="/tmp/${HOST}-version.txt" -snmpctl snmp get ${HOST} community ${COMMUNITY} oid sysDescr.0 | awk '{print $3,$4}' > ${VERSIONINFO} +snmp get -c ${COMMUNITY} ${HOST} sysDescr.0 | awk '{print $6,$7}' > ${VERSIONINFO} blob - 7a41e8f7341a83162867b7c9c99035f723c3d8ca blob + 411fe8cc4edd718cd195b4050f65d3a0b95c4894 --- wrapper.sh +++ wrapper.sh @@ -16,7 +16,7 @@ # #*/5 * * * * -n /home/mischa/rrdtool/wrapper.sh # -HOSTS="12 2" +HOSTS="14 1" SCRIPTS="/home/mischa/rrdtool" for i in $(jot ${HOSTS}); do @@ -34,9 +34,9 @@ for i in $(jot ${HOSTS}); do done wait -${SCRIPTS}/interface.sh s1.obsda.ms 12 & -${SCRIPTS}/interface.sh s2.obsda.ms 6 & -${SCRIPTS}/interface.sh s3.obsda.ms 12 & +${SCRIPTS}/interface.sh s1.obsda.ms 8 & +${SCRIPTS}/interface.sh s2.obsda.ms 8 & +${SCRIPTS}/interface.sh s3.obsda.ms 8 & ${SCRIPTS}/interface.sh s4.obsda.ms 12 & ${SCRIPTS}/interface.sh s5.obsda.ms 12 & ${SCRIPTS}/interface.sh s6.obsda.ms 12 & @@ -47,4 +47,4 @@ ${SCRIPTS}/interface.sh s10.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 & +${SCRIPTS}/interface.sh s14.obsda.ms 9 &