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

implement systemd-resolved metrics collector #119

Merged
merged 5 commits into from
Jan 11, 2024

Conversation

egmc
Copy link
Contributor

@egmc egmc commented Dec 22, 2023

@egmc
Copy link
Contributor Author

egmc commented Dec 22, 2023

here are some test results with systemd 237

$ systemd --version
systemd 237
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid

$ uname -a
Linux vietnam 5.4.0-1029-aws #30~18.04.1-Ubuntu SMP Tue Oct 20 11:09:25 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

$ go version
go version go1.21.5 linux/amd64

run exporter

$ go run main.go --systemd.collector.enable-resolved

check metrics

$ curl -s http://localhost:9558/metrics |egrep -i systemd_resolved
# HELP systemd_resolved_cache_hits_total Resolved Total Cache Hits
# TYPE systemd_resolved_cache_hits_total counter
systemd_resolved_cache_hits_total 1.019122e+06
# HELP systemd_resolved_cache_misses_total Resolved Total Cache Misses
# TYPE systemd_resolved_cache_misses_total counter
systemd_resolved_cache_misses_total 896694
# HELP systemd_resolved_current_cache_size Resolved Current Cache Size
# TYPE systemd_resolved_current_cache_size gauge
systemd_resolved_current_cache_size 4
# HELP systemd_resolved_current_transactions Resolved Current Transactions
# TYPE systemd_resolved_current_transactions gauge
systemd_resolved_current_transactions 0
# HELP systemd_resolved_dnssec_bogus_total Resolved Total number of DNSSEC Verdicts Boguss
# TYPE systemd_resolved_dnssec_bogus_total counter
systemd_resolved_dnssec_bogus_total 0
# HELP systemd_resolved_dnssec_indeterminate_total Resolved Total number of DNSSEC Verdicts Indeterminat
# TYPE systemd_resolved_dnssec_indeterminate_total counter
systemd_resolved_dnssec_indeterminate_total 0
# HELP systemd_resolved_dnssec_insecure_total Resolved Total number of DNSSEC Verdicts Insecure
# TYPE systemd_resolved_dnssec_insecure_total counter
systemd_resolved_dnssec_insecure_total 1
# HELP systemd_resolved_dnssec_secure_total Resolved Total number of DNSSEC Verdicts Secure
# TYPE systemd_resolved_dnssec_secure_total counter
systemd_resolved_dnssec_secure_total 0
# HELP systemd_resolved_transactions_total Resolved Total Transactions
# TYPE systemd_resolved_transactions_total counter
$ systemd-resolve --statistics 
DNSSEC supported by current servers: no

Transactions
Current Transactions: 0
  Total Transactions: 1871553

Cache
  Current Cache Size: 5
          Cache Hits: 1019123
        Cache Misses: 896695

DNSSEC Verdicts
              Secure: 0
            Insecure: 1
               Bogus: 0
       Indeterminate: 0

 - collect systemd-resolved metrics through dbus
 - add new option to enable collector
 - fix prometheus-community#37

Signed-off-by: egmc <[email protected]>
@egmc egmc force-pushed the feature/systemd-resolved branch from 22e029c to 4fdb7cd Compare December 22, 2023 08:48
@egmc
Copy link
Contributor Author

egmc commented Dec 28, 2023

I believe this PR is ready for review. Could someone please check it out?

systemd/systemd.go Outdated Show resolved Hide resolved
@egmc egmc force-pushed the feature/systemd-resolved branch from 0fd6f21 to eafbe41 Compare January 6, 2024 06:31
@egmc egmc force-pushed the feature/systemd-resolved branch from 2df219d to e144b1f Compare January 6, 2024 08:02
systemd/resolved/resolved.go Outdated Show resolved Hide resolved
- fix other minor commens

Signed-off-by: egmc <[email protected]>
@egmc egmc requested a review from SuperQ January 7, 2024 04:59
@SuperQ SuperQ requested a review from jpds January 7, 2024 09:19
systemd/resolved/resolved.go Outdated Show resolved Hide resolved
Copy link
Contributor

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@SuperQ SuperQ merged commit 7f2bb6e into prometheus-community:main Jan 11, 2024
4 checks passed
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.

Feature: systemd-resolve --statistics
3 participants