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

Links 15/02/2026: Roy Medvedev Dead at 100, Rise of "YouTube Politicians"
Links for the day
Links 15/02/2026: How Alexey Navalny Was Executed by Putin, Erdogan Helping Iran
Links for the day
IBM Fedora Keeps Promoting Slop, Red Hat Has Been Turned Into Chaff and Trash to Help IBM's Stock (With "AI" Storytelling)
Red Hat's Fedora is an old brand (20+ years). It no longer stands for what it meant to people in the Fedora Core days (I was a Fedora user back then).
What IBM Said About 2026 Layoffs and What's Happening in Practice
t'll leave IBM at the very bottom, in due course (customers will notice something profound has changed)
Gemini Links 15/02/2026: "Already Midway February" and Loadbars Remembered
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Saturday, February 14, 2026
IRC logs for Saturday, February 14, 2026
Microsoft's Bing Down to 0.5% in Armenia
Microsoft does not want shareholders to see this
Libel by Bots: Unexplored Legal Area?
Liability can be traced back to the operator
Maybe Obvious, But Merits Repeating: A Lot of "Demand" for Slop is Faked, Manufactured, Fabricated by Dark Patterns, Bundling, Media PR (Deception/Hype) Campaigns
Over the past few years many products and services got rebranded as "AI"
xAI and X (Twitter) Live on Borrowed Time, It'll Get a Lot Worse Fast
Being associated with a child porn site formerly known as "Twitter" is odorous to say the least
Microsoft is Lobbying Brussels via Opensource.org and OSI
The new (GAFAM) management at OSI is not serving the OSI's original mission
Will Lockett's Newsletter: Microsoft became Microslop and Windows users are "flocking" to GNU/Linux "to escape the mess"
"Users are fed up and jumping ship from Windows to Mac or Linux. In fact, it appears that Windows has lost 400 million users since 2022!"
Photographic Collections
There are going to be over 100,000 JPEG, PNG, and GIF files by the time we turn 20
Norway Curbs Social Control Media as It Harms Norway's Society
A decrease from 11% to just 1.87% is possible to reason about
Accomplishments of Our Community
Why I enjoy writing in Techrights
Microsoft Invented a Slop CEO ("AI CEO") Because Real Interest in Slop is Waning, So It's Just Faking Its Prominence
It's noise
Google Promoting Slop, Not Journalism
The truth of the matter is, Google is part of this problem and it doesn't seem to care
Another IBM Company (Spawned by IBM) is Hiding the Scale of Layoffs, Just Like Red Hat and Kyndryl
Why is the scale of the layoffs there shrouded in secrecy?
Links 14/02/2026: Financial Woes in Hong Kong and "Hong Kong Journalists Face ‘Precarious’ Future After Jimmy Lai Jailed"
Links for the day
Gemini Links 14/02/2026: Fish Shell and Meta Slash-commands
Links for the day
Links 14/02/2026: "Bias and Toxicity in" Slop, Microsoft's Vista 11 System Update Breaks Systems Again
Links for the day
Links 14/02/2026: "Suppression of Free Speech" and "Climate Change Puts Winter Games on Thin Ice"
Links for the day
EPO "Cocaine Communication Manager" - Part I - Getting the Word Out About What the 'Alicante Mafia' Did to Europe's Second-Largest Institution
Can't everyone in the European media agree that letting cokeheads run Europe's second-largest institution is a terrible idea?
Richard Stallman in the United States - Part I - Huge Audience (Offline and Online), 'Cancel Culture' Attempted and Failed
the comeback of Richard Stallman (RMS) in the United States
GitHub Cannot Survive for Much Longer
Microsoft is trying to just hide the debt
Ed Zitron: Microsoft Is A Decaying Empire That Bet The Future On Making In Excess Of $500 Billion In New Revenue Within The Next 4 To 6 Years From AI — And It Hasn’t Made A Dime In Profit Yet
Microsoft bets its future on a bunch of nothing
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Friday, February 13, 2026
IRC logs for Friday, February 13, 2026
Gemini Links 14/02/2026: "Throwback VR Headset" and OFFLFIRSOCH 2026
Links for the day
IBM's Accounting Claims Don't Add Up
IBM is an enigma. To Wall Street is claims to be doing extremely well, but insiders tell the complete opposite.
Links 13/02/2026: "Cofounders Fleeing MElon’s xAI" and IOC Opposes Solidarity With Ukraine's Fallen
Links for the day
IBM is Becoming "Garbage In, Garbage Out" (GIGO) "Just like Arvind and Krabanaugh." (CEO and CFO, Respectively)
There are some decent new comments about IBM this morning
Gemini Links 13/02/2026: Square Function with Diode Network and Calls Against Discord
Links for the day
Links 13/02/2026: SUSE Uses Microsoft Internally, MElon's Company Helps Turn Epstein Files Into Child Abuse (After the Pornography Scandals)
Links for the day
If Your Company Lost About 30% of Its 'Value' in 3 Months, Then Maybe It Was Never Worth What You Claimed
Does that make sense?
Pleroma is Dying
The last social control media that I joined was Pleroma
African Browser Choices Show a Growing Problem in the World Wide Web
World Wide Web (WWW) becoming little but a transport layer for a particular proprietary application (Google Chrome) [...] we're back to the late 1990s
Asia and Social Control Media
statCounter reckons it's down from over 10% to just 3% since it began tracking those things
If You Want Digital Freedom, Then Follow Richard Stallman, the "Linux" Brand Has Changed and OSI is Microsoft (GitHub)
If you want something stable and predictable, then stick with GNU, the GPL, and GCC
Solicitors Disciplinary Tribunal and SRA Failing to Curb SLAPPs Against People Who Expose Wrongdoing
We'll soon show messages that we transmitted to politicians
Beware the Latest IBM SPAM, IBM is Already Down "After Hours"
After a harsh day in Wall Street IBM's shares area already down again (after trading hours)
Radicalism in Our Communities is Mostly Corporate, Not Grassroots
Infiltration and systematic destruction can be shallowly painted as "inducing manners"
Anonymous Threats Against My Wife and Against Yours Truly
Promoting GNU/Linux and condemning people who attack GNU/Linux is not a crime
Decades-Long Microsofter (Darryl K. Taft) and TIOBE Conflate Microsoft GitHub (Proprietary) With FOSS in Microsoft-Sponsored 'News' Site
We do not intend to do a lengthy debunking because we covered this subject several times in the past
Life Gets Better After Social Control Media
Don't become part of these experiments
statCounter Suggests Americans Are Dumping Social Control Media
Are Americans getting fed up with social control media and quitting in droves?
Back Doors and Fake Security
They've militarised everything, even people's home computers
Cost-Cutting and Book-Cooking at IBM
It's like cutting salaries by more than 50%
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Thursday, February 12, 2026
IRC logs for Thursday, February 12, 2026
Microsoft Cuts Continue, Visitor Center in Redmond Shut Down
This goes on and on, leading up to the next giant wave of mass layoffs