Skip to content

Commit

Permalink
Merge pull request prometheus-community#1059 from kaffarell/master
Browse files Browse the repository at this point in the history
Added WebService uptime metric in iis collector
  • Loading branch information
breed808 authored Sep 13, 2022
2 parents bb8cef3 + f854d2e commit 71f9683
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions collector/iis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)",
Expand Down Expand Up @@ -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"`
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion docs/collector.iis.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit 71f9683

Please sign in to comment.