mirror of
https://github.com/onedr0p/exportarr.git
synced 2026-02-06 10:57:32 +00:00
Add radarr_movie_cutoff_unmet_total metric
This commit is contained in:
parent
41b67b11d1
commit
6230d0c756
@ -19,6 +19,7 @@ type radarrCollector struct {
|
||||
movieUnmonitoredMetric *prometheus.Desc // Total number of unmonitored movies
|
||||
movieWantedMetric *prometheus.Desc // Total number of wanted movies
|
||||
movieMissingMetric *prometheus.Desc // Total number of missing movies
|
||||
movieCutoffUnmetMetric *prometheus.Desc // Total number of movies with cutoff unmet
|
||||
movieQualitiesMetric *prometheus.Desc // Total number of movies by quality
|
||||
movieFileSizeMetric *prometheus.Desc // Total fizesize of all movies in bytes
|
||||
errorMetric *prometheus.Desc // Error Description for use with InvalidMetric
|
||||
@ -70,6 +71,12 @@ func NewRadarrCollector(c *config.ArrConfig) *radarrCollector {
|
||||
nil,
|
||||
prometheus.Labels{"url": c.URL},
|
||||
),
|
||||
movieCutoffUnmetMetric: prometheus.NewDesc(
|
||||
"radarr_movie_cutoff_unmet_total",
|
||||
"Total number of movies wiht cutoff unmet",
|
||||
nil,
|
||||
prometheus.Labels{"url": c.URL},
|
||||
),
|
||||
movieFileSizeMetric: prometheus.NewDesc(
|
||||
"radarr_movie_filesize_total",
|
||||
"Total filesize of all movies",
|
||||
@ -105,6 +112,7 @@ func (collector *radarrCollector) Describe(ch chan<- *prometheus.Desc) {
|
||||
ch <- collector.movieUnmonitoredMetric
|
||||
ch <- collector.movieWantedMetric
|
||||
ch <- collector.movieMissingMetric
|
||||
ch <- collector.movieCutoffUnmetMetric
|
||||
ch <- collector.movieFileSizeMetric
|
||||
ch <- collector.movieQualitiesMetric
|
||||
ch <- collector.movieTagsMetric
|
||||
@ -202,6 +210,17 @@ func (collector *radarrCollector) Collect(ch chan<- prometheus.Metric) {
|
||||
}
|
||||
}
|
||||
|
||||
moviesCutoffUnmet := model.CutoffUnmet{}
|
||||
moviesCutoffUnmetParams := client.QueryParams{}
|
||||
params.Add("sortKey", "airDateUtc")
|
||||
|
||||
if err := c.DoRequest("wanted/cutoff", &moviesCutoffUnmet, moviesCutoffUnmetParams); err != nil {
|
||||
log.Errorw("Error getting cutoff unmet",
|
||||
"error", err)
|
||||
ch <- prometheus.NewInvalidMetric(collector.errorMetric, err)
|
||||
return
|
||||
}
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(collector.movieEdition, prometheus.GaugeValue, float64(editions))
|
||||
ch <- prometheus.MustNewConstMetric(collector.movieMetric, prometheus.GaugeValue, float64(len(movies)))
|
||||
ch <- prometheus.MustNewConstMetric(collector.movieDownloadedMetric, prometheus.GaugeValue, float64(downloaded))
|
||||
@ -209,6 +228,7 @@ func (collector *radarrCollector) Collect(ch chan<- prometheus.Metric) {
|
||||
ch <- prometheus.MustNewConstMetric(collector.movieUnmonitoredMetric, prometheus.GaugeValue, float64(unmonitored))
|
||||
ch <- prometheus.MustNewConstMetric(collector.movieWantedMetric, prometheus.GaugeValue, float64(wanted))
|
||||
ch <- prometheus.MustNewConstMetric(collector.movieMissingMetric, prometheus.GaugeValue, float64(missing))
|
||||
ch <- prometheus.MustNewConstMetric(collector.movieCutoffUnmetMetric, prometheus.GaugeValue, float64(moviesCutoffUnmet.TotalRecords))
|
||||
ch <- prometheus.MustNewConstMetric(collector.movieFileSizeMetric, prometheus.GaugeValue, float64(fileSize))
|
||||
|
||||
if len(qualities) > 0 {
|
||||
|
||||
@ -23,3 +23,9 @@ type TagMovies []struct {
|
||||
Label string `json:"label"`
|
||||
MovieIds []int `json:"movieIds"`
|
||||
}
|
||||
|
||||
// CutoffUnmet - Stores struct of JSON response
|
||||
// https://radarr.video/docs/api/#/Cutoff/get_api_v3_wanted_cutoff
|
||||
type CutoffUnmet struct {
|
||||
TotalRecords int `json:"totalRecords"`
|
||||
}
|
||||
@ -10,6 +10,9 @@ radarr_movie_filesize_total{url="SOMEURL"} 1.47062956689e+11
|
||||
# HELP radarr_movie_missing_total Total number of missing movies
|
||||
# TYPE radarr_movie_missing_total gauge
|
||||
radarr_movie_missing_total{url="SOMEURL"} 2
|
||||
# HELP radarr_movie_missing_total Total number of movies with cutoff_unmet
|
||||
# TYPE radarr_movie_cutoff_unmet_total gauge
|
||||
radarr_movie_cutoff_unmet_total{url="SOMEURL"} 2
|
||||
# HELP radarr_movie_monitored_total Total number of monitored movies
|
||||
# TYPE radarr_movie_monitored_total gauge
|
||||
radarr_movie_monitored_total{url="SOMEURL"} 7
|
||||
|
||||
3
internal/arr/test_fixtures/radarr/v3_wanted_cutoff.json
Normal file
3
internal/arr/test_fixtures/radarr/v3_wanted_cutoff.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"totalRecords": 1179
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user