Wednesday, September 2, 2020

RAID STATS / Temperature to MRTG

MRTG wants 4 attributes.
In / Out / Uptime / Hostname.

So I put those 4 things into a file…. n4.$DRIVE
for each drive in the array. Then I’m going to use cron to run this
script (Below) which puts it on a samba share that has the server
that’s running MRTG. Which will also have a cron job that will be
polling that file every 5 minutes. Then running MRTG to grab that
data and store it in it’s log file.

Then It’ll give me out 5 sets of graphs with the temperature displayed
over the last 24 / 48 hours.

I used Drive Temp from SYSCTL
Raspberian Temperature to grab the CPU Temp (Which is an independent device from the drives)
as well as grabbing uptime and hostname…

root@nas4:~/bin# cat raidtemp.mrtg
#!/bin/bash
##########################################################
#
#    Use Smartctl to get drive temperature
#
##########################################################
GREP=/usr/bin/grep
CAT=/usr/bin/cat
ECHO=/usr/bin/echo
SCTL="/usr/sbin/smartctl --all"
FIND="ature_Cels"
DATE=`/usr/bin/date +"%m.%d.%y.%H.%M"`
AWK=/usr/bin/awk
CPUTEMP="/root/bin/temp"
FINDCPU="temp"
UPTIME=`/usr/bin/uptime`
HOSTNAME=`$CAT /etc/HOSTNAME`
FILELOC=/home/digitemp/n4

#
#  It'll ignore unfound drives, so list em all
#
DRIVES=(/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf)
#
#
#
for i in "${DRIVES[@]}"
 do
   DRIVE=`$ECHO $i | $AWK -F/ '{print $3}'`
   TEMP=`$SCTL $i | $GREP $FIND | $AWK -F- '{print $2}' | $AWK '{print $1}'`
   CPUTMP=`$CPUTEMP | $GREP $FINDCPU | $AWK -F: '{print $2}' | $AWK -F. '{print $1}'`

   if [ ! -z "$TEMP" ]
   then
    $ECHO $TEMP > $FILELOC.$DRIVE
    $ECHO $CPUTMP >> $FILELOC.$DRIVE
    $ECHO $UPTIME >> $FILELOC.$DRIVE
    $ECHO $HOSTNAME >> $FILELOC.$DRIVE
   fi
 done

root@nas4:~/bin#

Getting temperature from the CPU is fairly simple / straightforward as well

root@nas4:~/bin# cat temp
#!/bin/bash

# SARPi Project : http://sarpi.fatdog.nl - cpu_status.sh
#
# Raspberry Pi 2, 3, 4 - CPU clock frequency and thermal status.
# This script outputs the current status of the CPU clock speed (MHz)
# and core temperature (Celsius) for monitoring or testing purposes
# while under load or idle.
#
# Usage -
# Default command:   watch ./cpu_status.sh     # 2 seconds refresh
# Timed refresh:     watch -n<number of seconds or 0> ./cpu_status.sh
# With highlights:   watch -d -n0 ./cpu_status.sh
# Perm highlights:   watch -d=cumulative -n0 ./cpu_status.sh
#
# Exaga : 15 Jan 2018 - progenitor
#         29 Jun 2019 - updated with rpi model & hw revision
#         03 Jul 2019 - updated with system uptime
#

# Get RPi model and hardware revision
RPiModel=$(dmesg | grep "Machine model:" | cut -d' ' -f10-16)
RPiHWRev=$(cat /proc/cpuinfo | grep Revision | cut -d' ' -f2)

# Get cpu_status function
cpu_status () {
# Get current CPU frequency (All 4 cores)
CPU0freq=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq)
cpuFreq0=$(($CPU0freq/1000))
if [ -f /sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_cur_freq ]; then
CPU1freq=$(cat /sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_cur_freq)
cpuFreq1=$(($CPU1freq/1000))
CPU2freq=$(cat /sys/devices/system/cpu/cpu2/cpufreq/cpuinfo_cur_freq)
cpuFreq2=$(($CPU2freq/1000))
CPU3freq=$(cat /sys/devices/system/cpu/cpu3/cpufreq/cpuinfo_cur_freq)
cpuFreq3=$(($CPU3freq/1000))
fi

# Ouput RPi model/version and system uptime to terminal
echo Device": "$RPiModel
echo HW Rev": "$RPiHWRev
echo
echo Uptime":"$(uptime)
echo

