Process states from /proc/[pid]/stat versus /proc/stat's running and blocked numbers
We recently updated to a version of the Prometheus host agent that can report onhow many processes are in various process states .The host agent has also long reported node_procs_running and node_procs_blocked metrics, which ultimately come from /proc/stat 's procs_running and procs_blocked fields.Naturally, I cross-compared the two different sets of numbers.To my surprise, in our environment they could be significantlydifferent from each other. There turn out to be two reasons for
The modern danger of locales when you combine sort and cron
It never fails. Every time I use 'sort' in a shell script to be runfrom cron on a modern Linux machine, it blows up in my face because$LANG defaults to some locale that screws up traditional sort order. Ineed to start all scripts with:
LANG=C; export LANG
(I wound up elaborating on this , because thetrap here is not obvious.)
On modern Linux machines, cron runs your cron jobs with the system'sdefault locale set (as
Using default function arguments to avoid creating a class
Recently I was writing some Python code to print out Prometheus metrics about whether or not we could login to an IMAP server. As an end to end test, this is something thatcan fail for a wide assortment of reasons; we can fail to connectto the IMAP server, experience a TLS error during TLS sessionnegotiation, have the server's TLS certificate fail to validate,there could be an IMAP protocol problem, or the server could rejectour login attempt. If we fail, we would like to
An advantage of tablets and two-in-one devices over small laptops
For reasons beyond the scope of this entry, I spent a certain amountof today just sitting around somewhere. Wisely, I took my iPad alongand used it to pass the time, including doing a certain amount ofproductive work. As a result of my usage today, I have formed anopinion about why I think tablets (with physical keyboards) areoften a superior option to a small laptop of roughly the samephysical size.
To put it simply, what I found is that my iPad's display wasn
What /proc/[pid]/stat's process state means and where it comes from
We recently updated to a version of the Prometheus host agent that can report howmany of your processes are in various states. Naturally this causedme to look at our systems, where I was surprised to find that we hada bunch of processes in what the host agent called state ' I ', whichI had never heard of before. This gave me two questions, namely wheredid the host agent get this state information from, and what did itmean.
The answer to the first question is that the process
The cliffs in the way of adding tests to our Django web app
Back in August of last year, I wrote that it was time for me to startadding tests to our Django web app . Since then, thenumber of tests I have added is zero, and in fact the amount of workthat I have done on our Django web app 'scode is also essentially zero (partly because it hasn't needed anymodifications). Part of the reason for that is that adding tests feelslike make-work, even though I know perfectly well that it's not
When cloning git repos, things go faster if you start from a good base
Normally I get a copy of any git repo that I want by directly cloningfrom its upstream, whatever that is. Generally this goes fast enoughand it guarantees that I have an exact copy of the repo, one that'snot contaminated by anything else that I might have been doing toany other copy of the repo that I might already have. But generallyI'm doing it on a 1G network link. Recently I needed a copy of Guenter Roeck's tree of hwmon updates for the Linux
Some notes on heatmaps and histograms in Prometheus and Grafana
On Mastodon (or if you prefer, the Fediverse), I mentioned :
I have now reached the logical end point of running Prometheus onmy desktop, which is that I have installed Grafana so I can seeheatmap graphs of my disk IO latency distributions generated from theCloudflare eBPF exporter.
It's kind of neat once I got all the bits going.
This isn't my first go-around on heatmaps and histograms, but thistime around I found new clever mistakes to make on top of my existing
Why I like middle mouse button paste in xterm so much
In my entry about how touchpads are not mice ,I mused that one of the things I should do on my laptop was insurethat I had a keyboard binding for paste, since middle mouse buttonis one of the harder multi-finger gestures to land on a touchpad.Kurt Mosiejczuk recently left a comment there where they said:
Shift-Insert is a keyboard equivalent for paste that is in defaultxterm (at least OpenBSD xterm, and putty on Windows too). I use thatmost of the time now as
Accumulating a separated list in the Bourne shell
One of the things that comes up over and over again when formattingoutput is that you want to output a list of things with some separatorbetween them but you don't want this separator to appear at thestart or the end, or if there is only one item in the list. Forinstance, suppose that you are formatting URL parameters in a tinylittle shell script and you may have one or more parameters. If youhave more than one parameter, you need to separate them with ' & ';