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

IBM's Anderon is Like Theranos, But Will Anybody at IBM or Anderon Be Imprisoned for This Billion-Dollar Scam?
Will anyone ever be held accountable for it?
Microsoft Demands That Staff Keeps Silent About the Mass Layoffs
Way to cause anger and ensure whistleblowers will go to the media
ITwire Became Slop and Spam
The site still exists, but it's not what it used to be
W3C Died 20 Years Ago, Now We Live in a Post-W3C Era. Linux Foundation is 'Slop Bros', Now Linux is Becoming Unfree.
Torvalds is on the same side as Epsteingate
 
The Local Staff Committee Munich (LSCMN) Speaks of Deterioration of Working Conditions at the European Patent Office (EPO)
"At least 3 days per week in the Office for an allocated office"
Gemini Links 14/10/2026: GemPub, Randogoth Forge F-Droid Repo, Oddμ, and Kolibri
Links for the day
Bluewashing as Silent RAs: A "journey that began at Neudesic [...] and continued as part of IBM" inevitably came "to a close"
IBM can be antagonistic and reckless with whatever it buys
Links 14/10/2026: Houthi Attacks on KSA and Airstrikes Near Sudan-Egypt Border
Links for the day
No Coronation for 'Cocaine King' Campinos (Not Yet Anyway)
A flash update suggests perils exist and we must all wait until December as the position for EPO President may open
In Reddit, Moderators of IBM Subs Are Allegedly on IBM's Payroll (IBM Can Censor Discussions About IBM)
There also seem to be PIP layoffs in India
If Worthless Companies Are Valued at a Billion Dollars in the Slop Industry, Then What Is the True Worth of 'Trillion-Dollar' Companies?
Definitely not a bubble!
It Sounds Like Microsoft Plans to Lay Off Over 2,000 Azure (Microsoft) Workers as the Datacentre Business Brings Nothing But Epic Debt
Trillions in losses is not a solid business plan
Microsoft XBox Won't Survive, Microsoft's CEO for This Perishing Business Turns to Slop
What the founder or father of XBox said about Asha Sharma earlier this year turns out to be accurate
Links 14/10/2026: So-called 'AI' Giants Go Bankrupt, "Military Will Hack the Election"
Links for the day
Indoor Season
we have more planned in order to improve navigation, accessibility, and workflows
Microsoft Has Had Mass Layoffs in Azure Every Year Since 2020 and the Bleeding Continues Because It Misreports Earnings There
This is a bad week for Microsoft
Microsoft's International Mass Layoffs (Asia, Europe, Africa), Now Vietnam
A crisis that Microsoft is unable to hide
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Tuesday, October 13, 2026
IRC logs for Tuesday, October 13, 2026
Gemini Links 14/10/2026: Ceiling Fan, Fascism, Democracy, and Slop Being a Huge Bubble
Links for the day
Reports of Stress and Layoffs at Microsoft, Some People Laid Off Under the Guise of "Ban" (Gift From the Administration) and Many Sacked in India
"pip and gvsa" layoffs in India
We're Way Past the Point Where Companies Announce or Declare Mass Layoffs
Layoffs are becoming hidden
Linux Kernel to Hide the Slop to Avoid Backlash, Suggestion Made by Former Microsoft Employee While Another Former Microsoft Employee is Worst Slopper/Culprit in Linux
Did Torvalds listen to slop antagonists?
Solicitors Regulation Authority (SRA) Besieged by Blind Justice UK, Politicians Increasingly Involved
"Today we have written to Members of both Houses of Parliament"
Vance Has Helped Microsoft Implement Secret, Silent Layoffs
Nothing excites Microsoft more than means by which to discard many employees without an obligation to tell shareholders about it
To The Register MS, Microsoft is the Only Brand That's at the Main Menu!
Consider that the Editor of The Register MS is a longtime faithful Microsofter
Microsoft's Collapse Will Continue, It's Drowning in Debt Now
Expect many more mass layoffs
Legal Self-Sufficiency
The more impact our work has, the more legal bullying will come our way
Plans for Winter in Manchester and London
From many perspectives, we're satisfied with the certainty and robustness of UK hosting, it's just that we're not yet robust/resistant enough to DDoS attacks
Customer Support Experience in 2026
Because the customer is never right
Microsoft Shutdowns in Africa, Mass Layoffs Also Reported This Week
further shutdowns
Links 13/10/2026: More Plagiarism Lawsuit Over Slop and AirAsia Needs State Help
Links for the day
Intercontinental Brigading - Part II - An Outline of This Series
What's to come
Gemini Links 13/10/2026: Dopamine Nation, Planner and Fatigue, and Moderators
Links for the day
Links 13/10/2026: Norway Fines Microsoft and Cops Can Creep on Airbnb
Links for the day
When Computers "Expire" Because Certificates Expire
People who promote Restricted Boot are liars. They lie for a living.
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Monday, October 12, 2026
IRC logs for Monday, October 12, 2026
Gemini Links 13/10/2026: Modern Science, Joplin, Luddites, and Lots More
Links for the day
Mass Layoffs at Microsoft Again (October 2026), So-Called 'AI' Units Impacted Because Slop ('AI') Has No Real Future
So much for the future of Microsoft being "hey hi" (AI)
European Readers, Please Contact Representatives (in One's Nation) Attending the Administrative Council Meeting
Normalising cocaine in in Europe's largest institutions (the people running these) is a slippery slope
Network Plumbing
We hope it'll help speed things up
For Half a Year the European Patent Office (EPO), Europe's Second-Largest Institution, Has Had Water Problems in the Toilets
And it's not being fixed
Intercontinental Brigading - Part I - The Failed Attempt to 'Swat' Our Series About the Attacks and Crimes Committed Against Us
This coincided with threats to our lives
Links 12/10/2026: Strike on Riyadh and GOP Pays Voters ("Surprise $90 Social Security Payments")
Links for the day
Microsoft's XBox CEO Spoke of a "Return to Growth" Last Week, But XBox Sales Lowest in XBox History (Quarter of a Century)
Microsoft's XBox is dying. It's a countdown to nothingness.
Links 12/10/2026: Shopify (Slop Booster) Has Security Issues, "Russia’s Yandex Says Data Center in Vladimir Shut Down After Drone Attack"
Links for the day
"My Hands Are Shaking While Writing" About IBM's Mass Layoffs at Red Hat (Bluewashing)
Shame, shame, shame on the corporate media for not covering Red Hat's layoffs this year
Taking a Look at the Last Articles of Bob Cringely at Forbes, They Were All About IBM and Its Collapse
It's all about IBM
Microsoft Windows Causes Problems (and Delays) to LibreOffice and The Document Foundation
Nothing would please Microsoft more than Windows curtailing the development of LibreOffice and adoption of ODF
So Far This Year Microsoft Windows Lost a Lot of Ground in China, GNU/Linux Gaining at Its Expense
GNU/Linux will soon exceed 10%
Lessons of Margaret Hamilton (Software Engineer)
Stop abetting men who attack women in the sciences
RIP, Bob Cringely
He was too young to leave us, his articles were still brilliant and his mind as lucid as ever
What is "Computer Science"? It is What Broligarchs Reject.
Nowadays some people call themselves informal terms or made-up titles (with terms like "AI" or "big data" or "data" tossed into the mix)
Linus Torvalds Has a Conflict of Interest Regarding Slop
Linus Torvalds is paid by the slop pushers
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Sunday, October 11, 2026
IRC logs for Sunday, October 11, 2026
Africa Sees GNU/Linux Exceeding 5% "Market Share"
It wasn't always like this. It used to be measured at 1 or 2 percent.
Brigading Against Women - Part XXVII - Americans and Public Executions
"People who work for Facebook / Xitter / Bytedance's Tiktok / Microsoft / Oracle / IBM / Apple / Uber / Lyft / Wolt / DoorDash / AirBnB / Bolt / and so on are doing some world-class projection when they have the audacity to call others Bad People(tm)"