Compare commits

..

6 Commits
v0.1 ... main

14 changed files with 98 additions and 57 deletions

View File

@ -7,14 +7,23 @@ permissions:
packages: write
jobs:
release-linux-amd64:
name: release linux/amd64
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: linux
goarch: amd64
goversion: '1.21.0'
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v4
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
config.yaml
freeipa-health-metrics
dist/

30
.goreleaser.yaml Normal file
View File

@ -0,0 +1,30 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
version: 1
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: "{{ .ProjectName }}-{{ .Version }}.{{ .Os }}-{{ .Arch }}"
wrap_in_directory: true
strip_parent_binary_folder: false

View File

@ -37,7 +37,7 @@ type Config struct {
HTTPDPKIProxyConf string `fig:"httpd_pki_proxy_conf"`
KInitBin string `fig:"kinit_bin"`
KListBin string `fig:"klist_bin"`
IPAGetCertBIN string `fig:"ipa_getcert_bin"`
GetCertBIN string `fig:"getcert_bin"`
}
const (
@ -154,8 +154,8 @@ func (a *App) ReadConfig() {
FreeIPA: FreeIPAConfig{
GroupMembers: []GroupMembers{
{
Name: "apache",
Members: []string{"ipaapi"},
Name: "ipaapi",
Members: []string{"apache"},
},
},
},
@ -167,7 +167,7 @@ func (a *App) ReadConfig() {
HTTPDPKIProxyConf: "/etc/httpd/conf.d/ipa-pki-proxy.conf",
KInitBin: "/usr/bin/kinit",
KListBin: "/usr/bin/klist",
IPAGetCertBIN: "/usr/bin/ipa-getcert",
GetCertBIN: "/usr/bin/getcert",
}
// Load configuration.

View File

@ -200,8 +200,8 @@ func (e *FreeIPAExporter) certMongerCerts() ([]*CertMongerCerts, error) {
requestRX := regexp.MustCompile(`Request ID '([A-Za-z0-9]+)':`)
keyValueRX := regexp.MustCompile(`\s([A-Za-z][A-Za-z- ]+): (.*)$`)
// Setup the ipa-getcert list command.
cmd := exec.Command(app.config.IPAGetCertBIN, "list")
// Setup the getcert list command.
cmd := exec.Command(app.config.GetCertBIN, "list")
// Get the pipes.
stdout, err := cmd.StdoutPipe()

2
go.mod
View File

@ -6,7 +6,7 @@ require (
github.com/antchfx/xmlquery v1.3.17
github.com/go-ldap/ldap/v3 v3.4.5
github.com/gorilla/handlers v1.5.1
github.com/grmrgecko/go-freeipa v0.0.0-20230814003934-9662b716120c
github.com/grmrgecko/go-freeipa v0.0.0-20240308202417-98de29c2fd81
github.com/grmrgecko/go-unixaccounts v0.0.0-20230814023229-86c46cf9fa3b
github.com/influxdata/influxdb-client-go/v2 v2.12.3
github.com/influxdata/line-protocol/v2 v2.2.1

4
go.sum
View File

@ -54,8 +54,8 @@ github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyC
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI=
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
github.com/grmrgecko/go-freeipa v0.0.0-20230814003934-9662b716120c h1:i35K9mKZNYjj8A0kA/tMj0hh+Ms1V9O6x8MsYSb1Dvs=
github.com/grmrgecko/go-freeipa v0.0.0-20230814003934-9662b716120c/go.mod h1:bg9+b0lCJ2+XwgNfDOCG4gjMwsHH/nwTTKaYF/T3o/Q=
github.com/grmrgecko/go-freeipa v0.0.0-20240308202417-98de29c2fd81 h1:22FQHx44AyR5vLybmjl5FuDu/Xj+jHZSZLaMPJvboNk=
github.com/grmrgecko/go-freeipa v0.0.0-20240308202417-98de29c2fd81/go.mod h1:bg9+b0lCJ2+XwgNfDOCG4gjMwsHH/nwTTKaYF/T3o/Q=
github.com/grmrgecko/go-unixaccounts v0.0.0-20230814023229-86c46cf9fa3b h1:4twMmYqPkuqUobzM7GkHECiEu6SuH06xgKgHRiviZ2U=
github.com/grmrgecko/go-unixaccounts v0.0.0-20230814023229-86c46cf9fa3b/go.mod h1:ND6FYE0L6uFGxbi3A+pVpb9doB5mAUiFHjfYEDpHIHI=
github.com/hashicorp/go-hclog v1.4.0 h1:ctuWFGrhFha8BnnzxqeRGidlEcQkDyL5u8J8t5eA11I=

View File

@ -91,7 +91,7 @@ func (i *InfluxOutput) LineprotocolFormat(res []*io_prometheus_client.MetricFami
// Get prefix for transforming prometheus name to influx.
namePrefix := namespace + "_"
enc.SetPrecision(lineprotocol.Microsecond)
enc.SetPrecision(lineprotocol.Nanosecond)
now := time.Now()
if !i.OverrideTimestamp.IsZero() {
now = i.OverrideTimestamp

View File

@ -15,7 +15,7 @@ import (
const (
serviceName = "freeipa-health-metrics"
serviceDescription = "Provides metrics of FreeIPA's health"
serviceVersion = "0.1"
serviceVersion = "0.4"
namespace = "freeipa"
)

View File

@ -1,36 +1,36 @@
freeipa,host=ipa1.example.com config_dna_range=1 1136214245000000
freeipa,host=ipa1.example.com config_ipa_ca_issued_cert=1 1136214245000000
freeipa,host=ipa1.example.com config_ipa_ca_issued_ldap_cert=0 1136214245000000
freeipa,host=ipa1.example.com config_ipa_cert_auto_renew=1 1136214245000000
freeipa,host=ipa1.example.com config_ipa_earliest_cert_expiry=2.639495644e+09 1136214245000000
freeipa,host=ipa1.example.com config_krb5_auth=1 1136214245000000
freeipa,host=ipa1.example.com config_krb5_workers=0 1136214245000000
freeipa,host=ipa1.example.com config_ldap_cert_auto_renew=0 1136214245000000
freeipa,host=ipa1.example.com config_ldap_earliest_cert_expiry=0 1136214245000000
freeipa,host=ipa1.example.com config_proxy_secret=1 1136214245000000
freeipa,host=ipa1.example.com config_renewal_master=1 1136214245000000
freeipa,host=ipa1.example.com failures_total=0 1136214245000000
freeipa,host=ipa1.example.com freeipa_failed_tests=1 1136214245000000
freeipa,host=ipa1.example.com ldap_certificate_total=0 1136214245000000
freeipa,host=ipa1.example.com ldap_conflicts_total=0 1136214245000000
freeipa,host=ipa1.example.com ldap_dns_zone_total=0 1136214245000000
freeipa,host=ipa1.example.com ldap_failures_total=0 1136214245000000
freeipa,host=ipa1.example.com ldap_ghost_replica_total=0 1136214245000000
freeipa,host=ipa1.example.com ldap_group_total=3 1136214245000000
freeipa,host=ipa1.example.com ldap_hbac_rule_total=1 1136214245000000
freeipa,host=ipa1.example.com ldap_host_group_total=2 1136214245000000
freeipa,host=ipa1.example.com ldap_host_total=4 1136214245000000
freeipa,host=ipa1.example.com ldap_net_group_total=0 1136214245000000
freeipa,host=ipa1.example.com,replica=ipa2.example.com ldap_replica_error_code=0 1136214245000000
freeipa,host=ipa1.example.com,replica=ipa3.example.com ldap_replica_error_code=0 1136214245000000
freeipa,host=ipa1.example.com,replica=ipa2.example.com ldap_replica_last_update=1.693362478e+09 1136214245000000
freeipa,host=ipa1.example.com,replica=ipa3.example.com ldap_replica_last_update=1.693362636e+09 1136214245000000
freeipa,host=ipa1.example.com ldap_scrapes_total=1 1136214245000000
freeipa,host=ipa1.example.com ldap_service_total=6 1136214245000000
freeipa,host=ipa1.example.com ldap_sudo_rule_total=0 1136214245000000
freeipa,host=ipa1.example.com ldap_up=1 1136214245000000
freeipa,host=ipa1.example.com ldap_user_active_total=7 1136214245000000
freeipa,host=ipa1.example.com ldap_user_preserved_total=3 1136214245000000
freeipa,host=ipa1.example.com ldap_user_stage_total=1 1136214245000000
freeipa,host=ipa1.example.com scrapes_total=1 1136214245000000
freeipa,host=ipa1.example.com up=1 1136214245000000
freeipa,host=ipa1.example.com config_dna_range=1 1136214245000000000
freeipa,host=ipa1.example.com config_ipa_ca_issued_cert=1 1136214245000000000
freeipa,host=ipa1.example.com config_ipa_ca_issued_ldap_cert=0 1136214245000000000
freeipa,host=ipa1.example.com config_ipa_cert_auto_renew=1 1136214245000000000
freeipa,host=ipa1.example.com config_ipa_earliest_cert_expiry=2.639495644e+09 1136214245000000000
freeipa,host=ipa1.example.com config_krb5_auth=1 1136214245000000000
freeipa,host=ipa1.example.com config_krb5_workers=0 1136214245000000000
freeipa,host=ipa1.example.com config_ldap_cert_auto_renew=0 1136214245000000000
freeipa,host=ipa1.example.com config_ldap_earliest_cert_expiry=0 1136214245000000000
freeipa,host=ipa1.example.com config_proxy_secret=1 1136214245000000000
freeipa,host=ipa1.example.com config_renewal_master=1 1136214245000000000
freeipa,host=ipa1.example.com failures_total=0 1136214245000000000
freeipa,host=ipa1.example.com freeipa_failed_tests=1 1136214245000000000
freeipa,host=ipa1.example.com ldap_certificate_total=0 1136214245000000000
freeipa,host=ipa1.example.com ldap_conflicts_total=0 1136214245000000000
freeipa,host=ipa1.example.com ldap_dns_zone_total=0 1136214245000000000
freeipa,host=ipa1.example.com ldap_failures_total=0 1136214245000000000
freeipa,host=ipa1.example.com ldap_ghost_replica_total=0 1136214245000000000
freeipa,host=ipa1.example.com ldap_group_total=3 1136214245000000000
freeipa,host=ipa1.example.com ldap_hbac_rule_total=1 1136214245000000000
freeipa,host=ipa1.example.com ldap_host_group_total=2 1136214245000000000
freeipa,host=ipa1.example.com ldap_host_total=4 1136214245000000000
freeipa,host=ipa1.example.com ldap_net_group_total=0 1136214245000000000
freeipa,host=ipa1.example.com,replica=ipa2.example.com ldap_replica_error_code=0 1136214245000000000
freeipa,host=ipa1.example.com,replica=ipa3.example.com ldap_replica_error_code=0 1136214245000000000
freeipa,host=ipa1.example.com,replica=ipa2.example.com ldap_replica_last_update=1.693362478e+09 1136214245000000000
freeipa,host=ipa1.example.com,replica=ipa3.example.com ldap_replica_last_update=1.693362636e+09 1136214245000000000
freeipa,host=ipa1.example.com ldap_scrapes_total=1 1136214245000000000
freeipa,host=ipa1.example.com ldap_service_total=6 1136214245000000000
freeipa,host=ipa1.example.com ldap_sudo_rule_total=0 1136214245000000000
freeipa,host=ipa1.example.com ldap_up=1 1136214245000000000
freeipa,host=ipa1.example.com ldap_user_active_total=7 1136214245000000000
freeipa,host=ipa1.example.com ldap_user_preserved_total=3 1136214245000000000
freeipa,host=ipa1.example.com ldap_user_stage_total=1 1136214245000000000
freeipa,host=ipa1.example.com scrapes_total=1 1136214245000000000
freeipa,host=ipa1.example.com up=1 1136214245000000000

View File

@ -27,4 +27,4 @@ pki_tomcat_server_xml: test/server.xml
httpd_pki_proxy_conf: test/ipa-pki-proxy.conf
kinit_bin: test/kinit
klist_bin: test/klist
ipa_getcert_bin: test/ipa-getcert
getcert_bin: test/getcert