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,

View File

@ -36,7 +36,7 @@ Name | Description | Type | Labels
`windows_iis_current_connections` | The number of active connections to the web service | counter | `site`
`windows_iis_current_isapi_extension_requests` | The number of [ISAPI extension](https://docs.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms525172(v=vs.90)) requests that are being processed simultaneously by the web service | counter | `site`
`windows_iis_current_non_anonymous_users` | The number of users who currently have a nonanonymous request pending with the web service | counter | `site`
`windows_iis_service_uptime` | The uptime for the web service or a Web site (seconds) | counter | `site`
`windows_iis_service_uptime` | The uptime for the web service or a Web site (seconds) | gauge | `site`
`windows_iis_received_bytes_total` | The total bytes of data that have been received by the web service since the service started | counter | `site`
`windows_iis_sent_bytes_total` | The number of data bytes that have been sent by the web service since the service started | counter | `site`
`windows_iis_anonymous_users_total` | The number of users who have established an anonymous request since the web service started | counter | `site`