2018-11-30 00:51:12 +00:00
// +build windows
2016-09-01 12:55:35 +00:00
package collector
2016-08-27 14:33:23 +00:00
import (
"fmt"
2021-12-14 13:33:04 +00:00
"regexp"
2021-01-30 10:16:53 +00:00
"github.com/prometheus-community/windows_exporter/log"
2016-08-27 14:33:23 +00:00
"github.com/prometheus/client_golang/prometheus"
2021-09-25 15:00:39 +00:00
"golang.org/x/sys/windows/registry"
2018-03-25 07:50:37 +00:00
"gopkg.in/alecthomas/kingpin.v2"
2016-08-27 14:33:23 +00:00
)
2016-09-01 14:04:43 +00:00
func init ( ) {
2021-09-25 15:00:39 +00:00
registerCollector ( "iis" , NewIISCollector , "Web Service" , "APP_POOL_WAS" , "Web Service Cache" , "W3SVC_W3WP" )
2017-07-15 12:56:09 +00:00
}
2021-09-25 15:00:39 +00:00
var (
siteWhitelist = kingpin . Flag ( "collector.iis.site-whitelist" , "Regexp of sites to whitelist. Site name must both match whitelist and not match blacklist to be included." ) . Default ( ".+" ) . String ( )
siteBlacklist = kingpin . Flag ( "collector.iis.site-blacklist" , "Regexp of sites to blacklist. Site name must both match whitelist and not match blacklist to be included." ) . String ( )
appWhitelist = kingpin . Flag ( "collector.iis.app-whitelist" , "Regexp of apps to whitelist. App name must both match whitelist and not match blacklist to be included." ) . Default ( ".+" ) . String ( )
appBlacklist = kingpin . Flag ( "collector.iis.app-blacklist" , "Regexp of apps to blacklist. App name must both match whitelist and not match blacklist to be included." ) . String ( )
)
2017-07-15 12:56:09 +00:00
type simple_version struct {
major uint64
minor uint64
}
func getIISVersion ( ) simple_version {
k , err := registry . OpenKey ( registry . LOCAL_MACHINE , ` SOFTWARE\Microsoft\InetStp\ ` , registry . QUERY_VALUE )
if err != nil {
2018-04-05 05:27:26 +00:00
log . Warn ( "Couldn't open registry to determine IIS version:" , err )
2017-07-15 12:56:09 +00:00
return simple_version { }
}
2018-10-05 05:29:56 +00:00
defer func ( ) {
err = k . Close ( )
if err != nil {
log . Warnf ( "Failed to close registry key: %v" , err )
}
} ( )
2017-07-15 12:56:09 +00:00
major , _ , err := k . GetIntegerValue ( "MajorVersion" )
if err != nil {
2018-04-05 05:27:26 +00:00
log . Warn ( "Couldn't open registry to determine IIS version:" , err )
2017-07-15 12:56:09 +00:00
return simple_version { }
}
minor , _ , err := k . GetIntegerValue ( "MinorVersion" )
if err != nil {
2018-04-05 05:27:26 +00:00
log . Warn ( "Couldn't open registry to determine IIS version:" , err )
2017-07-15 12:56:09 +00:00
return simple_version { }
}
2018-04-05 05:27:26 +00:00
log . Debugf ( "Detected IIS %d.%d\n" , major , minor )
2017-07-15 12:56:09 +00:00
return simple_version {
major : major ,
minor : minor ,
}
2016-09-01 14:04:43 +00:00
}
2016-08-27 14:33:23 +00:00
type IISCollector struct {
2021-09-25 15:00:39 +00:00
// Web Service
CurrentAnonymousUsers * prometheus . Desc
CurrentBlockedAsyncIORequests * prometheus . Desc
CurrentCGIRequests * prometheus . Desc
CurrentConnections * prometheus . Desc
CurrentISAPIExtensionRequests * prometheus . Desc
CurrentNonAnonymousUsers * prometheus . Desc
2016-08-27 14:33:23 +00:00
TotalBytesReceived * prometheus . Desc
TotalBytesSent * prometheus . Desc
TotalAnonymousUsers * prometheus . Desc
TotalBlockedAsyncIORequests * prometheus . Desc
TotalCGIRequests * prometheus . Desc
TotalConnectionAttemptsAllInstances * prometheus . Desc
TotalRequests * prometheus . Desc
TotalFilesReceived * prometheus . Desc
TotalFilesSent * prometheus . Desc
TotalISAPIExtensionRequests * prometheus . Desc
TotalLockedErrors * prometheus . Desc
TotalLogonAttempts * prometheus . Desc
TotalNonAnonymousUsers * prometheus . Desc
TotalNotFoundErrors * prometheus . Desc
TotalRejectedAsyncIORequests * prometheus . Desc
siteWhitelistPattern * regexp . Regexp
siteBlacklistPattern * regexp . Regexp
2017-06-30 19:55:45 +00:00
2021-09-25 15:00:39 +00:00
// APP_POOL_WAS
2017-04-26 13:19:33 +00:00
CurrentApplicationPoolState * prometheus . Desc
CurrentApplicationPoolUptime * prometheus . Desc
CurrentWorkerProcesses * prometheus . Desc
MaximumWorkerProcesses * prometheus . Desc
RecentWorkerProcessFailures * prometheus . Desc
TimeSinceLastWorkerProcessFailure * prometheus . Desc
TotalApplicationPoolRecycles * prometheus . Desc
TotalApplicationPoolUptime * prometheus . Desc
TotalWorkerProcessesCreated * prometheus . Desc
TotalWorkerProcessFailures * prometheus . Desc
TotalWorkerProcessPingFailures * prometheus . Desc
TotalWorkerProcessShutdownFailures * prometheus . Desc
TotalWorkerProcessStartupFailures * prometheus . Desc
2021-09-25 15:00:39 +00:00
// W3SVC_W3WP
Threads * prometheus . Desc
MaximumThreads * prometheus . Desc
RequestsTotal * prometheus . Desc
RequestsActive * prometheus . Desc
2017-06-30 19:55:45 +00:00
ActiveFlushedEntries * prometheus . Desc
2021-09-25 15:00:39 +00:00
CurrentFileCacheMemoryUsage * prometheus . Desc
2017-06-30 19:55:45 +00:00
MaximumFileCacheMemoryUsage * prometheus . Desc
FileCacheFlushesTotal * prometheus . Desc
FileCacheQueriesTotal * prometheus . Desc
2021-09-25 15:00:39 +00:00
FilesCachedMissesTotal * prometheus . Desc
2017-06-30 19:55:45 +00:00
FileCacheHitsTotal * prometheus . Desc
FilesCached * prometheus . Desc
FilesCachedTotal * prometheus . Desc
FilesFlushedTotal * prometheus . Desc
URICacheFlushesTotal * prometheus . Desc
URICacheQueriesTotal * prometheus . Desc
URICacheHitsTotal * prometheus . Desc
2021-09-25 15:00:39 +00:00
URICacheMissesTotal * prometheus . Desc
2017-06-30 19:55:45 +00:00
URIsCached * prometheus . Desc
URIsCachedTotal * prometheus . Desc
URIsFlushedTotal * prometheus . Desc
MetadataCached * prometheus . Desc
MetadataCacheFlushes * prometheus . Desc
MetadataCacheQueriesTotal * prometheus . Desc
MetadataCacheHitsTotal * prometheus . Desc
2021-09-25 15:00:39 +00:00
MetadataCacheMissesTotal * prometheus . Desc
2017-06-30 19:55:45 +00:00
MetadataCachedTotal * prometheus . Desc
MetadataFlushedTotal * prometheus . Desc
OutputCacheActiveFlushedItems * prometheus . Desc
OutputCacheItems * prometheus . Desc
OutputCacheMemoryUsage * prometheus . Desc
OutputCacheQueriesTotal * prometheus . Desc
OutputCacheHitsTotal * prometheus . Desc
2021-09-25 15:00:39 +00:00
OutputCacheMissesTotal * prometheus . Desc
2017-06-30 19:55:45 +00:00
OutputCacheFlushedItemsTotal * prometheus . Desc
OutputCacheFlushesTotal * prometheus . Desc
2021-09-25 15:00:39 +00:00
// IIS 8+ Only
RequestErrorsTotal * prometheus . Desc
2017-06-30 19:55:45 +00:00
WebSocketRequestsActive * prometheus . Desc
WebSocketConnectionAttempts * prometheus . Desc
WebSocketConnectionsAccepted * prometheus . Desc
WebSocketConnectionsRejected * prometheus . Desc
2021-09-25 15:00:39 +00:00
// Web Service Cache
2017-06-30 19:55:45 +00:00
ServiceCache_ActiveFlushedEntries * prometheus . Desc
2021-09-25 15:00:39 +00:00
ServiceCache_CurrentFileCacheMemoryUsage * prometheus . Desc
2017-06-30 19:55:45 +00:00
ServiceCache_MaximumFileCacheMemoryUsage * prometheus . Desc
ServiceCache_FileCacheFlushesTotal * prometheus . Desc
ServiceCache_FileCacheQueriesTotal * prometheus . Desc
ServiceCache_FileCacheHitsTotal * prometheus . Desc
ServiceCache_FilesCached * prometheus . Desc
ServiceCache_FilesCachedTotal * prometheus . Desc
ServiceCache_FilesFlushedTotal * prometheus . Desc
ServiceCache_URICacheFlushesTotal * prometheus . Desc
ServiceCache_URICacheQueriesTotal * prometheus . Desc
ServiceCache_URICacheHitsTotal * prometheus . Desc
ServiceCache_URIsCached * prometheus . Desc
ServiceCache_URIsCachedTotal * prometheus . Desc
ServiceCache_URIsFlushedTotal * prometheus . Desc
ServiceCache_MetadataCached * prometheus . Desc
ServiceCache_MetadataCacheFlushes * prometheus . Desc
ServiceCache_MetadataCacheQueriesTotal * prometheus . Desc
ServiceCache_MetadataCacheHitsTotal * prometheus . Desc
ServiceCache_MetadataCachedTotal * prometheus . Desc
ServiceCache_MetadataFlushedTotal * prometheus . Desc
ServiceCache_OutputCacheActiveFlushedItems * prometheus . Desc
ServiceCache_OutputCacheItems * prometheus . Desc
ServiceCache_OutputCacheMemoryUsage * prometheus . Desc
ServiceCache_OutputCacheQueriesTotal * prometheus . Desc
ServiceCache_OutputCacheHitsTotal * prometheus . Desc
ServiceCache_OutputCacheFlushedItemsTotal * prometheus . Desc
ServiceCache_OutputCacheFlushesTotal * prometheus . Desc
2017-04-26 13:19:33 +00:00
appWhitelistPattern * regexp . Regexp
appBlacklistPattern * regexp . Regexp
2018-06-10 14:52:20 +00:00
iis_version simple_version
2016-08-27 14:33:23 +00:00
}
2016-09-01 14:04:43 +00:00
func NewIISCollector ( ) ( Collector , error ) {
2016-08-27 14:33:23 +00:00
const subsystem = "iis"
2021-09-25 15:00:39 +00:00
return & IISCollector {
iis_version : getIISVersion ( ) ,
siteWhitelistPattern : regexp . MustCompile ( fmt . Sprintf ( "^(?:%s)$" , * siteWhitelist ) ) ,
siteBlacklistPattern : regexp . MustCompile ( fmt . Sprintf ( "^(?:%s)$" , * siteBlacklist ) ) ,
appWhitelistPattern : regexp . MustCompile ( fmt . Sprintf ( "^(?:%s)$" , * appWhitelist ) ) ,
appBlacklistPattern : regexp . MustCompile ( fmt . Sprintf ( "^(?:%s)$" , * appBlacklist ) ) ,
// Web Service
2016-08-27 14:33:23 +00:00
CurrentAnonymousUsers : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "current_anonymous_users" ) ,
2016-08-27 14:33:23 +00:00
"Number of users who currently have an anonymous connection using the Web service (WebService.CurrentAnonymousUsers)" ,
[ ] string { "site" } ,
nil ,
) ,
CurrentBlockedAsyncIORequests : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "current_blocked_async_io_requests" ) ,
2016-08-27 14:33:23 +00:00
"Current requests temporarily blocked due to bandwidth throttling settings (WebService.CurrentBlockedAsyncIORequests)" ,
[ ] string { "site" } ,
nil ,
) ,
CurrentCGIRequests : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "current_cgi_requests" ) ,
2016-08-27 14:33:23 +00:00
"Current number of CGI requests being simultaneously processed by the Web service (WebService.CurrentCGIRequests)" ,
[ ] string { "site" } ,
nil ,
) ,
CurrentConnections : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "current_connections" ) ,
2016-08-27 14:33:23 +00:00
"Current number of connections established with the Web service (WebService.CurrentConnections)" ,
[ ] string { "site" } ,
nil ,
) ,
CurrentISAPIExtensionRequests : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "current_isapi_extension_requests" ) ,
2016-08-27 14:33:23 +00:00
"Current number of ISAPI requests being simultaneously processed by the Web service (WebService.CurrentISAPIExtensionRequests)" ,
[ ] string { "site" } ,
nil ,
) ,
CurrentNonAnonymousUsers : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "current_non_anonymous_users" ) ,
2016-08-27 14:33:23 +00:00
"Number of users who currently have a non-anonymous connection using the Web service (WebService.CurrentNonAnonymousUsers)" ,
[ ] string { "site" } ,
nil ,
) ,
TotalBytesReceived : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "received_bytes_total" ) ,
2016-08-27 14:33:23 +00:00
"Number of data bytes that have been received by the Web service (WebService.TotalBytesReceived)" ,
[ ] string { "site" } ,
nil ,
) ,
TotalBytesSent : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "sent_bytes_total" ) ,
2016-08-27 14:33:23 +00:00
"Number of data bytes that have been sent by the Web service (WebService.TotalBytesSent)" ,
[ ] string { "site" } ,
nil ,
) ,
TotalAnonymousUsers : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "anonymous_users_total" ) ,
2016-08-27 14:33:23 +00:00
"Total number of users who established an anonymous connection with the Web service (WebService.TotalAnonymousUsers)" ,
[ ] string { "site" } ,
nil ,
) ,
TotalBlockedAsyncIORequests : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "blocked_async_io_requests_total" ) ,
2016-08-27 14:33:23 +00:00
"Total requests temporarily blocked due to bandwidth throttling settings (WebService.TotalBlockedAsyncIORequests)" ,
[ ] string { "site" } ,
nil ,
) ,
TotalCGIRequests : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "cgi_requests_total" ) ,
2016-08-27 14:33:23 +00:00
"Total CGI requests is the total number of CGI requests (WebService.TotalCGIRequests)" ,
[ ] string { "site" } ,
nil ,
) ,
TotalConnectionAttemptsAllInstances : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "connection_attempts_all_instances_total" ) ,
2016-08-27 14:33:23 +00:00
"Number of connections that have been attempted using the Web service (WebService.TotalConnectionAttemptsAllInstances)" ,
[ ] string { "site" } ,
nil ,
) ,
TotalRequests : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "requests_total" ) ,
2016-08-27 14:33:23 +00:00
"Number of HTTP requests (WebService.TotalRequests)" ,
[ ] string { "site" , "method" } ,
nil ,
) ,
TotalFilesReceived : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "files_received_total" ) ,
2016-08-27 14:33:23 +00:00
"Number of files received by the Web service (WebService.TotalFilesReceived)" ,
[ ] string { "site" } ,
nil ,
) ,
TotalFilesSent : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "files_sent_total" ) ,
2016-08-27 14:33:23 +00:00
"Number of files sent by the Web service (WebService.TotalFilesSent)" ,
[ ] string { "site" } ,
nil ,
) ,
TotalISAPIExtensionRequests : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "ipapi_extension_requests_total" ) ,
2016-08-27 14:33:23 +00:00
"ISAPI Extension Requests received (WebService.TotalISAPIExtensionRequests)" ,
[ ] string { "site" } ,
nil ,
) ,
TotalLockedErrors : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "locked_errors_total" ) ,
2016-08-27 14:33:23 +00:00
"Number of requests that couldn't be satisfied by the server because the requested resource was locked (WebService.TotalLockedErrors)" ,
[ ] string { "site" } ,
nil ,
) ,
TotalLogonAttempts : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "logon_attempts_total" ) ,
2016-08-27 14:33:23 +00:00
"Number of logons attempts to the Web Service (WebService.TotalLogonAttempts)" ,
[ ] string { "site" } ,
nil ,
) ,
TotalNonAnonymousUsers : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "non_anonymous_users_total" ) ,
2016-08-27 14:33:23 +00:00
"Number of users who established a non-anonymous connection with the Web service (WebService.TotalNonAnonymousUsers)" ,
[ ] string { "site" } ,
nil ,
) ,
TotalNotFoundErrors : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "not_found_errors_total" ) ,
2016-08-27 14:33:23 +00:00
"Number of requests that couldn't be satisfied by the server because the requested document could not be found (WebService.TotalNotFoundErrors)" ,
[ ] string { "site" } ,
nil ,
) ,
TotalRejectedAsyncIORequests : prometheus . NewDesc (
2016-09-01 14:04:43 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "rejected_async_io_requests_total" ) ,
2016-08-27 14:33:23 +00:00
"Requests rejected due to bandwidth throttling settings (WebService.TotalRejectedAsyncIORequests)" ,
[ ] string { "site" } ,
nil ,
) ,
2021-09-25 15:00:39 +00:00
// APP_POOL_WAS
2017-04-26 13:19:33 +00:00
CurrentApplicationPoolState : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "current_application_pool_state" ) ,
"The current status of the application pool (1 - Uninitialized, 2 - Initialized, 3 - Running, 4 - Disabling, 5 - Disabled, 6 - Shutdown Pending, 7 - Delete Pending) (CurrentApplicationPoolState)" ,
2017-06-30 19:55:45 +00:00
[ ] string { "app" , "state" } ,
2017-04-26 13:19:33 +00:00
nil ,
) ,
CurrentApplicationPoolUptime : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "current_application_pool_start_time" ) ,
"The unix timestamp for the application pool start time (CurrentApplicationPoolUptime)" ,
[ ] string { "app" } ,
nil ,
) ,
CurrentWorkerProcesses : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "current_worker_processes" ) ,
"The current number of worker processes that are running in the application pool (CurrentWorkerProcesses)" ,
[ ] string { "app" } ,
nil ,
) ,
MaximumWorkerProcesses : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "maximum_worker_processes" ) ,
"The maximum number of worker processes that have been created for the application pool since Windows Process Activation Service (WAS) started (MaximumWorkerProcesses)" ,
[ ] string { "app" } ,
nil ,
) ,
RecentWorkerProcessFailures : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "recent_worker_process_failures" ) ,
"The number of times that worker processes for the application pool failed during the rapid-fail protection interval (RecentWorkerProcessFailures)" ,
[ ] string { "app" } ,
nil ,
) ,
TimeSinceLastWorkerProcessFailure : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "time_since_last_worker_process_failure" ) ,
"The length of time, in seconds, since the last worker process failure occurred for the application pool (TimeSinceLastWorkerProcessFailure)" ,
[ ] string { "app" } ,
nil ,
) ,
TotalApplicationPoolRecycles : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "total_application_pool_recycles" ) ,
"The number of times that the application pool has been recycled since Windows Process Activation Service (WAS) started (TotalApplicationPoolRecycles)" ,
[ ] string { "app" } ,
nil ,
) ,
TotalApplicationPoolUptime : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "total_application_pool_start_time" ) ,
"The unix timestamp for the application pool of when the Windows Process Activation Service (WAS) started (TotalApplicationPoolUptime)" ,
[ ] string { "app" } ,
nil ,
) ,
TotalWorkerProcessesCreated : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "total_worker_processes_created" ) ,
"The number of worker processes created for the application pool since Windows Process Activation Service (WAS) started (TotalWorkerProcessesCreated)" ,
[ ] string { "app" } ,
nil ,
) ,
TotalWorkerProcessFailures : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "total_worker_process_failures" ) ,
"The number of times that worker processes have crashed since the application pool was started (TotalWorkerProcessFailures)" ,
[ ] string { "app" } ,
nil ,
) ,
TotalWorkerProcessPingFailures : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "total_worker_process_ping_failures" ) ,
"The number of times that Windows Process Activation Service (WAS) did not receive a response to ping messages sent to a worker process (TotalWorkerProcessPingFailures)" ,
[ ] string { "app" } ,
nil ,
) ,
TotalWorkerProcessShutdownFailures : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "total_worker_process_shutdown_failures" ) ,
"The number of times that Windows Process Activation Service (WAS) failed to shut down a worker process (TotalWorkerProcessShutdownFailures)" ,
[ ] string { "app" } ,
nil ,
) ,
TotalWorkerProcessStartupFailures : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "total_worker_process_startup_failures" ) ,
"The number of times that Windows Process Activation Service (WAS) failed to start a worker process (TotalWorkerProcessStartupFailures)" ,
[ ] string { "app" } ,
nil ,
) ,
2021-12-14 13:33:04 +00:00
// W3SVC_W3WP
2021-09-25 15:00:39 +00:00
Threads : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_threads" ) ,
"" ,
[ ] string { "app" , "pid" , "state" } ,
nil ,
) ,
MaximumThreads : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_max_threads" ) ,
"" ,
[ ] string { "app" , "pid" } ,
nil ,
) ,
RequestsTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_requests_total" ) ,
"" ,
[ ] string { "app" , "pid" } ,
nil ,
) ,
RequestsActive : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_current_requests" ) ,
"" ,
[ ] string { "app" , "pid" } ,
nil ,
) ,
2017-06-30 19:55:45 +00:00
ActiveFlushedEntries : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_cache_active_flushed_entries" ) ,
"Number of file handles cached in user-mode that will be closed when all current transfers complete." ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
2021-09-25 15:00:39 +00:00
CurrentFileCacheMemoryUsage : prometheus . NewDesc (
2017-06-30 19:55:45 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "worker_file_cache_memory_bytes" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
MaximumFileCacheMemoryUsage : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_file_cache_max_memory_bytes" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
FileCacheFlushesTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_file_cache_flushes_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
FileCacheQueriesTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_file_cache_queries_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
FileCacheHitsTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_file_cache_hits_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
FilesCached : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_file_cache_items" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
FilesCachedTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_file_cache_items_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
FilesFlushedTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_file_cache_items_flushed_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
URICacheFlushesTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_uri_cache_flushes_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
URICacheQueriesTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_uri_cache_queries_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
URICacheHitsTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_uri_cache_hits_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
URIsCached : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_uri_cache_items" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
URIsCachedTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_uri_cache_items_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
URIsFlushedTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_uri_cache_items_flushed_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
MetadataCached : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_metadata_cache_items" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
MetadataCacheFlushes : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_metadata_cache_flushes_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
MetadataCacheQueriesTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_metadata_cache_queries_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
MetadataCacheHitsTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_metadata_cache_hits_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
MetadataCachedTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_metadata_cache_items_cached_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
MetadataFlushedTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_metadata_cache_items_flushed_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
OutputCacheActiveFlushedItems : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_output_cache_active_flushed_items" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
OutputCacheItems : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_output_cache_items" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
OutputCacheMemoryUsage : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_output_cache_memory_bytes" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
OutputCacheQueriesTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_output_queries_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
OutputCacheHitsTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_output_cache_hits_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
OutputCacheFlushedItemsTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_output_cache_items_flushed_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
OutputCacheFlushesTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_output_cache_flushes_total" ) ,
"" ,
2017-11-13 09:41:35 +00:00
[ ] string { "app" , "pid" } ,
2017-06-30 19:55:45 +00:00
nil ,
) ,
2021-12-14 13:33:04 +00:00
// W3SVC_W3WP_IIS8
RequestErrorsTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_request_errors_total" ) ,
"" ,
[ ] string { "app" , "pid" , "status_code" } ,
nil ,
) ,
WebSocketRequestsActive : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_current_websocket_requests" ) ,
"" ,
[ ] string { "app" , "pid" } ,
nil ,
) ,
WebSocketConnectionAttempts : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_websocket_connection_attempts_total" ) ,
"" ,
[ ] string { "app" , "pid" } ,
nil ,
) ,
WebSocketConnectionsAccepted : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_websocket_connection_accepted_total" ) ,
"" ,
[ ] string { "app" , "pid" } ,
nil ,
) ,
WebSocketConnectionsRejected : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "worker_websocket_connection_rejected_total" ) ,
"" ,
[ ] string { "app" , "pid" } ,
nil ,
) ,
2017-06-30 19:55:45 +00:00
2021-09-25 15:00:39 +00:00
// Web Service Cache
2017-06-30 19:55:45 +00:00
ServiceCache_ActiveFlushedEntries : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_cache_active_flushed_entries" ) ,
"Number of file handles cached in user-mode that will be closed when all current transfers complete." ,
nil ,
nil ,
) ,
2021-09-25 15:00:39 +00:00
ServiceCache_CurrentFileCacheMemoryUsage : prometheus . NewDesc (
2017-06-30 19:55:45 +00:00
prometheus . BuildFQName ( Namespace , subsystem , "server_file_cache_memory_bytes" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_MaximumFileCacheMemoryUsage : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_file_cache_max_memory_bytes" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_FileCacheFlushesTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_file_cache_flushes_total" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_FileCacheQueriesTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_file_cache_queries_total" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_FileCacheHitsTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_file_cache_hits_total" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_FilesCached : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_file_cache_items" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_FilesCachedTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_file_cache_items_total" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_FilesFlushedTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_file_cache_items_flushed_total" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_URICacheFlushesTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_uri_cache_flushes_total" ) ,
"" ,
[ ] string { "mode" } ,
nil ,
) ,
ServiceCache_URICacheQueriesTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_uri_cache_queries_total" ) ,
"" ,
[ ] string { "mode" } ,
nil ,
) ,
ServiceCache_URICacheHitsTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_uri_cache_hits_total" ) ,
"" ,
[ ] string { "mode" } ,
nil ,
) ,
ServiceCache_URIsCached : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_uri_cache_items" ) ,
"" ,
[ ] string { "mode" } ,
nil ,
) ,
ServiceCache_URIsCachedTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_uri_cache_items_total" ) ,
"" ,
[ ] string { "mode" } ,
nil ,
) ,
ServiceCache_URIsFlushedTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_uri_cache_items_flushed_total" ) ,
"" ,
[ ] string { "mode" } ,
nil ,
) ,
ServiceCache_MetadataCached : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_metadata_cache_items" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_MetadataCacheFlushes : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_metadata_cache_flushes_total" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_MetadataCacheQueriesTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_metadata_cache_queries_total" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_MetadataCacheHitsTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_metadata_cache_hits_total" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_MetadataCachedTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_metadata_cache_items_cached_total" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_MetadataFlushedTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_metadata_cache_items_flushed_total" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_OutputCacheActiveFlushedItems : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_output_cache_active_flushed_items" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_OutputCacheItems : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_output_cache_items" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_OutputCacheMemoryUsage : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_output_cache_memory_bytes" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_OutputCacheQueriesTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_output_cache_queries_total" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_OutputCacheHitsTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_output_cache_hits_total" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_OutputCacheFlushedItemsTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_output_cache_items_flushed_total" ) ,
"" ,
nil ,
nil ,
) ,
ServiceCache_OutputCacheFlushesTotal : prometheus . NewDesc (
prometheus . BuildFQName ( Namespace , subsystem , "server_output_cache_flushes_total" ) ,
"" ,
nil ,
nil ,
) ,
2021-09-25 15:00:39 +00:00
} , nil
2016-08-27 14:33:23 +00:00
}
// Collect sends the metric values for each metric
// to the provided prometheus Metric channel.
2019-04-05 13:59:40 +00:00
func ( c * IISCollector ) Collect ( ctx * ScrapeContext , ch chan <- prometheus . Metric ) error {
2021-09-25 15:00:39 +00:00
if desc , err := c . collectWebService ( ctx , ch ) ; err != nil {
2018-04-05 05:27:26 +00:00
log . Error ( "failed collecting iis metrics:" , desc , err )
2016-09-01 14:04:43 +00:00
return err
2016-08-27 14:33:23 +00:00
}
2021-09-25 15:00:39 +00:00
if desc , err := c . collectAPP_POOL_WAS ( ctx , ch ) ; err != nil {
log . Error ( "failed collecting iis metrics:" , desc , err )
return err
}
2016-08-27 14:33:23 +00:00
2021-09-25 15:00:39 +00:00
if desc , err := c . collectW3SVC_W3WP ( ctx , ch ) ; err != nil {
log . Error ( "failed collecting iis metrics:" , desc , err )
return err
}
2016-08-27 14:33:23 +00:00
2021-09-25 15:00:39 +00:00
if desc , err := c . collectWebServiceCache ( ctx , ch ) ; err != nil {
log . Error ( "failed collecting iis metrics:" , desc , err )
return err
}
2017-04-26 13:19:33 +00:00
2021-09-25 15:00:39 +00:00
return nil
2017-04-26 13:19:33 +00:00
}
2021-09-25 15:00:39 +00:00
type perflibWebService struct {
2017-06-30 19:55:45 +00:00
Name string
2021-09-25 15:00:39 +00:00
CurrentAnonymousUsers float64 ` perflib:"Current Anonymous Users" `
CurrentBlockedAsyncIORequests float64 ` perflib:"Current Blocked Async I/O Requests" `
CurrentCGIRequests float64 ` perflib:"Current CGI Requests" `
CurrentConnections float64 ` perflib:"Current Connections" `
CurrentISAPIExtensionRequests float64 ` perflib:"Current ISAPI Extension Requests" `
CurrentNonAnonymousUsers float64 ` perflib:"Current NonAnonymous Users" `
TotalBytesReceived float64 ` perflib:"Total Bytes Received" `
TotalBytesSent float64 ` perflib:"Total Bytes Sent" `
TotalAnonymousUsers float64 ` perflib:"Total Anonymous Users" `
TotalBlockedAsyncIORequests float64 ` perflib:"Total Blocked Async I/O Requests" `
TotalCGIRequests float64 ` perflib:"Total CGI Requests" `
TotalConnectionAttemptsAllInstances float64 ` perflib:"Total Connection Attempts (all instances)" `
TotalFilesReceived float64 ` perflib:"Total Files Received" `
TotalFilesSent float64 ` perflib:"Total Files Sent" `
TotalISAPIExtensionRequests float64 ` perflib:"Total ISAPI Extension Requests" `
TotalLockedErrors float64 ` perflib:"Total Locked Errors" `
TotalLogonAttempts float64 ` perflib:"Total Logon Attempts" `
TotalNonAnonymousUsers float64 ` perflib:"Total NonAnonymous Users" `
TotalNotFoundErrors float64 ` perflib:"Total Not Found Errors" `
TotalRejectedAsyncIORequests float64 ` perflib:"Total Rejected Async I/O Requests" `
TotalCopyRequests float64 ` perflib:"Total Copy Requests" `
TotalDeleteRequests float64 ` perflib:"Total Delete Requests" `
TotalGetRequests float64 ` perflib:"Total Get Requests" `
TotalHeadRequests float64 ` perflib:"Total Head Requests" `
TotalLockRequests float64 ` perflib:"Total Lock Requests" `
TotalMkcolRequests float64 ` perflib:"Total Mkcol Requests" `
TotalMoveRequests float64 ` perflib:"Total Move Requests" `
TotalOptionsRequests float64 ` perflib:"Total Options Requests" `
TotalOtherRequests float64 ` perflib:"Total Other Request Methods" `
TotalPostRequests float64 ` perflib:"Total Post Requests" `
TotalPropfindRequests float64 ` perflib:"Total Propfind Requests" `
TotalProppatchRequests float64 ` perflib:"Total Proppatch Requests" `
TotalPutRequests float64 ` perflib:"Total Put Requests" `
TotalSearchRequests float64 ` perflib:"Total Search Requests" `
TotalTraceRequests float64 ` perflib:"Total Trace Requests" `
TotalUnlockRequests float64 ` perflib:"Total Unlock Requests" `
2017-07-15 12:56:09 +00:00
}
2021-09-25 15:00:39 +00:00
func ( c * IISCollector ) collectWebService ( ctx * ScrapeContext , ch chan <- prometheus . Metric ) ( * prometheus . Desc , error ) {
var WebService [ ] perflibWebService
if err := unmarshalObject ( ctx . perfObjects [ "Web Service" ] , & WebService ) ; err != nil {
2016-08-27 14:33:23 +00:00
return nil , err
}
2021-09-25 15:00:39 +00:00
for _ , app := range WebService {
2016-08-27 14:33:23 +00:00
ch <- prometheus . MustNewConstMetric (
c . CurrentAnonymousUsers ,
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . CurrentAnonymousUsers ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . CurrentBlockedAsyncIORequests ,
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . CurrentBlockedAsyncIORequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . CurrentCGIRequests ,
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . CurrentCGIRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . CurrentConnections ,
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . CurrentConnections ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . CurrentISAPIExtensionRequests ,
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . CurrentISAPIExtensionRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . CurrentNonAnonymousUsers ,
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . CurrentNonAnonymousUsers ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . TotalBytesReceived ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalBytesReceived ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . TotalBytesSent ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalBytesSent ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . TotalAnonymousUsers ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalAnonymousUsers ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . TotalBlockedAsyncIORequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalBlockedAsyncIORequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . TotalCGIRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalCGIRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . TotalConnectionAttemptsAllInstances ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalConnectionAttemptsAllInstances ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . TotalFilesReceived ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalFilesReceived ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . TotalFilesSent ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalFilesSent ,
app . Name ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalISAPIExtensionRequests ,
prometheus . CounterValue ,
app . TotalISAPIExtensionRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . TotalLockedErrors ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalLockedErrors ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . TotalLogonAttempts ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalLogonAttempts ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . TotalNonAnonymousUsers ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalNonAnonymousUsers ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . TotalNotFoundErrors ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalNotFoundErrors ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
2021-09-25 15:00:39 +00:00
c . TotalRejectedAsyncIORequests ,
2016-08-27 14:33:23 +00:00
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalRejectedAsyncIORequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalOtherRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"other" ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalCopyRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"COPY" ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalDeleteRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"DELETE" ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalGetRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"GET" ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalHeadRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"HEAD" ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalLockRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"LOCK" ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalMkcolRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"MKCOL" ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalMoveRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"MOVE" ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalOptionsRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"OPTIONS" ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalPostRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"POST" ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalPropfindRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"PROPFIND" ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalProppatchRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"PROPPATCH" ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalPutRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"PUT" ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalSearchRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"SEARCH" ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalTraceRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"TRACE" ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalRequests ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalUnlockRequests ,
app . Name ,
2016-08-27 14:33:23 +00:00
"UNLOCK" ,
)
}
2017-06-30 19:55:45 +00:00
2021-09-25 15:00:39 +00:00
return nil , nil
}
type perflibAPP_POOL_WAS struct {
Name string
Frequency_Object uint64
Timestamp_Object uint64
CurrentApplicationPoolState float64 ` perflib:"Current Application Pool State" `
CurrentApplicationPoolUptime float64 ` perflib:"Current Application Pool Uptime" `
CurrentWorkerProcesses float64 ` perflib:"Current Worker Processes" `
MaximumWorkerProcesses float64 ` perflib:"Maximum Worker Processes" `
RecentWorkerProcessFailures float64 ` perflib:"Recent Worker Process Failures" `
TimeSinceLastWorkerProcessFailure float64 ` perflib:"Time Since Last Worker Process Failure" `
TotalApplicationPoolRecycles float64 ` perflib:"Total Application Pool Recycles" `
TotalApplicationPoolUptime float64 ` perflib:"Total Application Pool Uptime" `
TotalWorkerProcessesCreated float64 ` perflib:"Total Worker Processes Created" `
TotalWorkerProcessFailures float64 ` perflib:"Total Worker Process Failures" `
TotalWorkerProcessPingFailures float64 ` perflib:"Total Worker Process Ping Failures" `
TotalWorkerProcessShutdownFailures float64 ` perflib:"Total Worker Process Shutdown Failures" `
TotalWorkerProcessStartupFailures float64 ` perflib:"Total Worker Process Startup Failures" `
}
var applicationStates = map [ uint32 ] string {
1 : "Uninitialized" ,
2 : "Initialized" ,
3 : "Running" ,
4 : "Disabling" ,
5 : "Disabled" ,
6 : "Shutdown Pending" ,
7 : "Delete Pending" ,
}
func ( c * IISCollector ) collectAPP_POOL_WAS ( ctx * ScrapeContext , ch chan <- prometheus . Metric ) ( * prometheus . Desc , error ) {
var APP_POOL_WAS [ ] perflibAPP_POOL_WAS
if err := unmarshalObject ( ctx . perfObjects [ "APP_POOL_WAS" ] , & APP_POOL_WAS ) ; err != nil {
2017-04-26 13:19:33 +00:00
return nil , err
}
2021-09-25 15:00:39 +00:00
for _ , app := range APP_POOL_WAS {
2018-10-04 19:55:00 +00:00
for key , label := range applicationStates {
2017-04-26 13:19:33 +00:00
isCurrentState := 0.0
2021-09-25 15:00:39 +00:00
if key == uint32 ( app . CurrentApplicationPoolState ) {
2017-04-26 13:19:33 +00:00
isCurrentState = 1.0
}
ch <- prometheus . MustNewConstMetric (
c . CurrentApplicationPoolState ,
prometheus . GaugeValue ,
isCurrentState ,
app . Name ,
label ,
)
}
ch <- prometheus . MustNewConstMetric (
c . CurrentApplicationPoolUptime ,
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . CurrentApplicationPoolUptime ,
2017-04-26 13:19:33 +00:00
app . Name ,
)
ch <- prometheus . MustNewConstMetric (
c . CurrentWorkerProcesses ,
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . CurrentWorkerProcesses ,
2017-04-26 13:19:33 +00:00
app . Name ,
)
ch <- prometheus . MustNewConstMetric (
c . MaximumWorkerProcesses ,
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . MaximumWorkerProcesses ,
2017-04-26 13:19:33 +00:00
app . Name ,
)
ch <- prometheus . MustNewConstMetric (
c . RecentWorkerProcessFailures ,
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . RecentWorkerProcessFailures ,
2017-04-26 13:19:33 +00:00
app . Name ,
)
ch <- prometheus . MustNewConstMetric (
c . TimeSinceLastWorkerProcessFailure ,
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . TimeSinceLastWorkerProcessFailure ,
2017-04-26 13:19:33 +00:00
app . Name ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalApplicationPoolRecycles ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalApplicationPoolRecycles ,
2017-04-26 13:19:33 +00:00
app . Name ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalApplicationPoolUptime ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalApplicationPoolUptime ,
2017-04-26 13:19:33 +00:00
app . Name ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalWorkerProcessesCreated ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalWorkerProcessesCreated ,
2017-04-26 13:19:33 +00:00
app . Name ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalWorkerProcessFailures ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalWorkerProcessFailures ,
2017-04-26 13:19:33 +00:00
app . Name ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalWorkerProcessPingFailures ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalWorkerProcessPingFailures ,
2017-04-26 13:19:33 +00:00
app . Name ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalWorkerProcessShutdownFailures ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalWorkerProcessShutdownFailures ,
2017-04-26 13:19:33 +00:00
app . Name ,
)
ch <- prometheus . MustNewConstMetric (
c . TotalWorkerProcessStartupFailures ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . TotalWorkerProcessStartupFailures ,
2017-04-26 13:19:33 +00:00
app . Name ,
)
}
2016-08-27 14:33:23 +00:00
2021-09-25 15:00:39 +00:00
return nil , nil
}
var workerProcessNameExtractor = regexp . MustCompile ( ` ^(\d+)_(.+)$ ` )
type perflibW3SVC_W3WP struct {
Name string
Threads float64 ` perflib:"Active Threads Count" `
MaximumThreads float64 ` perflib:"Maximum Threads Count" `
RequestsTotal float64 ` perflib:"Total HTTP Requests Served" `
RequestsActive float64 ` perflib:"Active Requests" `
ActiveFlushedEntries float64 ` perflib:"Active Flushed Entries" `
CurrentFileCacheMemoryUsage float64 ` perflib:"Current File Cache Memory Usage" `
MaximumFileCacheMemoryUsage float64 ` perflib:"Maximum File Cache Memory Usage" `
FileCacheFlushesTotal float64 ` perflib:"File Cache Flushes" `
FileCacheHitsTotal float64 ` perflib:"File Cache Hits" `
FileCacheMissesTotal float64 ` perflib:"File Cache Misses" `
FilesCached float64 ` perflib:"Current Files Cached" `
FilesCachedTotal float64 ` perflib:"Total Files Cached" `
FilesFlushedTotal float64 ` perflib:"Total Flushed Files" `
FileCacheQueriesTotal float64
URICacheFlushesTotal float64 ` perflib:"Total Flushed URIs" `
URICacheFlushesTotalKernel float64 ` perflib:"Total Flushed URIs" `
URIsFlushedTotalKernel float64 ` perflib:"Kernel\: Total Flushed URIs" `
URICacheHitsTotal float64 ` perflib:"URI Cache Hits" `
URICacheHitsTotalKernel float64 ` perflib:"Kernel\: URI Cache Hits" `
URICacheMissesTotal float64 ` perflib:"URI Cache Misses" `
URICacheMissesTotalKernel float64 ` perflib:"Kernel\: URI Cache Misses" `
URIsCached float64 ` perflib:"Current URIs Cached" `
URIsCachedKernel float64 ` perflib:"Kernel\: Current URIs Cached" `
URIsCachedTotal float64 ` perflib:"Total URIs Cached" `
URIsCachedTotalKernel float64 ` perflib:"Total URIs Cached" `
URIsFlushedTotal float64 ` perflib:"Total Flushed URIs" `
URICacheQueriesTotal float64
MetaDataCacheHits float64 ` perflib:"Metadata Cache Hits" `
MetaDataCacheMisses float64 ` perflib:"Metadata Cache Misses" `
MetadataCached float64 ` perflib:"Current Metadata Cached" `
MetadataCacheFlushes float64 ` perflib:"Metadata Cache Flushes" `
MetadataCachedTotal float64 ` perflib:"Total Metadata Cached" `
MetadataFlushedTotal float64 ` perflib:"Total Flushed Metadata" `
MetadataCacheQueriesTotal float64
OutputCacheActiveFlushedItems float64 ` perflib:"Output Cache Current Flushed Items" `
OutputCacheItems float64 ` perflib:"Output Cache Current Items" `
OutputCacheMemoryUsage float64 ` perflib:"Output Cache Current Memory Usage" `
OutputCacheHitsTotal float64 ` perflib:"Output Cache Total Hits" `
OutputCacheMissesTotal float64 ` perflib:"Output Cache Total Misses" `
OutputCacheFlushedItemsTotal float64 ` perflib:"Output Cache Total Flushed Items" `
OutputCacheFlushesTotal float64 ` perflib:"Output Cache Total Flushes" `
OutputCacheQueriesTotal float64
}
type perflibW3SVC_W3WP_IIS8 struct {
Name string
RequestErrorsTotal float64
RequestErrors500 float64 ` perflib:"% 500 HTTP Response Sent" `
RequestErrors404 float64 ` perflib:"% 404 HTTP Response Sent" `
RequestErrors403 float64 ` perflib:"% 403 HTTP Response Sent" `
RequestErrors401 float64 ` perflib:"% 401 HTTP Response Sent" `
WebSocketRequestsActive float64 ` perflib:"WebSocket Active Requests" `
WebSocketConnectionAttempts float64 ` perflib:"WebSocket Connection Attempts / Sec" `
WebSocketConnectionsAccepted float64 ` perflib:"WebSocket Connections Accepted / Sec" `
WebSocketConnectionsRejected float64 ` perflib:"WebSocket Connections Rejected / Sec" `
}
func ( c * IISCollector ) collectW3SVC_W3WP ( ctx * ScrapeContext , ch chan <- prometheus . Metric ) ( * prometheus . Desc , error ) {
var W3SVC_W3WP [ ] perflibW3SVC_W3WP
if err := unmarshalObject ( ctx . perfObjects [ "W3SVC_W3WP" ] , & W3SVC_W3WP ) ; err != nil {
2017-06-30 19:55:45 +00:00
return nil , err
}
2021-09-25 15:00:39 +00:00
for _ , app := range W3SVC_W3WP {
2017-06-30 19:55:45 +00:00
// Extract the apppool name from the format <PID>_<NAME>
2021-09-25 15:00:39 +00:00
pid := workerProcessNameExtractor . ReplaceAllString ( app . Name , "$1" )
2017-11-13 09:41:35 +00:00
name := workerProcessNameExtractor . ReplaceAllString ( app . Name , "$2" )
2021-09-25 15:00:39 +00:00
if name == "" {
log . Error ( "no instances found in W3SVC_W3WP - skipping collection" )
break
}
2017-06-30 19:55:45 +00:00
if name == "_Total" ||
c . appBlacklistPattern . MatchString ( name ) ||
! c . appWhitelistPattern . MatchString ( name ) {
continue
}
2021-09-25 15:00:39 +00:00
ch <- prometheus . MustNewConstMetric (
c . Threads ,
prometheus . GaugeValue ,
app . Threads ,
name ,
pid ,
"busy" ,
)
ch <- prometheus . MustNewConstMetric (
c . Threads ,
prometheus . GaugeValue ,
app . Threads ,
name ,
pid ,
"idle" ,
)
ch <- prometheus . MustNewConstMetric (
c . MaximumThreads ,
prometheus . CounterValue ,
app . MaximumThreads ,
name ,
pid ,
)
ch <- prometheus . MustNewConstMetric (
c . RequestsTotal ,
prometheus . CounterValue ,
app . RequestsTotal ,
name ,
pid ,
)
ch <- prometheus . MustNewConstMetric (
c . RequestsActive ,
prometheus . CounterValue ,
app . RequestsActive ,
name ,
pid ,
)
2017-06-30 19:55:45 +00:00
ch <- prometheus . MustNewConstMetric (
c . ActiveFlushedEntries ,
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . ActiveFlushedEntries ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
2021-09-25 15:00:39 +00:00
c . CurrentFileCacheMemoryUsage ,
2017-06-30 19:55:45 +00:00
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . CurrentFileCacheMemoryUsage ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . MaximumFileCacheMemoryUsage ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . MaximumFileCacheMemoryUsage ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . FileCacheFlushesTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . FileCacheFlushesTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . FileCacheQueriesTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . FileCacheHitsTotal + app . FileCacheMissesTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . FileCacheHitsTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . FileCacheHitsTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . FilesCached ,
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . FilesCached ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . FilesCachedTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . FilesCachedTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . FilesFlushedTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . FilesFlushedTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . URICacheFlushesTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . URICacheFlushesTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . URICacheQueriesTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . URICacheHitsTotal + app . URICacheMissesTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . URICacheHitsTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . URICacheHitsTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . URIsCached ,
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . URIsCached ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . URIsCachedTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . URIsCachedTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . URIsFlushedTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . URIsFlushedTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . MetadataCached ,
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . MetadataCached ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . MetadataCacheFlushes ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . MetadataCacheFlushes ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . MetadataCacheQueriesTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . MetaDataCacheHits + app . MetaDataCacheMisses ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . MetadataCacheHitsTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . MetaDataCacheHits ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . MetadataCachedTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . MetadataCachedTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . MetadataFlushedTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . MetadataFlushedTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . OutputCacheActiveFlushedItems ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . OutputCacheActiveFlushedItems ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . OutputCacheItems ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . OutputCacheItems ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . OutputCacheMemoryUsage ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . OutputCacheMemoryUsage ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . OutputCacheQueriesTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . OutputCacheHitsTotal + app . OutputCacheMissesTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . OutputCacheHitsTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . OutputCacheHitsTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . OutputCacheFlushedItemsTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . OutputCacheFlushedItemsTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
c . OutputCacheFlushesTotal ,
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . OutputCacheFlushesTotal ,
2017-06-30 19:55:45 +00:00
name ,
2017-11-13 09:41:35 +00:00
pid ,
2017-06-30 19:55:45 +00:00
)
2021-09-25 15:00:39 +00:00
if c . iis_version . major >= 8 {
var W3SVC_W3WP_IIS8 [ ] perflibW3SVC_W3WP_IIS8
2021-12-14 13:33:04 +00:00
if err := unmarshalObject ( ctx . perfObjects [ "W3SVC_W3WP" ] , & W3SVC_W3WP_IIS8 ) ; err != nil {
2021-09-25 15:00:39 +00:00
return nil , err
}
for _ , app := range W3SVC_W3WP_IIS8 {
// Extract the apppool name from the format <PID>_<NAME>
pid := workerProcessNameExtractor . ReplaceAllString ( app . Name , "$1" )
name := workerProcessNameExtractor . ReplaceAllString ( app . Name , "$2" )
if name == "" {
log . Error ( "no instances found in W3SVC_W3WP_IIS8 - skipping collection" )
break
}
if name == "_Total" ||
c . appBlacklistPattern . MatchString ( name ) ||
! c . appWhitelistPattern . MatchString ( name ) {
continue
}
ch <- prometheus . MustNewConstMetric (
c . RequestErrorsTotal ,
prometheus . CounterValue ,
app . RequestErrors401 ,
name ,
pid ,
"401" ,
)
ch <- prometheus . MustNewConstMetric (
c . RequestErrorsTotal ,
prometheus . CounterValue ,
app . RequestErrors403 ,
name ,
pid ,
"403" ,
)
ch <- prometheus . MustNewConstMetric (
c . RequestErrorsTotal ,
prometheus . CounterValue ,
app . RequestErrors404 ,
name ,
pid ,
"404" ,
)
ch <- prometheus . MustNewConstMetric (
c . RequestErrorsTotal ,
prometheus . CounterValue ,
app . RequestErrors500 ,
name ,
pid ,
"500" ,
)
ch <- prometheus . MustNewConstMetric (
c . WebSocketRequestsActive ,
prometheus . CounterValue ,
app . WebSocketRequestsActive ,
name ,
pid ,
)
ch <- prometheus . MustNewConstMetric (
c . WebSocketConnectionAttempts ,
prometheus . CounterValue ,
app . WebSocketConnectionAttempts ,
name ,
pid ,
)
ch <- prometheus . MustNewConstMetric (
c . WebSocketConnectionsAccepted ,
prometheus . CounterValue ,
app . WebSocketConnectionsAccepted ,
name ,
pid ,
)
ch <- prometheus . MustNewConstMetric (
c . WebSocketConnectionsRejected ,
prometheus . CounterValue ,
app . WebSocketConnectionsRejected ,
name ,
pid ,
)
}
}
}
return nil , nil
}
type perflibWebServiceCache struct {
Name string
ServiceCache_ActiveFlushedEntries float64 ` perflib:"Active Flushed Entries" `
ServiceCache_CurrentFileCacheMemoryUsage float64 ` perflib:"Current File Cache Memory Usage" `
ServiceCache_MaximumFileCacheMemoryUsage float64 ` perflib:"Maximum File Cache Memory Usage" `
ServiceCache_FileCacheFlushesTotal float64 ` perflib:"File Cache Flushes" `
ServiceCache_FileCacheHitsTotal float64 ` perflib:"File Cache Hits" `
ServiceCache_FileCacheMissesTotal float64 ` perflib:"File Cache Misses" `
ServiceCache_FilesCached float64 ` perflib:"Current Files Cached" `
ServiceCache_FilesCachedTotal float64 ` perflib:"Total Files Cached" `
ServiceCache_FilesFlushedTotal float64 ` perflib:"Total Flushed Files" `
ServiceCache_FileCacheQueriesTotal float64
ServiceCache_URICacheFlushesTotal float64 ` perflib:"Total Flushed URIs" `
ServiceCache_URICacheFlushesTotalKernel float64 ` perflib:"Total Flushed URIs" `
ServiceCache_URIsFlushedTotalKernel float64 ` perflib:"Kernel: Total Flushed URIs" `
ServiceCache_URICacheHitsTotal float64 ` perflib:"URI Cache Hits" `
ServiceCache_URICacheHitsTotalKernel float64 ` perflib:"Kernel: URI Cache Hits" `
ServiceCache_URICacheMissesTotal float64 ` perflib:"URI Cache Misses" `
ServiceCache_URICacheMissesTotalKernel float64 ` perflib:"Kernel: URI Cache Misses" `
ServiceCache_URIsCached float64 ` perflib:"Current URIs Cached" `
ServiceCache_URIsCachedKernel float64 ` perflib:"Kernel: Current URIs Cached" `
ServiceCache_URIsCachedTotal float64 ` perflib:"Total URIs Cached" `
ServiceCache_URIsCachedTotalKernel float64 ` perflib:"Total URIs Cached" `
ServiceCache_URIsFlushedTotal float64 ` perflib:"Total Flushed URIs" `
ServiceCache_URICacheQueriesTotal float64
ServiceCache_MetaDataCacheHits float64 ` perflib:"Metadata Cache Hits" `
ServiceCache_MetaDataCacheMisses float64 ` perflib:"Metadata Cache Misses" `
ServiceCache_MetadataCached float64 ` perflib:"Current Metadata Cached" `
ServiceCache_MetadataCacheFlushes float64 ` perflib:"Metadata Cache Flushes" `
ServiceCache_MetadataCachedTotal float64 ` perflib:"Total Metadata Cached" `
ServiceCache_MetadataFlushedTotal float64 ` perflib:"Total Flushed Metadata" `
ServiceCache_MetadataCacheQueriesTotal float64
ServiceCache_OutputCacheActiveFlushedItems float64 ` perflib:"Output Cache Current Flushed Items" `
ServiceCache_OutputCacheItems float64 ` perflib:"Output Cache Current Items" `
ServiceCache_OutputCacheMemoryUsage float64 ` perflib:"Output Cache Current Memory Usage" `
ServiceCache_OutputCacheHitsTotal float64 ` perflib:"Output Cache Total Hits" `
ServiceCache_OutputCacheMissesTotal float64 ` perflib:"Output Cache Total Misses" `
ServiceCache_OutputCacheFlushedItemsTotal float64 ` perflib:"Output Cache Total Flushed Items" `
ServiceCache_OutputCacheFlushesTotal float64 ` perflib:"Output Cache Total Flushes" `
ServiceCache_OutputCacheQueriesTotal float64
}
func ( c * IISCollector ) collectWebServiceCache ( ctx * ScrapeContext , ch chan <- prometheus . Metric ) ( * prometheus . Desc , error ) {
var WebServiceCache [ ] perflibWebServiceCache
if err := unmarshalObject ( ctx . perfObjects [ "Web Service Cache" ] , & WebServiceCache ) ; err != nil {
return nil , err
}
for _ , app := range WebServiceCache {
2017-06-30 19:55:45 +00:00
ch <- prometheus . MustNewConstMetric (
2021-09-25 15:00:39 +00:00
c . ServiceCache_ActiveFlushedEntries ,
2017-06-30 19:55:45 +00:00
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . ServiceCache_ActiveFlushedEntries ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
2021-09-25 15:00:39 +00:00
c . ServiceCache_CurrentFileCacheMemoryUsage ,
2017-06-30 19:55:45 +00:00
prometheus . GaugeValue ,
2021-09-25 15:00:39 +00:00
app . ServiceCache_CurrentFileCacheMemoryUsage ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
2021-09-25 15:00:39 +00:00
c . ServiceCache_MaximumFileCacheMemoryUsage ,
2017-06-30 19:55:45 +00:00
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . ServiceCache_MaximumFileCacheMemoryUsage ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
2021-09-25 15:00:39 +00:00
c . ServiceCache_FileCacheFlushesTotal ,
2017-06-30 19:55:45 +00:00
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . ServiceCache_FileCacheFlushesTotal ,
2017-06-30 19:55:45 +00:00
)
ch <- prometheus . MustNewConstMetric (
2021-09-25 15:00:39 +00:00
c . ServiceCache_FileCacheQueriesTotal ,
2017-06-30 19:55:45 +00:00
prometheus . CounterValue ,
2021-09-25 15:00:39 +00:00
app . ServiceCache_FileCacheHitsTotal + app . ServiceCache_FileCacheMissesTotal ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_FileCacheHitsTotal ,
prometheus . CounterValue ,
app . ServiceCache_FileCacheHitsTotal ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_FilesCached ,
prometheus . GaugeValue ,
app . ServiceCache_FilesCached ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_FilesCachedTotal ,
prometheus . CounterValue ,
app . ServiceCache_FilesCachedTotal ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_FilesFlushedTotal ,
prometheus . CounterValue ,
app . ServiceCache_FilesFlushedTotal ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_URICacheFlushesTotal ,
prometheus . CounterValue ,
app . ServiceCache_URICacheFlushesTotal ,
"user" ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_URICacheFlushesTotal ,
prometheus . CounterValue ,
app . ServiceCache_URICacheFlushesTotalKernel ,
"kernel" ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_URICacheQueriesTotal ,
prometheus . CounterValue ,
app . ServiceCache_URICacheHitsTotal + app . ServiceCache_URICacheMissesTotal ,
"user" ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_URICacheQueriesTotal ,
prometheus . CounterValue ,
app . ServiceCache_URICacheHitsTotalKernel + app . ServiceCache_URICacheMissesTotalKernel ,
"kernel" ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_URICacheHitsTotal ,
prometheus . CounterValue ,
app . ServiceCache_URICacheHitsTotal ,
"user" ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_URICacheHitsTotal ,
prometheus . CounterValue ,
app . ServiceCache_URICacheHitsTotalKernel ,
"kernel" ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_URIsCached ,
prometheus . GaugeValue ,
app . ServiceCache_URIsCached ,
"user" ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_URIsCached ,
prometheus . GaugeValue ,
app . ServiceCache_URIsCachedKernel ,
"kernel" ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_URIsCachedTotal ,
prometheus . CounterValue ,
app . ServiceCache_URIsCachedTotal ,
"user" ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_URIsCachedTotal ,
prometheus . CounterValue ,
app . ServiceCache_URIsCachedTotalKernel ,
"kernel" ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_URIsFlushedTotal ,
prometheus . CounterValue ,
app . ServiceCache_URIsFlushedTotal ,
"user" ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_URIsFlushedTotal ,
prometheus . CounterValue ,
app . ServiceCache_URIsFlushedTotalKernel ,
"kernel" ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_MetadataCached ,
prometheus . GaugeValue ,
app . ServiceCache_MetadataCached ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_MetadataCacheFlushes ,
prometheus . CounterValue ,
app . ServiceCache_MetadataCacheFlushes ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_MetadataCacheQueriesTotal ,
prometheus . CounterValue ,
app . ServiceCache_MetaDataCacheHits + app . ServiceCache_MetaDataCacheMisses ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_MetadataCacheHitsTotal ,
prometheus . CounterValue ,
app . ServiceCache_MetaDataCacheHits ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_MetadataCachedTotal ,
prometheus . CounterValue ,
app . ServiceCache_MetadataCachedTotal ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_MetadataFlushedTotal ,
prometheus . CounterValue ,
app . ServiceCache_MetadataFlushedTotal ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_OutputCacheActiveFlushedItems ,
prometheus . CounterValue ,
app . ServiceCache_OutputCacheActiveFlushedItems ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_OutputCacheItems ,
prometheus . CounterValue ,
app . ServiceCache_OutputCacheItems ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_OutputCacheMemoryUsage ,
prometheus . CounterValue ,
app . ServiceCache_OutputCacheMemoryUsage ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_OutputCacheQueriesTotal ,
prometheus . CounterValue ,
app . ServiceCache_OutputCacheHitsTotal + app . ServiceCache_OutputCacheMissesTotal ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_OutputCacheHitsTotal ,
prometheus . CounterValue ,
app . ServiceCache_OutputCacheHitsTotal ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_OutputCacheFlushedItemsTotal ,
prometheus . CounterValue ,
app . ServiceCache_OutputCacheFlushedItemsTotal ,
)
ch <- prometheus . MustNewConstMetric (
c . ServiceCache_OutputCacheFlushesTotal ,
prometheus . CounterValue ,
app . ServiceCache_OutputCacheFlushesTotal ,
2017-06-30 19:55:45 +00:00
)
2017-07-15 12:56:09 +00:00
}
2017-06-30 19:55:45 +00:00
2016-08-27 14:33:23 +00:00
return nil , nil
}