# Output CPU clock status to terminal
echo CPU Clock Speed
echo CPU 0 freq": "$cpuFreq0"MHz"
if [ -f /sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_cur_freq ]; then
echo CPU 1 freq": "$cpuFreq1"MHz"
echo CPU 2 freq": "$cpuFreq2"MHz"
echo CPU 3 freq": "$cpuFreq3"MHz"
fi
echo

# Get CPU thermal status and output to terminal
echo CPU Thermal Status
cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp)
cpuTemp1=$(($cpuTemp0/1000))
cpuTemp2=$(($cpuTemp0/100))
cpuTempM=$(($cpuTemp2 % $cpuTemp1))
echo CPU temp": "$cpuTemp1"."$cpuTempM"°C"

# Output exit method to terminal
echo && echo && echo && echo
echo "[Press CTRL+C to exit.]"
}

# Roll cpu_status function
cpu_status

exit 0

#eofroot@nas4:~/bin#

And the Finished Product:


Monday, August 24, 2020

RAID STATS

Added a RAID 5 array to my storage units and needed to be able to gather
more information than just the cat /proc/mdstat. So I use a combination of

mdadm
smartctl

I wrote a little shelll script. It’s not very efficient, but I dont’ have time right now to make it more efficient, and it does the job. Yeah, it’s making lots of calls but Oh well, it’s not a busy drive right now and the system is basically empty 1 TB used on a 16 TB System, with nobody really using it. So it’s empty.


#!/bin/bash
##########################################################
#    Use Smartctl to get RAID Infor / Stat / Temp / Hours
##########################################################
GREP=/usr/bin/grep
ECHO=/usr/bin/echo
SCTL="/usr/sbin/smartctl --all"
FIND1="ature_Cels"
FIND2="Power_On"
DATE=`/usr/bin/date +"%m.%d.%y.%H.%M"`
AWK=/usr/bin/awk
CAT=/usr/bin/cat
MDADM="/sbin/mdadm --detail /dev/md127"
DRIVES=(/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf)
#
# RAID STATS
#
$ECHO "=================================="
$CAT /proc/mdstat
$ECHO "=================================="
$ECHO "Drive STATUS:"
$MDADM | $GREP clean
$MDADM | $GREP Failed
$ECHO "=================================="
$ECHO "Active DRIVE(s):"
$MDADM | $GREP active
$ECHO "=================================="
#
#  TEMP Stats
#
$ECHO "DRIVE Temperature(s):"
for i in "${DRIVES[@]}"
 do
   TEMP=`$SCTL $i | $GREP $FIND1 | $AWK -F- '{print $2}' | $AWK '{print $1}'`
   if [ ! -z "$TEMP" ]
   then
    echo $DATE:$i:$TEMP
   fi
 done
#
# HOURS Stats
#
$ECHO "=================================="
#
$ECHO "Power ON HOUR(s):"
for i in "${DRIVES[@]}"
 do
   TEMP=`$SCTL $i | $GREP $FIND2 | $AWK -F- '{print $2}' | $AWK '{print $1}'`
   if [ ! -z "$TEMP" ]
   then
    echo $DATE:$i:$TEMP
   fi
 done

Which gives me a nice result…

root@nas4:~/bin# ./raidstat
==================================
Personalities : [raid6] [raid5] [raid4]
md127 : active raid5 sdc1[2] sdb1[1] sde1[5] sdd1[3] sda1[0]
      15627540480 blocks super 1.2 level 5, 512k chunk, algorithm 2 [5/5] [UUUUU]
      bitmap: 0/30 pages [0KB], 65536KB chunk

unused devices: <none>
==================================
             State : clean
    Failed Devices : 0
==================================
Active DRIVE
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1
       2       8       33        2      active sync   /dev/sdc1
       3       8       49        3      active sync   /dev/sdd1
       5       8       65        4      active sync   /dev/sde1
==================================
DRIVE Temperatures:
08.24.20.08.27:/dev/sda:38
08.24.20.08.27:/dev/sdb:37
08.24.20.08.27:/dev/sdc:34
08.24.20.08.27:/dev/sdd:37
08.24.20.08.27:/dev/sde:36
==================================
Power ON HOURS:
08.24.20.08.27:/dev/sda:576
08.24.20.08.27:/dev/sdb:517
08.24.20.08.27:/dev/sdc:517
08.24.20.08.27:/dev/sdd:516
08.24.20.08.27:/dev/sde:517

