Compare commits

...

3 Commits

Author SHA1 Message Date
Jan-Otto Kröpke
1e381f860d service: [0.27.x] fix panic with NewWithConfig code path (#1646)
Co-authored-by: Erik Baranowski <erik.r.baranowski@gmail.com>
2024-09-28 10:40:55 +02:00
Jan-Otto Kröpke
4e460bc24c exchange: enable all collectors as default (#1572) 2024-08-17 21:00:05 +02:00
Jan-Otto Kröpke
b5ceb27836 time: fix windows_time_computed_time_offset_seconds docs (#1571)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2024-08-17 20:07:25 +02:00
4 changed files with 41 additions and 40 deletions

7
config.yaml Normal file
View File

@@ -0,0 +1,7 @@
collectors:
enabled: cpu,cpu_info,cs,exchange,iis,logical_disk,logon,memory,net,os,process,remote_fx,service,system,tcp,time,terminal_services,textfile
collector:
service:
services-where: "Name='windows_exporter'"
log:
level: warn

View File

@@ -5,11 +5,11 @@ If the Windows Time Service is stopped after collection has started, collector m
Please note the Time Service perflib counters are only available on [Windows Server 2016 or newer](https://docs.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-server-2016-improvements).
|||
-|-
Metric name prefix | `time`
Data source | Perflib
Enabled by default? | No
| | |
|---------------------|---------|
| Metric name prefix | `time` |
| Data source | Perflib |
| Enabled by default? | No |
## Flags
@@ -17,14 +17,14 @@ None
## Metrics
Name | Description | Type | Labels
-----|-------------|------|-------
`windows_time_clock_frequency_Adjustment_ppb_total` | Total adjustment made to the local system clock frequency by W32Time in parts per billion (PPB) units. 1 PPB adjustment implies the system clock was adjusted at a rate of 1 nanosecond per second (1 ns/s). The smallest possible adjustment can vary and is expected to be in the order of 100's of PPB. | counter | None
`windows_time_computed_time_offset_seconds` | Absolute time offset between the system clock and the chosen time source, in seconds. | counter | None
`windows_time_ntp_client_time_sources` | Active number of NTP Time sources being used by the client. This is a count of active, distinct IP addresses of time servers that are responding to this client's requests. | gauge | None
`windows_time_ntp_round_trip_delay_seconds` | Total roundtrip delay experienced by the NTP client in receiving a response from the server for the most recent request, in seconds. This is the time elapsed on the NTP client between transmitting a request to the NTP server and receiving a valid response from the server. | gauge | None
`windows_time_ntp_server_outgoing_responses_total` | Total number of requests responded to by the NTP server. | counter | None
`windows_time_ntp_server_incoming_requests_total` | Total number of requests received by the NTP server. | counter | None
| Name | Description | Type | Labels |
|-----------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|--------|
| `windows_time_clock_frequency_adjustment_ppb_total` | Total adjustment made to the local system clock frequency by W32Time in parts per billion (PPB) units. 1 PPB adjustment implies the system clock was adjusted at a rate of 1 nanosecond per second (1 ns/s). The smallest possible adjustment can vary and is expected to be in the order of 100's of PPB. | counter | None |
| `windows_time_computed_time_offset_seconds` | The absolute time offset between the system clock and the chosen time source, as computed by the W32Time service in microseconds. When a new valid sample is available, the computed time is updated with the time offset indicated by the sample. This time is the actual time offset of the local clock. W32Time initiates clock correction by using this offset and updates the computed time in between samples with the remaining time offset that needs to be applied to the local clock. Clock accuracy can be tracked by using this performance counter with a low polling interval (for example, 256 seconds or less) and looking for the counter value to be smaller than the desired clock accuracy limit. | gauge | None |
| `windows_time_ntp_client_time_sources` | Active number of NTP Time sources being used by the client. This is a count of active, distinct IP addresses of time servers that are responding to this client's requests. | gauge | None |
| `windows_time_ntp_round_trip_delay_seconds` | Total roundtrip delay experienced by the NTP client in receiving a response from the server for the most recent request, in seconds. This is the time elapsed on the NTP client between transmitting a request to the NTP server and receiving a valid response from the server. | gauge | None |
| `windows_time_ntp_server_outgoing_responses_total` | Total number of requests responded to by the NTP server. | counter | None |
| `windows_time_ntp_server_incoming_requests_total` | Total number of requests received by the NTP server. | counter | None |
### Example metric
_This collector does not yet have explained examples, we would appreciate your help adding them!_

View File

@@ -23,7 +23,18 @@ type Config struct {
}
var ConfigDefaults = Config{
CollectorsEnabled: []string{},
CollectorsEnabled: []string{
"ADAccessProcesses",
"TransportQueues",
"HttpProxy",
"ActiveSync",
"AvailabilityService",
"OutlookWebAccess",
"Autodiscover",
"WorkloadManagement",
"RpcClientAccess",
"MapiHttpEmsmdb",
},
}
type Collector struct {
@@ -72,20 +83,6 @@ type Collector struct {
enabledCollectors []string
}
// All available Collector functions.
var exchangeAllCollectorNames = []string{
"ADAccessProcesses",
"TransportQueues",
"HttpProxy",
"ActiveSync",
"AvailabilityService",
"OutlookWebAccess",
"Autodiscover",
"WorkloadManagement",
"RpcClientAccess",
"MapiHttpEmsmdb",
}
func New(logger log.Logger, config *Config) *Collector {
if config == nil {
config = &ConfigDefaults
@@ -141,7 +138,7 @@ func NewWithFlags(app *kingpin.Application) *Collector {
sb := strings.Builder{}
sb.WriteString(fmt.Sprintf("%-32s %-32s\n", "Collector Name", "[PerfID] Perflib Object"))
for _, cname := range exchangeAllCollectorNames {
for _, cname := range ConfigDefaults.CollectorsEnabled {
sb.WriteString(fmt.Sprintf("%-32s %-32s\n", cname, collectorDesc[cname]))
}
@@ -239,22 +236,18 @@ func (c *Collector) Build() error {
c.syncCommandsPerSec = desc("activesync_sync_cmds_total", "Number of sync commands processed per second. Clients use this command to synchronize items within a folder")
c.activeUserCountMapiHttpEmsMDB = desc("mapihttp_emsmdb_active_user_count", "Number of unique outlook users that have shown some kind of activity in the last 2 minutes")
if len(c.config.CollectorsEnabled) == 0 {
c.enabledCollectors = exchangeAllCollectorNames
} else {
c.enabledCollectors = make([]string, 0, len(exchangeAllCollectorNames))
c.enabledCollectors = make([]string, 0, len(ConfigDefaults.CollectorsEnabled))
for _, collectorName := range c.config.CollectorsEnabled {
if !slices.Contains(exchangeAllCollectorNames, collectorName) {
return fmt.Errorf("unknown exchange collector: %s", collectorName)
}
c.enabledCollectors = append(c.enabledCollectors, collectorName)
for _, collectorName := range c.config.CollectorsEnabled {
if !slices.Contains(ConfigDefaults.CollectorsEnabled, collectorName) {
return fmt.Errorf("unknown exchange collector: %s", collectorName)
}
c.enabledCollectors = slices.Clip(c.enabledCollectors)
c.enabledCollectors = append(c.enabledCollectors, collectorName)
}
c.enabledCollectors = slices.Clip(c.enabledCollectors)
return nil
}

View File

@@ -58,6 +58,7 @@ func New(logger log.Logger, config *Config) *Collector {
c := &Collector{
serviceWhereClause: &config.ServiceWhereClause,
useAPI: &config.UseAPI,
v2: &config.V2,
}
c.SetLogger(logger)