Bonum Certa Men Certa

Using a Single-Board Computer to Monitor IPFS

IPFS lights-based monitoring on self-hosted SBC
IPFS lights-based monitoring on self-hosted SBC (blue is for status, green and red for upstream and downstream payloads)



Summary: IPFS is light and simple enough to run from one's home, even on a low-voltage machine, and the code below can be used as a baseline for monitoring IPFS activity 24/7




#!/usr/bin/python3
# 2019-04-22
# 2020-11-07



from blinkt import set_pixel, show from random import randint,random,shuffle,randrange from time import sleep import argparse import signal

def solid(r,g,b,s): while True: for pixel in range(8): set_pixel(pixel, r, g, b) show() sleep(0.1)

def random_lights3(): while True: for pixel in range(8): r = randint(0, 255) g = randint(0, 255) b = randint(0, 255) set_pixel(pixel, r, g, b) show() sleep(0.1)

def random_lights2(): while True: p=range(8) p=sorted(p, key=lambda x: random()) for pixel in p: r = randrange(0, 255, 16) g = randrange(0, 255, 16) b = randrange(0, 255, 16) set_pixel(pixel, r, g, b) show() sleep(0.1)

def random_lights1(): while True: p=range(8) p=sorted(p, key=lambda x: random()) for pixel in p: r = randrange(0, 255, 8) g = randrange(0, 255, 8) b = randrange(0, 255, 8) set_pixel(pixel, r, g, b) show() sleep(0.1)

def spacer(r,g,b,seconds): while True: for pixel in range(8): set_pixel(pixel, r, g, b) next = (pixel+1)%8 set_pixel(next, 0, 0, 0) show() sleep(seconds)

def reversed_spacer(r,g,b,seconds): while True: for pixel in reversed(range(8)): set_pixel(pixel, r, g, b) prev = (pixel-1)%8 set_pixel(prev, 0, 0, 0) show() sleep(seconds)

def cylon(r,g,b,seconds): while True: for pixel in reversed(range(8)): set_pixel(pixel, r, g, b) prev = (pixel-1)%8 if prev < pixel: set_pixel(prev, 0, 0, 0) show() sleep(seconds) for pixel in range(8): set_pixel(pixel, r, g, b) next = (pixel+1)%8 if next > pixel: set_pixel(next, 0, 0, 0) show() sleep(seconds)

def pulsed_bar(r,g,b,seconds): steps=8 while True: for fade in reversed(range(steps)): r2=r*(fade+1)/steps g2=g*(fade+1)/steps b2=b*(fade+1)/steps # print (fade) for pixel in range(8): set_pixel(pixel, r2, g2, b2)

show() sleep(seconds) for fade in range(int(steps/1)): r2=r*(fade+1)/steps g2=g*(fade+1)/steps b2=b*(fade+1)/steps for pixel in range(8): set_pixel(pixel, r2, g2, b2)

show() sleep(seconds*0.5)

def ipfs(r,g,b,seconds): steps=4 # how many stages in gradient brightness=0.5 # how bright the lights will get bluebright=100 # the brightness of the blue light in the middle (0-255), albeit overriden by input dim=1 # increase to dim down the lights run = 0 # running count for periodic file access while True: # run always (until interruption) run=run+1 # first, open from files the required values, which change over time if (int(run) % 50 == 1): with open(r'~/RateIn', 'r') as f: # open from file the IN value # print(r) lines = f.read().splitlines() r=int(lines[-1]) # read the value # r=int(map(int, f.readline().split())) # prototype, for multiples (stale)

with open(r'~/RateOut', 'r') as f: # open from file OUT value # print(g) # show values, debugging lines = f.read().splitlines() g=int(lines[-1])

with open(r'~/Swarm', 'r') as f: # open from file Swarm value # print(g) # show values, debugging lines = f.read().splitlines() bluebright=int(lines[-1])/2 # print(bluebright)