So Now I have a nice little script I’m going to setup a cron job to run and then every morning It’ll e-mail me a copy of the results for me to check out and make sure there isn’t any problems with the NAS drive. I’m not actively on these NAS devices so I want to make sure that nothing happens to the RAID Array while I’m watching TV or something else. I just want to set it up and forget about it. Stick more stuff on it and have it do it’s thing in the background.
====================
So now I have 4 RAID systems in the Da Attic
N1 RAID 1 16TB Active 16TB Mirroring
N2 RAID 1 8TB Active 8 TB Mirroring
N3 RAID 1 16TB Active 16TB Mirroring
N4 RAID 5 16TB Active
====================

Grand total of 56TB Protected raid. I’m thinking about moving some of the RAID 1 to RAID 5. I just haven’t decided if I trust RAID 5 yet. I’ve been running it for a few weeks. I just don’t have any way to backup the system. So If I loose it I loose it. Right now I’m not really needing it, so I have it running and I’m playing with it to see if I loose anything on it. I’m thinking the first time I loose it I’ll probably nix the idea of using RAID 5. I’ve had that problem in the past. But that was 13 years ago. RAID has come a long way since then. I guess I’ll wait and see.

Monday, August 3, 2020

VPLS.US 10/24/2012 10.10.5.1 & 10.10.5.2

I was just asked the most interesting question.


is this question valid?
A computer with a host IP address of 10.10.5.1 sends a data packet with a destination, IP address of 10.10.5.2. A subnet mask of 255.255.255.0 is being used. Determine whether the packet stays in the LAN or is sent to the gateway.



Of course any question is valid. But is it a good question, is probably a better question.

So that question “WAS” pretty simple in 1999. It stays on the “LAN” however that LAN could have been separated by as many as three layer 2 hops. So from a Layer 3 perspective they would be local to each other. Any traffic destined as described above wouldn’t have to go up to an intelligent device to “route” the traffic but it could be “switched” to it’s end destination. The traffic would not cross IP Broadcast domains, but could cross multiple collision domains, depending of if it was crossing a hub or a switch. But, I guess there probably aren’t any hubs around today.


So in the old days, it probably behaved like the question asker was asking.


today? Well maybe not so much. If that same set of devices were placed into a Virtual Private LAN Service that were spread between Los Angeles and London, and the one computer .1 arp’d to get the MAC address of the other computer
the .2 to send it a frame of data, the traffic would flow between California and London to get the physical MAC address of the .2 computer. All of that was “Officially” and technically to the letter of the question I suppose it would be on a LAN. However that LAN is spanning across North America and the Atlantic Ocean. That’s a pretty big freaking Broadcast domain.


Which really begs the question of a definition of a LAN anymore. does that really have a meaning? Is a Local Areal Network really spanning half way around the world? Does a LAN span around a city or state? What’s local now days?


It also calls into question something that Marion Evans and I talked about many times. He was always being factious but he would say “Let’s just make the whole world a big broadcast domain” He was implying about the poor design characteristics that were being employed on the pseudowire service that we were starting to roll out, looking ahead to the LAN service we were planning to roll out.



Probably not the best design practice, which is partially why I’ve always been of the opinion that at some point the WAN should pass through a router. I wouldn’t ever put a Switch on a VPLS. it really needs to make a Layer 3 hop so that some amount of Layer 3 intelligence can be used for directing the traffic as it leaves between a layer 2 domain and a Layer 3 domain.


Of course the question asker above could have been completely confused and not really understand the basic principles of the question they were asking? Technology is changing.

According to mercury news..


Juniper Networks reportedly for sale, shares in Sunnyvale company jump


I heard the rumor Monday, and then was checking around the web for more information. I’m trying to figure out if this is a tip and I should be buying JNPR shares or if this is just a rumor because of all the layoffs…

Juniper Networks shares jumped 11 percent Thursday after a news website said the Sunnyvale network gear maker had hired JP Morgan to evaluate possible bids, but a source close to the matter said there was no substance to the report.

Juniper’s shares jumped on Thursday morning as the benzinga.com report spread among investors, hitting a one-month high of $19.20 on the New York Stock Exchange before easing back to $18.

One bid is reported to be in the high $20s per share with data storage firm EMC mentioned recently as a potential buyer, benzinga.com reported late on Tuesday.

However, getting past the profit part of it (For me of course), would a EMC/JNPR merger make sense? Well with the recent development work that JNPR has done with the Qfabric, and EMC has recently certified the qfabric to work with their gear.



