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

Linux Foundation an Enemy of the Planet, Proponent of Pollution and Global Heating
"could the "polluters pay" model be extended to the computing environment and used to take on Microsoft and Microsofters?"
Not Everything Can be Automated
not a new thing
IBM is Not Done Destroying Red Hat, Wait Till October 1st 2026 (More Layoffs and Bluewashing)
It's not bluewashing 'til it's 100% done
Only a Matter of Time Before IBM Drops to $199 or a Lot Lower Than That
How long can IBM overload empty shells?
Lots of Microsoft Just Loses Money, Not Earning Money
Due to profitability challenges it's hard to believe Microsoft will ever find a buyer for XBox
 
Same 'Journalists' Who Published Fake News for IBM (Pump and Dump) Now Write Puff Pieces About the Stock Falling
the media is so compromised
They Called It "Social" and "Media", But It Turned Out to be Slop and Child Porn
Why do any sane people still use social control media?
Age of consent: DebConf26 registered sex offender in Argentina?
Reprinted with permission from Daniel Pocock
European Patent Office (EPO) Series: In the Pole Position Despite a Dismal Track Record
António Campinos is an old hand when it comes to such high-level institutional intrigue
Site a Bit Slower Due to Visitors' Load
We'll try to work out better speeds
Gemini Links 22/07/2026: Emacs, Astrology Clock, Arduino, and Rogallo v1.0.0
Links for the day
After Involvement by the Free Software Foundation (FSF) LibreTech and Quibble Gain More Participants
RMS expressed gratitude for people who worked on Quibble and improved LibreJS after many years of inactivity
The Lessons From the Assange Saga
This will not end well
Apple Will Increase Surveillance of Customers, Record Verbal Communications Under the Guise of "Hey Hi"
Apple now drinks that same Kool-Aid
Dave Winer, Blogging Pioneer, Sells Out, Spews Out LLM Slop to Readers
Another one bites the dust [...] Now it's a slopfarm of sorts
GNU/Linux OS in ComorOS
Now, as in recent years or the last year, the GNU/Linux "signal" is growing significantly
Microsoft Redefines "Layoffs" to Give Smaller Tallies
It's not just calling them "buyouts" or saying people are merely "leaving" or "retiring"
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Tuesday, July 21, 2026
IRC logs for Tuesday, July 21, 2026
"LF Sex", Nothing to Do With Linux
a lot of explaining to do this week
Gemini Links 21/07/2026: Nostalgia, Shogi, and New Gemlog System
Links for the day
Guyana: GNU/Linux Rises to New High, 7%
Guyana is part of the trend
Oman: GNU/Linux Up to 7%
It was 5% last year
The Solution is Never 'Free Hosting' in Proprietary GitHub (Microsoft), the Solution is Self-Hosting
Third parties never care about your projects as much as you (yourself) care about them
From GAFAM's Perspective, Jeremy Bicha Did Nothing Wrong
All is OK as long as he does not criticise monopolists and billionaires
Bluesky Was Such an Utter Failure That After 18 Months Mozilla Goes Hug a Nazi Platform That Produces Child Porn
What compels Mozilla to come back there? The child pornography scandal? The adorable leader?
GNU/Linux at Grenada Measured at 14% This Month
GNU/Linux was stuck at 0% for a long time
In WordPress, Newer is Not Better (Maybe Better Off With No WordPress at All)
To Hell with bloat and feature churn
As Slop Bubble Implodes (Inevitable), the Dishonest, Corrupt, Compromised Media Tries to Blame "China" Again (Like it Did With "DeepSeek" in Past Years)
Here we go again. We've been there before. Same spin, this time not "DeepSeek" though.
Red Hat (IBM) Has Long 'Reassigned' (Bluewashed) Red Hat Staff to Ruin Fedora, Now It Does the Same to GNOME
What next from IBM's Krishna?
Links 21/07/2026: Google Stagnating, Slop 'Apps' Are "Flooding Apple’s App Store"
Links for the day
Gemini Links 21/07/2026: OPNSense Upgrade Problems, Zilog Z80 at 50, and Lessons From Terminator
Links for the day
IBM Lawsuits Over Alleged Fraud Are Piling Up
We'll keep an eye on the lawsuits
Arianna Taite on Odds of Australian (Daniel Pocock) Winning Clacton By-Election
His detractors somehow try to twist or frame him (Pocock) as an impediment to women while the exact opposite is true
This Coming Weekend Marks 4 Years Since We Dumped Content Management Systems (CMSs) in Favour of Static Site Generators (SSGs)
the first page dated July 25
Slop's Latest Casualty: The Credibility of Linus Torvalds
If you care about millionaires and billionaires, follow Torvalds (he is already in that "club")
Techrights Will Become More Productive (More Output) Over Time
Big stories about to land
Touch Grass
Happiness involves what humans have evolved to appreciate, not what humans create to sedate the mind (like skinnerboxes)
The Cyber Show on Technology Having Become a Tool of Mass Psychosis, Not Enablement or Emancipation
Technology as mass psychosis
The Rumour Said That a Second Wave of Microsoft Layoffs Would Come This Week (Ahead of Fake 'Results'), Maybe Tomorrow
Let's wait and see how "MSM" unfold
To Wikipedia, "Notability" is Just an Excuse to Hail People Who Serve Billionaires While Marginalising or Defaming the Rest
Wikipedia is an advertising space
Our Series About Solicitors Regulation Authority (SRA) and SLAPPs Will Resume Soon
Originally, in 2025, we gave ourselves 6 years (until 2031) to cover these issues, but we've seen since extended that to 10 years (until 2036) because of the amount of material we have
European Patent Office (EPO) Series: The EPO Transparency Gap
Despite the "European" tag in the organisation's name, the European Union has no jurisdiction over the European Patent Organisation
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Monday, July 20, 2026
IRC logs for Monday, July 20, 2026
Links 20/07/2026: Lashes for Songs in Iran, Kurdish Language at Risk
Links for the day
Gemini Links 21/07/2026: The Boss Baby (2017) and 2026 Old Computer Challenge Epilogue
Links for the day
Canonical Staff Acting Like They Aim to Receive Job Offers From Microsoft
There are moreover allegations that Debian will do the same, in the same way Mono boosters infected both distros in tandem or in turn.
Worsening Staff Affairs at Microsoft
Microsoft is managing to piss off many of its own workers
Czech Mate for GNU/Linux on the Way
Czechoslovakia is having none of that "peace for our time" with Microsoft
Nobody Will be Left Who Trusts IBM Anymore
The common theme is, the management must be completely replaced as soon as possible and truth needs to come out
Wall Street is a Bubble and No Company is Worth 5 Trillion Dollars
It's not hard to see which stocks will crash the hardest (or fastest)
The Corrupt Have Historically Tried to Paint Their Exposers as the Real Problem
As usual, there are efforts to shoot or muzzle the messenger
Search Engine Market Share in Italy: Microsoft Falls to Third in Many Countries Including Italy
Expect more layoffs in Bing
Links 20/07/2026: Spotify Drowning in Slop, Expiry of Software Patents in MPEG-4
Links for the day
Gemini Links 20/07/2026: Another Step Towards Owning Personal Data and Gemtext2 Envisioned
Links for the day
European Patent Office (EPO) Series: Public Missions and Private Ambitions
Despite the French government's strong formal pushback, the lobbying momentum generated by Campinos and Negrão proved unstoppable
"DOOM" and "Bloodbath": the State of Microsoft and XBox
Way to piss off fans
Karen Melchior Fought the Good Fight
stay tuned for Part 29
Links 20/07/2026: Notes on E-mail Encryption, Torvalds and His Employer Paid a Lot to Promote Slop (Pyramid Scheme)
Links for the day
What a Difference Six Years Make...
We are also beta-testing a new feature for the site; we plan to announce it some time soon
When It Comes to Slop, Richard Stallman is Opposite of Linus Torvalds
When it comes to computing, Dr. Stallman has long been a voice of reason
Daniel Pocock is in Mainstream Media This Week
Pocock's haters will absolutely hate this
In His Departure Post, Poul-Henning Kamp (phk) Explains Why Linus Torvalds is Full of "Hot Air" and Slop Bubbles
Having lived through previous bubbles as a UNIX geek, phk cannot be ignored
Whistleblowers Keep Flowing
Later today a police investigator should phone us regarding death threats we've received
We Need Less Gadgets, More Humanity
If people are being honest with themselves, many of the gadgets they claim they "cannot live without" are just excesses and distractions they could definitely leave behind
Technology and Gadgets Got Obese, Just Like Their Users
They now sell us so-called 'phones' for slop
Daniel Pocock in The Guardian This Morning
There is an opportunity here to spread a message, even if Pocock won't win a seat
"Samsung Recently Projected a 19-fold Surge in Second-Quarter Operating Profit", Now There Are Mass Layoffs
In a 9-month period Samsung's debt rose by about 80%
Gemini Links 20/07/2026: Dungeon Meshi/Undertale Crossover, "The Hitchhiker’s Guide to the Dark Web and Beyond"
Links for the day
IBM's Control of the Media "Just Showed What Taking Accountability Does Not Look Like"
It is no secret that IBM pays the media
Microsoft Loses XBox Lawsuit, But There Are More
The collapse of studios continues
GNU/Linux Approaching International Average in Djibouti
One can envisage further gains for GNU/Linux, seeing Microsoft is in such a bad shape
Daniel Pocock "[t]he Australian Taking on Nigel Farage — from Down Under"
This can help raise awareness of some issues
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Sunday, July 19, 2026
IRC logs for Sunday, July 19, 2026