Counting pending patches without assuming it is Debian
A cross-distro look at 'how many security updates are waiting', where every package manager disagrees about exit codes, output, and even what a CVE is.
"How many security updates are pending on this host" sounds like one question with one answer. Write it once for the distro on your laptop and you are done. Then you meet a fleet, and the fleet is not all Debian, and every package manager has its own opinion about how to answer, what a non-zero exit code means, and whether it will even tell you which updates are security updates.
Everyone counts differently
On apt-based systems you can simulate an upgrade and read what it plans to install. The security ones are tagged in the output if you know where to look. Fine.
On dnf-based systems, check-update does something that trips up almost every first attempt: it exits non-zero when updates are available. Exit code 100 is not an error, it is the answer. It means "yes, there are updates." A script that treats any non-zero exit as failure will conclude the check itself broke, on every machine that actually has updates, which is all of them. You have to teach your runner that 100 is a valid, expected outcome and parse the output anyway.
Then there is the newer dnf, the one on current Fedora, which quietly changed the surface. The old command shape for listing security advisories does not produce the same thing. Point the old parser at it and it does not error, it just counts zero, forever, on every box, which is the most dangerous kind of wrong: a security metric that reads a confident, calm zero because it is asking a question the tool no longer understands. Different command, different output, same word "dnf" on the tin.
And zypper, and apk, each with their own format and their own quirks, including metadata caches that go stale and have to be survived rather than trusted.
What is even a CVE here
The deeper you go, the more the ground shifts. Ask a RHEL-family box which CVEs its pending updates address and it will tell you, because that data ships locally in the advisory metadata. You can get a real count of CVE-to-package pairs and a breakdown by severity without leaving the machine.
Ask the same of the newer dnf on Fedora and the advisories do not carry CVE references in the same way. The number you actually want is not there to be read locally. So "count the pending CVEs" is answerable on one branch of the same package-manager family and simply not answerable, from local data alone, on another. Pretending otherwise means printing a zero that looks like good news and is really just missing data.
Where the local data is not enough, the honest design is to correlate the installed package inventory against a vulnerability database on the server side, on a schedule, rather than have the agent reach out to external feeds itself. The agent's job is to know precisely what is installed. Turning that inventory into a CVE list is work that belongs off the host, so the thing running on a customer's box never has to phone a third party to do its job.
The rule that keeps you honest
The trap in cross-platform work is that your first target teaches you a shape, and you mistake that shape for the problem. Debian's apt is not "how Linux does packages." It is how one family does packages, and the moment you generalize from it you start shipping code that reads zero on half your fleet and calls it healthy.
So two habits. Test against a machine from each family you claim to support, not one plus optimism, because the differences are not edge cases, they are the normal behavior of the other half of your hosts. And when a tool cannot answer a question, make the absence loud. "This distro does not expose CVE data locally" is a fact an operator can act on. A silent zero is a fact-shaped lie that reads like reassurance right up until an audit.
How a monitor should behave on someone else's server
A monitoring agent is a guest on hardware it does not own. The moment your checks show up in the host's own CPU graph, you have overstayed your welcome.
Read the storyA bill you don't have to fear
Billing the monthly average instead of the worst day, refusing to count pods, and why nothing lands on an invoice without an explicit click. Billing rules are trust rules.
Read the storyProving an eBPF fix on kernels we don't have
A struct changed shape in kernel 6.4 and our zero-touch HTTP metrics refused to load on older kernels. The fix was ordinary. Proving it across four kernel generations without owning a single one of them was the interesting part.
Read the storyStories like this one, live on your own fleet.
Three hosts free, forever. Discovery does the tour for you.