What does that mean? Well juniper is a 9 billion dollar company and EMC is a 53 Billion dollar company, or roughly 6times the size of JNPR. That’s not insignificant. They could buy them for the qfabric and spin the rest off as a small router company. Or they could keep the whole company, much as Brocade did when they purchased Foundry. That particular deal made a lot of sense, it gave brocade all the networking technology it needed and also let if have the cheaper data center switches without “partnering” with another networking company. If EMC had their own switching division. They might be able to go after total deals, rather than just going after the host and data services. They could go in with a complete soup to nuts solution with firewall and routing capabilities. That has to look attractive.


Well, shares look expensive today? $17.19
Maybe tomorrow.

VPLS.US 09/30/2012 802.1ag for unix

http://vpls.us/?p=780 Sun, 30 Sep 2012 18:07:58 +0000 timc
http://vpls.us/?p=780

http://www.bortzmeyer.org/ethernet-oam.html

Of course it's in french. But if you translate it...

https://noc.sara.nl/nrg/dot1ag-utils/

bash-4.2# ethping -ieth1 -l7 -c5 00:00:5e:00:01:14
Sending CFM LBM to 00:00:5e:00:01:14
Request timeout for 1878795604
Request timeout for 1878795605
Request timeout for 1878795606
Request timeout for 1878795607
bash-4.2#

and a try with the trace


bash-4.2# ethtrace -i eth1 -l 7 00:09:3d:13:f2:a0
Sending CFM LTM probe to 00:09:3d:13:f2:a0
ttl 1: LTM with id 1925342007
no replies for LTM 1925342007
ttl 2: LTM with id 1925342008
no replies for LTM 1925342008
ttl 3: LTM with id 1925342009
no replies for LTM 1925342009
ttl 4: LTM with id 1925342010
no replies for LTM 1925342010
ttl 5: LTM with id 1925342011
no replies for LTM 1925342011
ttl 6: LTM with id 1925342012
no replies for LTM 1925342012
ttl 7: LTM with id 1925342013
no replies for LTM 1925342013
ttl 8: LTM with id 1925342014
no replies for LTM 1925342014
ttl 9: LTM with id 1925342015
no replies for LTM 1925342015

]]>

780
2012-09-30 11:07:58
2012-09-30 18:07:58
open
open
odds-ends
publish
0
0
post

0



_wordbooker_thumb



_wordbooker_extract
http://www.bortzmeyer.org/ethernet-oam.html

Of course it's in french. But if you translate it...

https://noc.sara.nl/nrg/dot1ag-utils/

bash-4.2# ethping -ieth1 -l7 -c5 00:00:5e:00:01:14
Sending CFM LBM to 00:00: ...]]>


_wordbooker_options



_edit_last



_oembed_3b89bc87179a7f8c07ed3748776125d7



_oembed_6f64d583c5ce7c0fbb63f94471f0b1d7



http://vpls.us/?p=786 Tue, 02 Oct 2012 18:16:20 +0000 timc
http://vpls.us/?p=786

#!/bin/bash
echo "setmac to $1"
numbers=(`echo $1 | tr ':' ' '`)
echo ${numbers[0]}

KEY=669955aa
numbers[0]=c0
numbers[1]=ff
numbers[2]=ee
numbers[3]=c0
numbers[4]=ff
numbers[5]=ee

ethtool -E eth0 magic 0x$KEY offset 0x7e value 0x${numbers[0]}
ethtool -E eth0 magic 0x$KEY offset 0x7f value 0x${numbers[1]}
ethtool -E eth0 magic 0x$KEY offset 0x80 value 0x${numbers[2]}
ethtool -E eth0 magic 0x$KEY offset 0x81 value 0x${numbers[3]}
ethtool -E eth0 magic 0x$KEY offset 0x82 value 0x${numbers[4]}
ethtool -E eth0 magic 0x$KEY offset 0x83 value 0x${numbers[5]}

echo ethtool -E eth0 magic 0x$KEY offset 0x83 value 0x${number[5]}

Had some problems finding the the magic, but after that it was all downhill

eth1: flags=4163  mtu 1500
        inet 10.45.21.205  netmask 255.255.254.0  broadcast 10.45.21.255
        inet6 fe80::c2ff:eeff:fec0:ffee  prefixlen 64  scopeid 0x20

        ether c0:ff:ee:c0:ff:ee  txqueuelen 1000  (Ethernet)
        RX packets 43102  bytes 8804897 (8.3 MiB)
        RX errors 0  dropped 15  overruns 0  frame 0
        TX packets 7729  bytes 1102903 (1.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  

]]>

