Added WebService uptime metric in iis collector

Signed-off-by: kaffarell <gabrielgoller123@gmail.com>
This commit is contained in:
kaffarell
2022-09-13 16:27:22 +02:00
parent 63800b5c6a
commit fb38512f38
2 changed files with 15 additions and 1 deletions

View File

@@ -69,6 +69,7 @@ type IISCollector struct {
CurrentConnections *prometheus.Desc
CurrentISAPIExtensionRequests *prometheus.Desc
CurrentNonAnonymousUsers *prometheus.Desc
ServiceUptime *prometheus.Desc
TotalBytesReceived *prometheus.Desc
TotalBytesSent *prometheus.Desc
TotalAnonymousUsers *prometheus.Desc
@@ -242,6 +243,12 @@ func NewIISCollector() (Collector, error) {
[]string{"site"},
nil,
),
ServiceUptime: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "service_uptime"),
"Number of seconds the WebService is up (WebService.ServiceUptime)",
[]string{"site"},
nil,
),
TotalBytesReceived: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "received_bytes_total"),
"Number of data bytes that have been received by the Web service (WebService.TotalBytesReceived)",
@@ -845,6 +852,7 @@ type perflibWebService struct {
CurrentConnections float64 `perflib:"Current Connections"`
CurrentISAPIExtensionRequests float64 `perflib:"Current ISAPI Extension Requests"`
CurrentNonAnonymousUsers float64 `perflib:"Current NonAnonymous Users"`
ServiceUptime float64 `perflib:"Service Uptime"`
TotalBytesReceived float64 `perflib:"Total Bytes Received"`
TotalBytesSent float64 `perflib:"Total Bytes Sent"`
@@ -925,6 +933,12 @@ func (c *IISCollector) collectWebService(ctx *ScrapeContext, ch chan<- prometheu
app.CurrentNonAnonymousUsers,
app.Name,
)
ch <- prometheus.MustNewConstMetric(
c.ServiceUptime,
prometheus.GaugeValue,
app.ServiceUptime,
app.Name,
)
ch <- prometheus.MustNewConstMetric(
c.TotalBytesReceived,
prometheus.CounterValue,