for fade in reversed(range(steps)): # fade in effect # print(g2) # show values again, debugging # print(r2) r2=r*(fade+1)/steps/dim g2=g*(fade+1)/steps/dim b2=b*(fade+1)/steps/dim

# print(g2) # show values again, debugging # print(r2)

# print (fade) for pixel in range(3): # first 3 LED lights set_pixel(pixel, r2/20, (g2*brightness)+(pixel*1), b2/20)

for pixel in range(5,8): # the other/last 3 lights set_pixel(pixel, (r2*brightness)+(pixel*1), g2/20, b2/20) if (bluebright==0): set_pixel(3, 255, 255, 255) set_pixel(4, 255, 255, 255) else: set_pixel(3, 0, 0, 0) set_pixel(4, 0, 0, bluebright)

show() sleep(seconds/r*r+0.1) for fade in range(int(steps/1)): # fade out effect r2=r*(fade+1)/steps/dim g2=g*(fade+1)/steps/dim b2=b*(fade+1)/steps/dim

for pixel in range(3): set_pixel(pixel, r2/20, (g2*brightness)+(pixel*1), b2/20)

for pixel in range(5,8): set_pixel(pixel, (r2*brightness)+(pixel*1), g2/20, b2/20) set_pixel(3, 0, 0, bluebright) set_pixel(4, 0, 0, 0) show() sleep(seconds/g*g+0.1)

def flashed_bar(r,g,b,seconds): while True: for half in range(4): set_pixel(half,r,g,b) for half in range(4,8): set_pixel(half,0,0,0) show() sleep(seconds) for half in range(4,8): set_pixel(half,r,g,b) for half in range(4): set_pixel(half,0,0,0) show() sleep(seconds)

def handler(signum, frame): print("\nSignal handler called with signal", signum) exit(0)

signal.signal(signal.SIGTERM, handler) signal.signal(signal.SIGINT, handler)

# read run-time options

parser = argparse.ArgumentParser(description="Drive 'blinkt' 8-pixel display.") parser.add_argument("pattern", help="name of light pattern: \ random[1-3], spacer, reversed_spacer, cylon, pulsed_bar, flashed_bar") parser.add_argument("r", metavar="r", type=int, help="red channel, 0-255") parser.add_argument("g", metavar="g", type=int, help="green channel, 0-255") parser.add_argument("b", metavar="b", type=int, help="blue channel, 0-255") parser.add_argument("timing", metavar="s", type=float, \ help="rate of binking in seconds") options = parser.parse_args()

pattern = options.pattern.lower() r = options.r g = options.g b = options.b s = options.timing

if pattern == "solid": solid(r,b,g,s) elif pattern == "random3": random_lights3() elif pattern == "random2": random_lights2() elif pattern == "random1" or pattern == "random": random_lights1() elif pattern == "spacer": spacer(r,g,b,s) elif pattern == "reversed_spacer": reversed_spacer(r,g,b,s) elif pattern == "cylon": cylon(r,g,b,s) elif pattern == "pulsed_bar": pulsed_bar(r,g,b,s) elif pattern == "ipfs": ipfs(r,g,b,s) elif pattern == "flashed_bar": flashed_bar(r,g,b,s) else: print("Unknown pattern") exit(1)

exit(0)





Example runtime: run-blinkt-ipfs.py ipfs 0 0 0 0.00

Based on or derived from baseline blinkt scripts; requires the hardware and accompanying libraries being installed on the system.

For the code to run properly in the above form, given that it takes input from files, the IPFS values need to be periodically written to disk/card, e.g. for every minute of the day:

* * * * * ipfs stats bw | grep RateIn | cut -d ' ' -f 2 | cut -d '.' -f 1 >> ~/RateIn * * * * * ipfs stats bw | grep RateOut | cut -d ' ' -f 2 | cut -d '.' -f 1 >> ~/RateOut * * * * * ipfs swarm peers | wc -l >> ~/Swarm

