peimanja / artifactory_exporter

JFrog Artifactory Prometheus Exporter written in Go
Apache License 2.0
141 stars 37 forks source link

Add replication status metrics #83

Closed fevrin closed 1 year ago

fevrin commented 1 year ago

Feature Description

One can already monitor which repos have replication enabled using artifactory_replication_enabled; however, it would be awesome if the exporter could additionally monitor replication statuses.

That information is already available via the Artifactory API: https://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API#ArtifactoryRESTAPI-ScheduledReplicationStatus

This already captures which repos have replication enabled: https://github.com/peimanja/artifactory_exporter/blob/master/artifactory/replication.go

So the above could potentially feed that repo list into the new feature, which then checks just those repos' replication statuses, similar to this bash command:

$ for repo in $(jf rt curl /api/replications -s | jq -r '.[] | select(.enabled == true) | .repoKey' | sort -h); do jf rt curl /api/replication/$repo -s | jq -r '.targets[] | select(.url | test (".*standby.*")) | select(.status != null) | { (.repoKey): .status }'; done
{
  "repo1": "ok"
}
{
  "repo2": "ok"
}
{
  "repo3": "ok"
}
...

Use Case(s)

This would be great for monitoring replication statuses to track any issues there.

peimanja commented 1 year ago

Thanks for the suggestion. I will see if I get a chance to add this and ask you to test it, since we don't run any replication now. Meanwhile any PRs are welcomed.

fevrin commented 1 year ago

Thanks, sounds good!

I don't have much go experience, but I can try my hand at this if I get a chance :+1:

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

peimanja commented 1 year ago

Still valid