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

Debian losses in Switzerland hidden until after DPL election debate
Reprinted with permission from Daniel Pocock
How to Dehumanise a Triple National
Don't be easily incited against those who sacrifice a lot to inform the public of suppressed topics
IBM CEO Says IBM Won't be Bankrupt by 2028 or 2029 (When He Reaches Retirement Age)
IBM has no path to survival
 
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Wednesday, August 05, 2026
IRC logs for Wednesday, August 05, 2026
Big Announcement Tomorrow
Stay tuned...
GNU/Linux Seen Exceeding 10% in Antigua and Barbuda
In Antigua And Barbuda, what's seen this month is not far from the average
Gemini Links 05/08/2026: Family Room, Smoke, and Alarm clocks
Links for the day
The Establishment, Oxford, Google & Debian artificial intelligence conspiracies
Reprinted with permission from Daniel Pocock
SLAPP Censorship - Part 140 Out of 200: You Become What You Eat, Your Clients Become You
In 2024 Brett Wilson LLP failed to heed a decade-old warning
Links 05/08/2026: Microsoft's (XBox's) "Devastating July" and "Never Write With" Slop, Says New York Times
Links for the day
Gemini Links 05/08/2026: No to Slop, Dangers of Clown Computing, and Reducing Internet Usage
Links for the day
analytics.usa.gov Says 7% of Sessions Come From GNU/Linux and ChromeOS. If ~40% (Mobile) Get Omitted, It's More Like 11%.
In desktops and in laptops GNU/Linux has become a big player
The Register MS Takes Money From NVIDIA and HP to Promote Their Ponzi Scheme, "AI", in a Fake 'Article' That Says "AI" 42 Times
"The media"... selling us scams for profit
Fertility app privacy, Britain's teenage pregnancies & faith based schooling
Reprinted with permission from Daniel Pocock
In Chile, GNU/Linux Approaches 4%
Let's see if it can exceed 5% by year's end
No Room for Misogyny and Incels in Free Software
How can we ever trust men whose own family and their own partners cannot trust?
In El Salvador, ChromeOS and GNU/Linux Now Measured at Around 12%
signs of gradual and steady adoption of GNU/Linux
Software in the Public Interest (SPI) Starts Spending Big Money in an Effort to Resist Lawsuit From Daniel Pocock
They've lost over half a million dollars in the latest 3 years
The Establishment, Cambridge, Steve McIntyre & Debian suicide cluster
Reprinted with permission from Daniel Pocock
Links 05/08/2026: Internet Archive Harmed by Slop Bot, "EBay And Former Execs Agree to Pay $56 Million For Trying to ‘Crush’ a Journalist"
Links for the day
Luxembourg and Software Freedom
Luxembourg's adoption of GNU/Linux has quite consistently been higher than the European average
The Free Software Foundation (FSF) Web Site is Online, GNU's Site Having Issues (Ongoing Issues)
We hope they can rectify the issues with the GNU Web site
Freedom Includes the Liberty to Disagree (and be Listened to, Not Censored)
Freedom is our collective strength
Tanzania: GNU/Linux Now Seen on 8% on Desktops/Laptops (User Clients)
numbers have more than doubled
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Tuesday, August 04, 2026
IRC logs for Tuesday, August 04, 2026
Gemini Links 05/08/2026: Being Good, Tildeverse and Tilde.pink, Games
Links for the day
Links 04/08/2026: GAFAM Expressing Concerns About Dangerous Disinformation by Slop, Bill Epsteingate-Connected Litigation Firm Salivating Over Europe
Links for the day
Gemini Links 04/08/2026: Root Shell and "Duty of Care"
Links for the day
Alternate Data (Not IBM's Headcount) to Show Mass Layoffs' Effect at IBM (Despite Many Acquired Workers Via M&amp;A)
mass layoffs at Hashicorp and at Confluent this year (media did not cover either).
Big Blue's Quiet Axe - Poem Regarding IBM "RAs"
No idea who posted this, but it is profound
Growing Proportion of Linux Commits Being Made by LLMs Not a Sign of LLMs Working, It's a Sign of Linux Development Being Shifted From Community to GAFAM and Other Slop Pushers
antagonist became apologist
Worse Than "Taking Your Job", the Slop Pyramid Scheme Will "Take Your Pension"
This will not end well
Abundance of Fake (Sometimes Paid-for) 'News' About IBM Will Discredit the Media as a Whole
In 'the news' today
Microsoft is Trying Vapourware Again (to Keep Developers and Gamers From Fleeing)
For XBox, the main thing over the horizon is additional layoffs
statCounter Reckons 12.33% of Web Traffic in Gambia Can be Attributed to GNU/Linux, Even 15% If Adding ChromeOS
Will this be sustainable?
Reminder: The Pedophilia Problem Comes From the Accusers
Attacks on Richard Stallman are a distraction; his accusers are themselves the culprits
SLAPP Censorship - Part 139 Out of 200: Solicitors Regulation Authority (SRA) Needs More Public Scrutiny (New Management Changed Nothing, It's Costing a Lot of Taxpayers' Money)
millions or maybe billions of pounds wasted
Rumours of Further IBM Shutdowns
IBM is going out of existence
Brigading Against Women - Part II - Threatening Women Using the Human Rights Tribunal of Ontario (HRTO) and Then False Threats Miscarrying the Name of a Court
In this series we intend to show the threats, the outcomes of those threats, the response to those threats
Collapse of MElon Companies a Taste of What's to Come for Slop Bubble and GAFAM (Trillions in Debt, Justified as Slop "Investments")
One good example of this was SpaceX
The 'Hyperinflation' in Hardware Dooms Video Hosting (Very Large Files)
a terabyte of video files would be expensive
Rumours of Silent Layoffs in Microsoft This Month (August 2026), PIPs and Global Voluntary Separation Agreement (GVSA), aka "Buyouts"
Will any investigative journalism follow or just shallow puff pieces and LLM trash from slopfarms?
Links 04/08/2026: "Framework for Musician Burnout" and Alexa+ "is a Buggy Embarrassment"
Links for the day
Signs That XBox as a Console is Coming to an End, Windows Gaming Will be Called "XBox"
"XBox" is the next "Surface"
Microsoft's Share in Search Falls Sharply in Europe
The layoffs at Microsoft's Bing will carry on
Romania: GNU/Linux Reaches 4% (Less Than EU Average)
We expect this same upward trend to carry on
Microsoft Sites or Sites Sponsored by Microsoft Angry That GNU/Linux is Gaining
The Microsofters cannot easily dismiss reports of GNU/Linux growth as "bots" or just allege that statCounter alone is wrong
Ableism in the Free Software Movement Typically Comes From GAFAM Operatives and Proprietary Software Apologists
And their hired guns
Afghanistan: GNU/Linux Steadily Rises to 9%
Windows is steadily declining
IBM Innovation: It Has Invented New Methods of Silent Layoffs or Secret RAs
How IBM disguises mass layoffs now
Many Anniversaries
Many anniversaries in quick succession
LLM Slop Won't Replace People and Jobs (in the Long Run)
At the end of the day, people who know their job offer more useful information, whereas LLMs waste people's time (typically an 'externality' to the entity deploying chatbots)
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Monday, August 03, 2026
IRC logs for Monday, August 03, 2026
Over 3,500 Known Gemini Capsules Accessible and Active According to Lupa
It finally happened this morning
Gemini Links 04/08/2026: Library Cards, Dead Ends in Software Development, and DOS on USB Key
Links for the day