786
2012-10-02 11:16:20
2012-10-02 18:16:20
open
open
macs
publish
0
0
post

0


_wordbooker_thumb



_wordbooker_extract

#!/bin/bash
echo "setmac to $1"
numbers=(`echo $1 | tr ':' ' '`)
echo ${numbers[0]}

KEY=669955aa
numbers[0]=c0
numbers[1]=ff
numbers[2]=ee
numbers[3]=c0
numbers ...]]>


_wordbooker_options



_edit_last



http://vpls.us/?p=792 Thu, 04 Oct 2012 18:17:52 +0000 timc
http://vpls.us/?p=792


RFC 2544 Applicability Statement: Use on Production Networks Considered Harmful

2544 is to be considered Harmful :) oh wow, so we've been using testing procedures that are to be considered harmful. Yeah, we knew all that :P We just haven't had many other options. The new Y.1564 standard that is out from the ITU-T is going to go a long way towards rectifying a lot of the problems of testing Ethernet in the last mile between the PE and CE. However, what is really a Gem is hidden in the back of that little document. Back in Appendix I. CBS and EBS test methodology. It describes the tests that are included to be preliminary or experimental, and for informational purposes only. I'm not sure why that is, perhaps the tests really aren't applicable to a real world test and probably more geared towards the testing of lab gear? I guess that would be my initial guess as to why they weren't included in the formal document. However for the lab. OH YEAH. This is cool. E.3 basically lets the tester, run tests against the hardware buffers to determine the buffer capacity.

Let me repeat that. E.3 allows a tester to test the buffer capacity of a circuit / interface / hardware / switch, etcetra.... Line item 4 on E.3 says to test EBS.

the transmitter turns off for the smallest amount of time necessary
to ensure that the B-e token bucket is full and has overflowed by an amount
equal to or greater than 2%(EBS). Then the transmitter bursts the largest
number of back-to back (minimum interframe gap) frames that will drawn down
the Be token bucket until the number of tokens is more than or equal to

Being the geek that I am, I was drooling when I read that. I've been burned by so many switch vendors that don't allocate enough buffer space to their small interfaces on a switch and the first time you try to send traffic from the core to the edge interface in that box, it' pukes, or more specifically just starts puking packets out of it's buffers, making customers call in and complain. The customers calling in and complaining is by far the worse.

The only draw back is that I have to ask the vendors if they support ITU-T 1564 SAM Appendix I
]]>

Sunday, August 2, 2020

Temperature Collection for Rasp PI / Linux USB Attached probes

It all starts with Cron. I use it pretty heavily :)


0,5,10,15,20,25,30,35,40,45,50,55 * * * * /home/digitemp/bs.s0 1> /dev/null
1,6,11,16,21,26,31,36,41,46,51,56 * * * * /home/digitemp/bs.s1 1> /dev/null

Gotta have a remote drive mounted with Samba…

/cp1/digitemp  /home/digitemp  cifs      user=timc,pass=[password],vers=3.0        0   0

Gotta call a shell script that calls the reader and the conf file

root@bs:~# cat /home/digitemp/bs.s0
#
#  1/19/19 TimC - rm digitemp file to put clean number in
#  updated via cron every 5 minutes
#
#  use /etc/digitemp directory for conf files & exec of this
#  use /tmp for current temp reading
#
/usr/bin/rm /home/digitemp/bs.s0.temp
/usr/bin/digitemp -c /home/digitemp/bs.s0.conf -a -l /home/digitemp/bs.s0.temp

conf file

root@bs:~# cat /home/digitemp/bs.s0.conf
TTY /dev/ttyUSB0
READ_TIME 1000
LOG_TYPE 1
LOG_FORMAT "%.2F"
CNT_FORMAT "%b %d %H:%M:%S Sensor %s #%n %C"
HUM_FORMAT "%b %d %H:%M:%S Sensor %s C: %.2C F: %.2F H: %h%%"
SENSORS 1
ROM 0 0x28 0xFF 0x64 0x1E 0x1D 0xC6 0x77 0x54
root@bs:~#

which results in a single value (temperature)

root@bs:~# cat /home/digitemp/bs.s0.temp
101.97
root@bs:~#

Then of course it’s on a remote drive cp1:/home/digitemp
which is also using cron :)

4,9,14,19,34,29,34,39,44,49,54,59 * * * * /home/mrtg/temp/temp.sh &> /dev/null

which calls mrtg

root@cp1:/home/digitemp# cat /home/mrtg/temp/temp.sh
/bin/mrtg /home/mrtg/temp/temp.cfg
root@cp1:/home/digitemp#