These lists of numbers can, in turn, also produce status reports to be shown in IRC channels. When our git repository becomes public it'll be included (AGPLv3).

Recent Techrights' Posts

NVIDIA's Crisis Has Only Just began
NVIDIA Corp (NASDAQ: NVDA) is set to open in the red tomorrow
IBM Has Destroyed Red Hat and Hashicorp, Insiders Say It's the Usual From IBM:
Bluewashing is a death wave
Techrights Was Right About Slop Destroying Development Communities and Projects
Slop does not improve your project. It kills the community. Without community, what is left? A 'botfarm'?
Intercontinental Brigading - Part XXXXXI - Harassment Law and "Things Are Unfairly Asymmetric" (Exploring the Boundaries of Death Threats and Various Threats From America)
the sort of "technofascism" that our country must learn to confront rather than facilitate
Ethics in Perspective, Free Software and Morality
top clients of Jeffrey Epstein are one happy family
The Register MS Made Millions of Pounds by Participating in the Slop Hype Campaign (It's Still Doing It), Now It Admits That It's Just a Bubble
the slop frenzy played a role in the Microsoft meltdown
 
Vista 11 is Small
Can Microsoft survive the fall of Windows?
Six Richard Stallman and FSF Talks This Month (FSF Staff at Ohio State University)
Dr. Stallman's talks in Ecuador are well timed because of the collapse of the LLMs (slop) pyramid scheme
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Saturday, November 14, 2026
IRC logs for Saturday, November 14, 2026
Gemini Links 15/11/2026: "The Bastards Can Never Win" and "The Last Low-Tech Generation"
Links for the day
Links 14/11/2026: Wuhan Corruption and "Aid Isn’t Reaching Ebola’s Epicenter"
Links for the day
Rahul Kumar Has Turned tecadmin.net Into a Slopfarm That Promotes Slop and Microsoft (as Usual)
Slop promoting slop - a death knell of once-active "Linux" sites
Large-Scale Layoffs - Not Just PIPs - at Red Hat and IBM This Month
Mainstream media has quit covering mass layoffs
Links 14/11/2026: "The Claude Delusion" and "The Microsoft Outage is a Warning for the World"
Links for the day
Richard Stallman (RMS) at Universidad Central del Ecuador (Guayaquil), Cuenca, Campus Sur Universidad Politecnica Salesiana (Quito), and Ohio State University
Long live the message and mission of RMS
They Paid Workers in 'Shares' (That Lost Almost Half Their Value in One Month)
Welcome back 1999 or 2007
Intercontinental Brigading - Part XXXXX - Pyramid Schemes (Planned Plunder) and Canceled/Botched Surgeries Aren't "Funny", They Cause Serious Harm and Distress
We were right about Microsoft
Links 14/11/2026: "OpenAI Is Sustaining Enormous Losses" and Slop "Loses the Popular Vote"
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Friday, November 13, 2026
IRC logs for Friday, November 13, 2026
Gemini Links 14/11/2026: Code of Conduct, Back to Gemini, and Gemlog to Inbox
Links for the day
Slop Promotion, Including Paid-for Slop Promotion for So-called 'Linux' Foundation (Its Clients Are Slop Companies)
We've noticed a lot of this lately in "It's FOSS" and to a lesser degree in "FOSS Force"
Gemini Links 13/11/2026: Productivity Metrics and Antenna Outage
Links for the day
The Real Issue With The Register MS is Not the Politics of Some Staff's "Tweets", It's That The Register MS Publishes Fake Articles for Sponsors (50,000 Pounds Minimum)
AWS and Google each pay millions for fake articles which beget journalistic bias too (they literally pay the salaries of the 'reporters')
Microsoft Total Cost of Ownership (TCO): We Need Accountability Because Many People Die and It's Because of Microsoft Diehards or People Bribed by Microsoft to Deploy Microsoft Where Lives Are at Risk
They're trying to save face right now
What the Media Misses: It's Not an NVIDIA Issue, Super Micro Computer Inc Also Fell From $45 to $26 in the Period NVIDIA Lost 33% of Its Faked 'Value', NVIDIA is Collapsing Like Intel
History goes in circles
It's Not About China or Sex, It's About Corruption at NVIDIA and a Pyramid Scheme Perpetrated Under the Guise of "Hey Hi Revolution" (That Wasn't, It's Manufactured and Hyped by Bribes, Subsidised by Multi-Trillion-Dollar Loans, People's Pension Funds and More)
What's at stake here is a lot bigger than the "Ponzi hub" of Jensen Huang
No, You're Not a "Most Valuable Company" When Everything is Down for Half a Day in the Entire Planet
Still down, still no explanation (maybe they too aren't sure)
Waste of Money: Giving More Money to Toothless Regulators That Don't Even Examine Evidence
Shame in SRA
"Techrights Statement on Phoronix" Still Valid Five Years Later
Our position as stated in early 2022 has not changed
Vista 11's 'Growth' Has Stalled, It's Measured at Only 17.9% in the US This Year
That helps put in perspective Microsoft's attempt to discard almost 30% of its remaining workforce
"NVIDIA is Enron" (Subsidising the Pyramid Scheme That It Profited From), Microsoft is Next to be Down for the Count
Microsoft increasingly looks like the "next NVIDIA"
Richard Stallman Travels to South America to Give Talks About Free Software in Spanish, FSF Raises Money
The FSF is raising money (goal is $400,000) and the FSF has just mentioned the upcoming talks by the FSF's founder
United States Adding ~300 Billion in Government Debt Per Month, Wall Street Shaves Off Trillions in 'Value' in Less Than One Week
cushioning "assets" by helping them fake "value"
Microsoft: Pay Us for the Stuff That's Offline and We Cannot Fix
Learn to take control of the technology that you rely on
Links 13/11/2026: "Copyright-Strike-for-Hire" and "Stevie Wonder Photo Lawsuit"
Links for the day
The Slop Bubble (or Pyramid Scheme) Relied on Trust and Patience (Being Patient as Losses Grow and Debt Explodes, Trusting the Roadmap of Cheaters and Frauds)
Remember that it all began with trust
Anthropic's IPO Depends on $895.4 Billion in Debt (Money It Doesn't Have, It Loses Over 100 Billion Dollars Per Reporting Period), NVIDIA Has Just Lost Almost 2 Trillion Dollars In Value and Its Debt Trebled in Three Months
This coming week will be very, very entertaining for slop critics/sceptics to watch
At Microsoft, "Buyouts" or "Global Voluntary Separation Agreement" (GVSA) Not Much Different From Layoffs (Severance Shockingly Low)
From what we are able to gather, many people are leaving Microsoft 'voluntarily'
Is Microsoft the Next Fake-Valued Corporation to Lose 35% in "Market Value"? Is Slop Bringing Microsoft Down?
Will NDAs prevent people talking or journalists finding out the true cause?
Lorenzo Stoakes (ARM) the Latest of Many to Quit Linux Development Over Linus Torvalds' Obsession With Slop (Linus Wants to Work With Bots, Not Humans Who Understand Whatever Code They Write)
Linus caught the 'brain virus'
Silent Layoffs at IBM (and Red Hat) Continue in November 2026
IBM's CEO is "a Palliative Care Doctor Who Slides [IBM] Gently Into the Night"
Microsoft Asks 60,000 Workers to Leave, Some Leave, Services Go Down
Microsoft laid off about 40,000-50,000 people in past years
Gemini Links 13/11/2026: Roku Exits the Smart Home Market and Poor Reporting/Journalism Regarding Slop Plagiarism
Links for the day
Links 13/11/2026: "Apple Support Community Forums to Permanently Close" and "The Slop Market is Getting Nervous"
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Thursday, November 12, 2026
IRC logs for Thursday, November 12, 2026