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:
Tuesday, August 25, 2020
Flight Aware
I started running Fligtaware from my home the other day 8/1/20
With a (5 / 7) DBi Antenna
Flightaware Opens in a new Window
and then again on 8/15/20 with another antenna (9 / 10 / 12 DBi)
Flightaware 2
Opens in a new window
The 5/7 is on the roof. The 9/10/12 DBi is in my office.
Going to be putting the larger antenna up on the roof in the near future.
Monday, August 24, 2020
Communion
So one of my favorite Cartoonists Ralph Bakshi wrote a movie called Wizards in thee 70’s.
I’m a new catholic. Or not actually a Catholic yet. I’m just going through their indoctrination phase right now. Anyway, Every time I see the Bible March or Communion. I see the Scene from Wizards where the two priests are caught “sleeping” in the temple and they have to do their “thing”.
It’s a hilarious movie and was kind of a cult movie while I was in college.
I have several of his signed Cells from that movies. Probably 5 or 6. I’m working on getting them framed and up on the walls. Maybe someday I’ll get them displayed ;)
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.