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

Enshittification More Than a Century Ago
Is enshittification more than a century old?
GNU in 1991 (35 Years Ago): Compiler and Lots More Ready, Linux Now Becoming 'Vibe Heap' (Slop Replaces Real Code)
Without curbs in place, many Linux developers will flee
SLAPP Censorship - Part 147 Out of 200: The SLAPP Series is 'Slow' Because Timing Matters
It is important to stress that after this series is finished there will be many more series, with some of them showing raw evidence of what we've been illuminating and telling
The Slop ('Linux') Foundation Celebrates 35 'Linux' Years a Week After GNU/Linux Turns 43
they'll keep on trying to change history
FOSSY (SFC) Platforming GAFAM, Sells Endorsement
Houston, we have a problem here
 
Before the "Big Tech" (That Almost Everybody is Forced to Use) Was Controlled by Men Who Hate Women
Such rejection and even hatred of women qualifies/enshrines oneself as an "incel"- a dangerous and violent online cult
In Defence of Hoarding CDs, More So When Digital Restrictions (DRM) Come to More 'Content' and Even Offline/Physical Media Won't Work When Some Remote Server Says "No" (or Goes Offline)
made to serve and entertain owners, not to allow companies like Sony and Microsoft subjugate owners
Clownflare: In Finland, Birthplace of Linux Kernel, GNU/Linux Now Bigger Than Apple's MacOS
It's not just in Finland where we see such trends
More Mass Layoffs Due to Monumental Debt Excused as "Investment" (in Slop)
They're maxing up the private debt and their country is already insolvent
METRO Interviews Daniel Pocock a Day Before Election
The article is behind a wall that blocks people who block ads
Company-Wide 'Reorg' ('Redundancies') at IBM, Mark October 1st 2026 in the Calendar
Is Oct 1 the new Apr 1?
Even ZDNet Accepts That "Market Share" of GNU/Linux May Have Doubled on Desktops and Laptops
GNU/Linux is definitely growing, and quite quickly in fact
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Tuesday, August 11, 2026
IRC logs for Tuesday, August 11, 2026
Microsoft Layoffs and Shutdowns Continue This August, Morale Low, Employees Set Up Giant Inflatable Rat to Protest Against CEO
nothing demonstrates their anger better than what they did to the CEO
Gemini Links 12/08/2026: Sophomore Slump, Mandatory Phone Addiction, and Vintage Web Game Gallery
Links for the day
Summer Layoffs and 'Redundancies' (Cost-Cutting) at Microsoft and IBM
IBM is merely buying its revenue - an unsustainable strategy that aims to hide the company's rapid decline
Links 11/08/2026: Tensions South of China and Stingy "YouTube Doubles the Eligibility Requirements" (to Get Paid)
Links for the day
The Independent (UK) Today: "Independent candidate Daniel Pocock is concerned about media issues."
Let's see what results say around Friday
Gemini Links 11/08/2026: Stargate, Stargazer, Air-gapped Environments, and SystemVerilog Simulator
Links for the day
Keumars Afifi-Sabet Produces Useful, Informative Coverage Regarding Privacy
And it's good for Richard Stallman
Confirmed: Microsoft Layoffs in August 2026, Entire Operations Shut Down Too
Microsoft is just bleeding
Paying With Cash in 2026
Cash isn't going away. Not any time soon.
Blocking Tor Is Not a Solution, It's Paranoia
Tor is not a crime
Oligarchs and Their Footsoldiers Are Most Enthusiastically Loud About the Things They're Attacking
Like "Microsoft loves Linux"
Not Allowing Misogyny and Misogynists to Run the World
We stand with (and for) equality, justice, and freedom
"SPONSORED EXPLAINER" at The Register MS is Just More SPAM "Sponsored by HPE."
This is a great example of crap 'journalism'
IBM Won't Hire (or Hardly Hire) This Year
IBM is bluffing with buzzwords while shrinking out of existence and reducing salaries
SLAPP Censorship - Part 146 Out of 200: An Industry of Plagiarism, 'Normalised'
they pursue personal enrichment by stealing from Free software developers
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Monday, August 10, 2026
IRC logs for Monday, August 10, 2026
5.1k Capsules Known to Lupa, Gemini Protocol Crawler
If no limits (e.g. 10k max per capsule) were imposed on crawling, there would likely be millions of pages in the database
Gemini Links 11/08/2026: Waking Up Earlier, Whining About LLMs as Destructive Plagiarism
Links for the day
Links 11/08/2026: "The Enemy Is the Platform" and 'Vibe' 'Coding' Shown to be Little But Plagiarism
Links for the day
IBM's Age Discrimination Leads Workers to Contemplate Suicide While the CEO Becomes Billionaire for Lying to the Press and Faking Performance (Fraudulent Accounting)
IBM avoids issuing WARM notices
If Your Software Project Welcomes Bots, Then All You'll Have Left at the End Is Bots (Same for Sites Which Permit LLM Slop; They End up as Slopfarms and No Human Wants to Contribute Anymore)
A "slippery slop."
Clownflare Affirms Disturbing Trend of Web Monoculture (Which Extents to Clownflare Itself)
Clownflare itself is another layer of the same problem
The Open Web Is Not Coming Back
the open Web going out of control
Tell Me Something I Don't Know
Those who have a stake in the secrecy would do anything to maintain secrecy
Gemini Links 10/08/2026: Recollections and Washing Machine That Only Last a Few Years
Links for the day
Claims of Mass Layoffs at IBM (in Finance)
IBM tries hard to maintain an illusion of normality - to the point of viciously censoring critics and whistleblowers.
The Slop Bubble (Pyramid Scheme) is Becoming Bigger and Everyone Should be Terrified (Its Implosion Will Cause More Damage)
there's no plan for a turnaround
Microsoft and Apple Lose Ground to GNU/Linux in the United States
This contributes a lot to the international curve
Escaping Ads
When users do not want ads, then no ads should show up, period
For Second Year in a Row Software Freedom Conservancy (SFC) Loses Money (Over $3,000,000 Lost in 2 Years), Bradley M Kuhn Steps Down as Treasurer
lost almost $600,000 last year
Microsoft/GAFAM Operating at a Loss
Microsoft has financial problems
Nigel Farage crisis: Taylor Swift & Jeffrey Epstein both shunned cryptocurrency bosses
Reprinted with permission from Daniel Pocock
statCounter Now Sees GNU/Linux "Market Share Worldwide" at 9.21%, Soon 10%
If this data is more or less accurate, it's time for panic at Microsoft
Rumours of Impending Mass Layoffs in IBM's Yorktown Office, Impacting the LLM (Slop) Staff
Bubbles never last forever, hence their name
Links 10/08/2026: "Long COVID Linked to Lasting Damage in The Brain's Dopamine System", Microsoft’s Weather App Uses Over 1,000 Megabytes of RAM
Links for the day
Software Freedom Conservancy (SFC) Does Not Support Women, It Imitates Authentic Organisations, Embraces Misogynists, Then Projects
They try to monetise for personal gain at the expense of unpaid volunteers
When You're Evil and You're Publicly Attacking Something, That Something Will Become More Popular
when an oppressor becomes openly oppressive and does anything to squash/censor critics, the outcome will typically be detrimental to the oppressor
Links 10/08/2026: "Against Oligarch" and "The Invisible Women"
Links for the day
Social Control Media Deathwatch: After Nearly a Million Posts Sent EchoFeed Shuts Down
EchoFeed is hardly unique
When the LLM Chatbots Industry (Trillions in the Red) Quits Paying the Media for FOMO
fear of missing out, or FOMO for short
Microsoft Killing Morale
branding the process “inhumane” and “demoralizing”
Google's "AI Overview" as Proprietary Censorship Engine and Gatekeeper
People do not choose to use this, Google is just shoving that in people's faces, encouraging laziness and misinformation
SLAPP Censorship - Part 145 Out of 200: They Tried Hard to Hide the Fact Their Client Had Been Sued, Twice Even
A month ago Brett Wilson LLP tried to take my wife "to the side" (in effect isolated) to make her an offer
statCounter: GNU/Linux Up to 8.95% Globally
So the estimates are being "corrected" upwards, not downwards
Explaining How Someone Attempted to Cancel RMS This Year (and Failed)
The process itself involved debunking some falsehoods
Microsoft's "XBOX Ranks Last", IBM is Headed for Extinction
If Microsoft cannot dominate its own "home turf", what prospects are there elsewhere?
DebConf6 fight denied by Google artificial intelligence
Reprinted with permission from Daniel Pocock
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Sunday, August 09, 2026
IRC logs for Sunday, August 09, 2026
Gemini Links 10/08/2026: A Mild Monday, Sleepy Saturday, OUYA, and Moving to GNU/Linux
Links for the day