Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Security Updates as separate Value #122

Closed
wants to merge 2 commits into from

Conversation

manuel-held
Copy link

Signed-off-by: Manuel manuel@held.is

Signed-off-by: Manuel <manuel@held.is>
Signed-off-by: Manuel <manuel@held.is>
@dswarbrick
Copy link
Member

Isn't this already achievable with simple label matching? For example, with these source metrics:

# HELP apt_upgrades_pending Apt package pending updates by origin.
# TYPE apt_upgrades_pending gauge
apt_upgrades_pending{origin="Debian:11.4/stable",arch="all"} 2
apt_upgrades_pending{origin="Debian:11.4/stable",arch="amd64"} 14
apt_upgrades_pending{origin="Debian:11.4/stable,Debian-Security:11/stable-security",arch="all"} 2
apt_upgrades_pending{origin="Debian:11.4/stable,Debian-Security:11/stable-security",arch="amd64"} 11
apt_upgrades_pending{origin="Debian-Security:11/stable-security",arch="amd64"} 1

... I can get the number of security upgrades with sum(apt_upgrades_pending{origin=~".*Debian-Security.*"})

PS: I think we'd prefer not to tempt fate by doing precisely the thing that apt warns against doing.

$ apt list --upgradable | grep -c "\-security"

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

@manuel-held
Copy link
Author

Hi @dswarbrick, yes this is possible. But if you're using Grafana and use a Query like sum by(job) (apt_upgrades_pending{origin=~".*Security.*"}) you get "No Data" if there are no Updates, which is not so informative.

@dswarbrick
Copy link
Member

dswarbrick commented Jul 13, 2022

@manuel-held How about simply changing your query to

sum by(job) (apt_upgrades_pending{origin=~".*Security.*"}) or vector(0)

@SuperQ
Copy link
Contributor

SuperQ commented Jul 25, 2022

This has been superseded by #99

@dswarbrick
Copy link
Member

Closing, since apt.sh has been superseded by apt_info.py.

@dswarbrick dswarbrick closed this Oct 11, 2022
@copolycube
Copy link

Hello @dswarbrick ,
with sum by(job) (apt_upgrades_pending{origin=~".*Security.*"}) or vector(0) you only get {} 0 as a global result when there are no match / no security upgrades on each instance.
Is it possible to still have a vector with 0 for each original value of apt_upgrades_pending instead ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants