Commit b54ecefa authored by Thomas Sänger's avatar Thomas Sänger Committed by Robert Jacob

Add a metric for free disk space (#5)

parent 715ea75c
......@@ -21,6 +21,10 @@ var (
"nextcloud_files_total",
"Number of files served by the instance.",
nil, nil)
freeSpaceDesc = prometheus.NewDesc(
"nextcloud_free_space_bytes",
"Number of bytes of free space on the instance.",
nil, nil)
sharesDesc = prometheus.NewDesc(
"nextcloud_shares_total",
"Number of shares by type.",
......@@ -74,6 +78,7 @@ func (c *nextcloudCollector) Describe(ch chan<- *prometheus.Desc) {
c.scrapeErrorsMetric.Describe(ch)
ch <- usersDesc
ch <- filesDesc
ch <- freeSpaceDesc
ch <- sharesDesc
ch <- federationsDesc
ch <- activeUsersDesc
......@@ -150,6 +155,10 @@ func collectSimpleMetrics(ch chan<- prometheus.Metric, status serverinfo.ServerI
desc: filesDesc,
value: float64(status.Data.Nextcloud.Storage.Files),
},
{
desc: freeSpaceDesc,
value: float64(status.Data.Nextcloud.System.FreeSpace),
},
{
desc: activeUsersDesc,
value: float64(status.Data.ActiveUsers.Last5Minutes),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment