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

The term FUD (fear, uncertainty, doubt) was created to describe IBM's tactics and IBM is doing it again
Rob Thomas or "RT"
Slop is Distraction
LibreWolf will never include any of this slop nonsense, no matter if toggled on or off
Cult inquiry: Parliament of Victoria, last chance to have your say
Reprinted with permission from Daniel Pocock
Still Lots of IBM Departures
It's not that we lack evidence of IBM layoffs. It's just that we have ample evidence of the press not doing its job (or barely existing anymore).
The Register MS Standards: Promote a Ponzi Scheme in Exchange of Money
Once upon a time it was a serious publisher. Months ago it was taken over by a Microsoft person.
Dr. Andy Farnell: Time to Pull the Plug?
insightful, as usual
The Slopfarms' Business Case (or Business Model) Never Existed and Nowadays, in 2026, They've Mostly Collapsed
Hopefully by year's end many slop suppliers will be offline and slopfarms that rely on them throw in the towel
 
Solicitors Regulation Authority (SRA) Inaction and Incompetence - Part I - Introduction
The SRA is a sham. Many people know this already, but we want to document our own experiences with it.
Live Simply, Live Better
Life isn't about "collecting" possessions; it's about doing things that matter and accumulating knowledge so as to make better choices
Now That XBox is Pretty Much Dead and There Are Mass Layoffs at Microsoft
This means our predictions about Microsoft (and XBox) are "falling into place"
Gemini Links 01/03/2026: "In the Spirit of OFFLFIRSOCH" and "Delete Patreon"
Links for the day
ACM Lowers Its Standards for Age of Autocracy
IBM is more than happy to work with autocracies
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Saturday, February 28, 2026
IRC logs for Saturday, February 28, 2026
Internet Relay Chat (IRC) Turns 37.5
Can IRC reach age 75?
Gemini Links 28/02/2026: Loadbars 0.13.0, IME (Input Method Editor), and ColorColumn in Vim
Links for the day
Two EPO Strikes in March (Maybe More)
As per the SUEPO diary [...] We still have an ongoing series about the EPO, with several more series to start later
Why We Are Concerned About the SRA's Failure and What That Means to the Profession of Lawyers in the UK
Unregulated industries will lose their credibility as there is a threat of growing perception that they operate outside the law rather than practice law
Over 10,000 Pages/Articles Per Year?
Probably my most productive month, ever
Keeping Techrights Online 99.99% of the Time
Some time later this year we'll tell a very long story about how extremists attacked our webhosts
Teaser: The Next Series About the SRA, Which Would be Just as Effective as It It Right Now If It Had Zero Employees
the lapdog (of the "litigation industry") that is meant to be perceived as a watchdog
Richard Stallman, Founder of the Free Software Movement, Will be Giving Public Talk in Bern (Switzerland) in Less Than 12 Days
We are still doing a series about him and his talks
Slopfarms' Demise Looks Like the Beginning of the End (Lowered Demand for Slop)
Slop about "Linux" has gotten hard to find this past week
Links 28/02/2026: "Tehran’s Two-Tiered Internet", "Internet Under Fire"
Links for the day
When an Entire News Site is About One Topic (and One Topic Only)
Tomorrow we start a new series for the new month
Links 28/02/2026: Bill Epsteingate Admits Sex With Young Girls, "Epstein Files Are the Horror That Keeps on Giving"
Links for the day
IBM: Where Companies Come to Perish
thelayoff.com is censoring stories
Tech Layoffs Are Not Because of Slop, They're an Effect of a Rotting Economy and Tech Giants Being Too Deep in Debt
Block is rapidly sinking in debt
March in London Today Against Slop's Harms to Society (and the Environment), Starting at 12:00 GMT at the Microsoft OpenAI Office
Today there is a protest in London (UK)
Microsoft Mass Layoffs Have Officially Resumed, Microsoft's Waggener Edstrom/Frank Shaw Lied
"The former employees say this was a mass layoff"
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Friday, February 27, 2026
IRC logs for Friday, February 27, 2026
Links 27/02/2026: Block Cuts 40% of Its Workforce While Blaming Ponzi Scheme, Netflix Backs Out of Bid for Warner Bros.
Links for the day
IBM CEO and CFO Make It Hotter in the Kitchen
Who's gonna leave the kitchen while they cook the books?
Gemini Links 27/02/2026: Unlearning Literacy (Slop) and Firefox as Slop-ware
Links for the day
It Looks Like Linux Chief Linus Torvalds Made a Good Call Regarding Kent 'Slop' Overstreet
Having never met or even chatted to Overstreet, I'm not in a position to judge him
Links 27/02/2026: Slop Incompatible With Nuclear Codes, Chinese Slop "Chatbots Censor Themselves"
Links for the day
Please Report the European Patent Office (EPO) to Europol for Cocaine Abuse and Tampering With Witnesses and Media to Hide This Cocaine Abuse
there are already police reports connected to the matter
Like a Mafia: Kris De Neef and Nellie Simon, Who Help Campinos Cover Up Cocainegate at the EPO (Substance Abuse at the Highest Office), Are Bullying EPO Whistleblowers
They're all in this together [...] At this point, undoubtedly, the EPO is run like an organised crime operation. Nothing more, nothing less.
pulltheplug.uk Says the Internet Harms Us, Will March in London Tomorrow
Maybe the site is down due to high access demand
EPO Management Trying to Hide Cocainegate, Silence/Discredit Whistleblowers, and Probably in a Panic Due to the Strikes
At the moment, Johannes' mates are receiving over 100,000 euros as a reward for doing illegal drugs
Jim Zemlin's 'Linux' Foundation is the Real Link Between Linux and Pedophilia
It's about the deeds, not the words
The GNU Manifesto Turns 41 in March (Next Week)
And RMS turns 73 next month
The Sister Site is Still Improving the Static Site Generator (SSG) We Use in Techrights
We have a common mission and every week we make measurable advancements
Techrights is 100% Disconnected From Cheeto's America, the Problem is Hired Guns in London Helping Violent Americans Attack Us Domestically
Not a new problem, not limited to us
Greenland Needs to Disconnect From United States Tech to Protect Its Independence
The more Greenland protects itself from Social Control Media, the more robust or resilient it'll be to regime change
Open Source Endowment (OSE) Looking to Raise Money for Free Software, But It's Hard to Know who Runs the Open Source Endowment Foundation
Their Web site does not (easily) show who the Board of Directors includes
Apple Doesn't Want Anybody to Ask What Happened to Vision Pro
They lost a lot of money
Solicitors Regulation Authority (SRA) on Slop and Breach of Confidentiality
They should absolutely not ignore this
If You Want More Verifiable (Auditable) Security, Use GNU Linux-Libre
GNU/Linux will never be 100% secure
Microsoft XBox Can't Stop Talking About Slop
Will we see more "prepared" (under embargo) Microsoft propaganda released simultaneously at 9PM tonight?
Rust Will Not Inherit the Earth, It Barely Deserves a Place on the Planet
Rust - like Haskell and many other short-lived fetishes - will come and go
Truth Versus Fiction: IBM's Collapse Due to Money Crunch, Not Slop Disguised as Code
core issue is financial
Almost 5,000 Known Gemini Capsules
It is now just 98 short of 5k
Priceless leaks found in crowdfunding campaign
Reprinted with permission from Daniel Pocock
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Thursday, February 26, 2026
IRC logs for Thursday, February 26, 2026