Archive for May, 2021
Converting SuperMicro BMC Sensor Temperatures from Celsius to Fahrenheit
If you’ve ever used a SuperMicro BMC before, you’ve no-doubt seen the temperatures section under Server Health => Sensor Readings. These are always expressed in Celsius, but sometimes you want to quickly convert those to Fahrenheit so you can compare them with other data/sensors.
Enter Tampermonkey! I’ve been using Tampermonkey under Firefox for the last few years to re-skin/re-theme Salesforce, Greenhouse and 1/2 dozen other sites I use, some of them in very extreme ways, adding features and functions that the parent site itself doesn’t have or support.
In this case, this is a very simple snippet that will parse the sensor table and convert the Celsius values to Fahrenheit for you, just by loading the page. The code is:
// ==UserScript==
// @name SuperMicro Sensor Conversion
// @namespace https://192.168.4.50/
// @description Convert the SMC Sensor outputs to Fahrenheit vs. Celsius
// @include /^https?://192.168.4.50/.*$/
// @author setuid@gmail.com
// @version 1.00
// ==========================================================================
//
// ==/UserScript==
'use strict';
setTimeout(() => {
document.querySelectorAll('div[id="HtmlSensorTable"] > table > tbody > tr > td').forEach(node => {
if (node.innerText.includes(' degrees C')) {
var temp = node.innerText.match(/(\d+) \w+ \w/)
var fah = (parseInt(temp, 10) * 9 / 5 + 32).toFixed(1);
}
node.innerText = node.innerText.replace(/(.*?)(\d+) degrees C/, `$1 ${fah}° F)
});
}, 500);
I tuned that a little more, by adding the degree symbol, instead of the words ‘degrees’, which now looks like:
It could be refined even further, targeting the inner iframes that this table resides in, or converting to React, but this was a quick 30-minute hack to solve a specific need I had.
Note, you can also get these same temperature values programmatically, via the RedFish API, if your chassis is properly licensed to permit it.
My homelab gets VERY warm during the day when the gear is running at full tilt, so I picked up a Govee Temp/Humidity sensor [Amazon link, not a referral or affiliate link][Govee main website product link], and it’s been very enlightening, showing me more about the trends in my office than I had visibility into before.
Here’s the last week’s temps and humidity in my office/homelab:
The only downside, is I can’t figure out a way to automate pulling/exporting this data, so I can import it into my Prometheus server and graph it with Grafana. Of note: I just taught myself Prometheus + Grafana tonight while adding all of my servers + UPS into it for monitoring. The UPS took a bit more effort, as it’s only using SNMP. I’ll go into more detail on that in future blog posts.
The 29th Anniversary of the Accident the Changed my Life
29 years ago to the day, on May 9th, 1992, I was ejected through the windshield from the back seat of the car I was traveling in with two of my friends at the time. I wasn’t wearing a seatbelt, because I was sitting in the center of the back seat, having a conversation with the driver and front seat passenger, and BAM, we were hit head-on by a car of elderly women who swerved into our lane doing about 40mph in each vehicle.
A single 4″ fracture in my skull, 7 spiral fractures in my right leg and a broken right elbow, as I bounced across 2 lanes of traffic and into the grass on the other side of the road. I also lost my sight for 5-6 hours, and went in and out of consciousness during my 6-hour stay in the hospital.
I was brought by ambulance to Windham Hospital but had no overnight observation, no casting of my fractures, no other treatment other than a few sutures to my right elbow and I was released back into the world. I also have (what will probably be) lifelong tinnitus as a result of slamming my head through the windshield.
I limped into the ER waiting room and had no idea where I was, or even who I was. I had complete and total amnesia and some serious pain and trauma. I was wearing a Casio databank watch at the time with phone numbers stored in it. I sat in the lobby of the ER on the payphone, dialing number after number from my watch, until someone recognized my voice and could bring me home.
As a result of this one car accident, I lost ALL memories from the first 20 years of my life. It took me over 2 decades to stitch many of those memories back together, but there are still big gaps. Imagine being given a shoe box filled with black and white Polaroid photos you’ve never seen before from someone else, and asked to put them in chronological order. That was my life for nearly the last 3 decades.
This accident permanently changed my ability to sleep “normally”, but I gained an eidetic memory as a result. The eidetic memory is the most interesting part. I can remember so many things now with razor sharp clarity, but that also includes all of the painful memories I’ve experienced since the accident.
It’s been long, difficult recovery, but I’m glad I’m still able to walk, talk, laugh, share and learn in this world.
My life has had so many weird twists and turns, but this one event, was a clear and obvious pivot point that helped define who I am today.