commit 86ad8e4ba0e010215357bcbfe1a3725e92c2d9f9 from: mischa date: Sat May 04 16:20:26 2019 UTC change --border 0, --color BACK#ffffff commit - ef1184369c04a038079cd6bcf2fd438cd776ac88 commit + 86ad8e4ba0e010215357bcbfe1a3725e92c2d9f9 blob - bf0e38d1fb7a1488caaada10bccda91089fcf51f blob + c38ea58e04a78127a1294e31c955987cb3105076 --- cores.sh +++ cores.sh @@ -15,8 +15,8 @@ test -n "$1" || exit 1 HOST="$1" COMMUNITY="public" -RRDFILES="/var/rrdtool" -IMAGES="/var/www/htdocs" +RRDFILES="/home/mischa/rrd" +IMAGES="/var/www/mrtg/obsda.ms" WATERMARK="OpenBSD Amsterdam - https://obsda.ms" RRDTOOL="/usr/local/bin/rrdtool" CPUINFO="/tmp/${HOST}-cores.txt" blob - 6fc1eb8845df8c84fb9809bb69cf823509c2af8d blob + e083ac3c990dd29436a1a34abe8021839b0f0700 --- cpu_load.sh +++ cpu_load.sh @@ -15,12 +15,13 @@ test -n "$1" || exit 1 HOST="$1" COMMUNITY="public" -RRDFILES="/var/rrdtool" -IMAGES="/var/www/htdocs" +RRDFILES="/home/mischa/rrd" +IMAGES="/var/www/mrtg/obsda.ms" WATERMARK="OpenBSD Amsterdam - https://obsda.ms" RRDTOOL="/usr/local/bin/rrdtool" CPUINFO="/tmp/${HOST}-cpu.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') if ! test -f "${RRDFILES}/${HOST}-cpu.rrd" @@ -41,9 +42,11 @@ ${RRDTOOL} update ${RRDFILES}/${HOST}-cpu.rrd N:${CPU_ ${RRDTOOL} graph ${IMAGES}/${HOST}-cpu.png \ --start -43200 \ - --title "${HOST} - CPU" \ + --title "${HOST} - ${VERSION} - CPU" \ --vertical-label "% CPU Used" \ --watermark "${WATERMARK}" \ + --color BACK#ffffff \ + --border 0 \ DEF:CPU=${RRDFILES}/${HOST}-cpu.rrd:ds0:AVERAGE \ AREA:CPU#FFCC00 \ LINE2:CPU#CC0033:"CPU" \ blob - 5485c41eaa7df712238d7149bfa1a98811c11569 blob + ce80b0dec3c74360b937521e8648302369ec6184 --- interface.sh +++ interface.sh @@ -17,11 +17,12 @@ test -n "$2" || exit 1 HOST="$1" INTERFACE="$2" COMMUNITY="public" -RRDFILES="/var/rrdtool" -IMAGES="/var/www/htdocs" +RRDFILES="/home/mischa/rrd" WATERMARK="OpenBSD Amsterdam - https://obsda.ms" +IMAGES="/var/www/mrtg/obsda.ms" RRDTOOL="/usr/local/bin/rrdtool" UPTIME=$(cat /tmp/${HOST}-uptime.txt) +VERSION=$(cat /tmp/${HOST}-version.txt) NOW=$(date "+%Y-%m-%d %H:%M:%S %Z" | sed 's/:/\\:/g') if ! test -f "${RRDFILES}/${HOST}-${INTERFACE}.rrd" @@ -49,9 +50,11 @@ ${RRDTOOL} update ${RRDFILES}/${HOST}-${INTERFACE}.rrd ${RRDTOOL} graph ${IMAGES}/${HOST}-${INTERFACE}.png \ --start -43200 \ - --title "${HOST} - ${DESCR}" \ + --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,*" \ blob - 7950cb3ff058b509074471688e026bc8cf7ab93e blob + f567766402f531ba786d683091e10359e12058a9 --- uptime.sh +++ uptime.sh @@ -17,10 +17,11 @@ HOST="$1" COMMUNITY="public" UPTIMEINFO="/tmp/${HOST}-uptime.txt" +rm -rf ${UPTIMEINFO} TICKS=$(snmpctl snmp get ${HOST} community ${COMMUNITY} oid hrSystemUptime.0 | cut -d= -f2) DAYS=$(echo "${TICKS}/8640000" | bc -l) HOURS=$(echo "0.${DAYS##*.} * 24" | bc -l) MINUTES=$(echo "0.${HOURS##*.} * 60" | bc -l) SECS=$(echo "0.${MINUTES##*.} * 60" | bc -l) -test -n "$DAYS" && printf '%s days, ' "${DAYS%.*}" > ${UPTIMEINFO} +test -n "${DAYS%.*}" && printf '%s days, ' "${DAYS%.*}" > ${UPTIMEINFO} printf '%02d\\:%02d\\:%02d\n' "${HOURS%.*}" "${MINUTES%.*}" "${SECS%.*}" >> ${UPTIMEINFO} blob - 3ff512b7b544a5fa4a00ea0d4e85814d547ce3e8 blob + 85cbc5abebc59ecd4ee54fbd48a543d00a1b1464 --- wrapper.sh +++ wrapper.sh @@ -12,9 +12,17 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -SCRIPTS="/var/rrdtool" +SCRIPTS="/home/mischa/rrdtool" -for i in $(jot 2 1); do ${SCRIPTS}/uptime.sh host${i}.domain.tld; done -for i in $(jot 2 1); do ${SCRIPTS}/cpu_load.sh host${i}.domain.tld; done -${SCRIPTS}/interface.sh host1.domain.tld 12 -${SCRIPTS}/interface.sh host2.domain.tld 11 +for i in $(jot 8 0); do ${SCRIPTS}/uptime.sh s${i}.obsda.ms; done +for i in $(jot 8 0); do ${SCRIPTS}/version.sh s${i}.obsda.ms; done +for i in $(jot 8 0); do ${SCRIPTS}/cpu_load.sh s${i}.obsda.ms; done +${SCRIPTS}/interface.sh s0.obsda.ms 9 +${SCRIPTS}/interface.sh s1.obsda.ms 12 +${SCRIPTS}/interface.sh s2.obsda.ms 8 +${SCRIPTS}/interface.sh s3.obsda.ms 12 +${SCRIPTS}/interface.sh s4.obsda.ms 12 +${SCRIPTS}/interface.sh s5.obsda.ms 12 +${SCRIPTS}/interface.sh s6.obsda.ms 12 +${SCRIPTS}/interface.sh s7.obsda.ms 11 +#${SCRIPTS}/cores.sh s3.obsda.ms