mrtg config :)

root@cp1:/home/digitemp# cat /home/mrtg/temp/temp.cfg
# 10/12/18 added /bin/cfgmaker public@lo  10/12/18
### Global Config Options

WorkDir: /home/mrtg/temp/
Options[_]: gauge pngdate expscale fixunit nomax nototal nopercent unknaszero noo
MaxBytes[_]: 125
ABSMax[_]: 125
YLegend[_]: Fahrenheit
ShortLegend[_]: Fahrenheit
LegendI[_]: Temperature
Legend1[_]: Temperature
Options[_]: integer, gauge, nopercent
Colours[_]: RED#FF0000, WHATEVER#123456, DARKRED#800000, WHATEVER2#654321
Background[_]: #0a0a0a0
TimeStrPos[_]: RU
#Unscaled[_]: ymwd
#
#
#   ................
#   LOTS OF OTHER TEMPERATURE CFGssss
#
#---------------------------------------------------------------
#       bs 1 - Attic
#          USB RS485 serial port ttyUSB0
#---------------------------------------------------------------
Target[bs-s1]:  `/home/mrtg/temp/bs.s1.temp.sh`
Title[bs-s1]: Behind Freezer Temp sensor
PageTop[bs-s1]: <H1>Behind Freezer Sensor</H1>
PNGTitle[bs-s1]: Behind Commercial Freezer Temperature

which calls another script to gett it into the proper oid and 4 values for MRTG…

root@cp1:/home/digitemp# cat /home/mrtg/temp/bs.s0.temp.sh
#!/bin/bash
#
#  4 The external command must return 4 lines of output:
#    Line 1
#    current state of the first variable, normally 'incoming bytes count'
#    Line 2
#    current state of the second variable, normally 'outgoing bytes count'
#    Line 3
#    string (in any human readable format), telling the uptime of the target.
#    Line 4
#    string, telling the name of the target.
#
HOST=bs
SEN=s0
#
#
DATE=`/usr/bin/date +%m%d%g`
SNMPGET="/usr/bin/snmpget -v 1 -c public"
OID="1.3.6.1.2.1.1.3.0"
AWK="/usr/bin/awk -F"
#AWK1="/usr/bin/awk -F '=' '{print $2}' "
#AWK2="/usr/bin/awk -F ')' '{print $2}' "
ECHO=/usr/bin/echo
TEMP=`/usr/bin/cat /home/digitemp/$HOST"."$SEN".temp"`

#echo $AWK1
#echo $AWK2
UPTIME=`$SNMPGET $HOST $OID | $AWK '=' '{print $2}' | $AWK ')' '{print $2}'`

#UPTIME=`$SNMPGET $HOST $OID | $AWK1 | $AWK2`

#
$ECHO $TEMP
$ECHO $TEMP
$ECHO $UPTIME
$ECHO $HOST

root@cp1:/home/digitemp#

Which results in the following data set that mrtg can read

root@cp1:/home/mrtg/temp# ./bs.s0.temp.sh
101.97
101.97
9:28:50.05
bs
root@cp1:/home/mrtg/temp#

Simple really :) A lot of moving parts perhaps. Yeah, I like scripting I guess. It has some pretty cool graphs. I have about 15 of the probes measuring different parts of the house and then I have a web page running on cp1 that displays all of the temperatures. Most are running on pi zero’s but I have had a lot of problems with USB reliability on the Zero’s. Well I’m not actually sure if it’s a problem with the zero or a problem with the cheap ass USB probes. - Prolific Technology, Inc. PL2303 Serial Port which is essentially a single wire RS-485. I’ve tried unsuccessfully to get a multi-point RS-485 working, and finally just gave up over the abundantly prolific probes. for $10 a PI (zero w/header and wireless) and $3 for a probe. I can turn a new one up for under $15.00 with tax / shipping et all and it’s completely self contained. I’ve put a bunch into a 2 gang electrical outlet, that I hang off of a room outlet. It give me room to put in a cheap 2amp power supply with a couple cables and the probe and the zero.

I’ve also played around with Relays…. More on that later. I’m controlling my irrigation system and outside light timer using Zero’s…

If the above logic is confusing… The relays are even worse. A lot of it’s the same. But much of it’s different. I also have a few motion sensors and light meters and GPSs using the same zero’s But that’s all stuff for another post.

Questions? It’s not a how to, just a what ive done. If you want a how to go somewhere else.