From 7500ad6a832e0cfc5a346f3620795042dfd7a000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 12 Oct 2024 21:27:26 +0200 Subject: [PATCH] *: Remove `teradici_pcoip` and `vmware_blast` collector (#1686) --- README.md | 2 - docs/README.md | 3 +- docs/collector.teradici_pcoip.md | 64 - docs/collector.vmware_blast.md | 98 -- .../teradici_pcoip/teradici_pcoip.go | 727 --------- .../teradici_pcoip/teradici_pcoip_test.go | 12 - .../collector/vmware_blast/vmware_blast.go | 1377 ----------------- .../vmware_blast/vmware_blast_test.go | 12 - pkg/collector/collector.go | 4 - pkg/collector/config.go | 6 - pkg/collector/map.go | 4 - 11 files changed, 1 insertion(+), 2308 deletions(-) delete mode 100644 docs/collector.teradici_pcoip.md delete mode 100644 docs/collector.vmware_blast.md delete mode 100644 internal/collector/teradici_pcoip/teradici_pcoip.go delete mode 100644 internal/collector/teradici_pcoip/teradici_pcoip_test.go delete mode 100644 internal/collector/vmware_blast/vmware_blast.go delete mode 100644 internal/collector/vmware_blast/vmware_blast_test.go diff --git a/README.md b/README.md index d8d1de75..b2a39477 100644 --- a/README.md +++ b/README.md @@ -46,13 +46,11 @@ Name | Description | Enabled by default [smtp](docs/collector.smtp.md) | IIS SMTP Server | [system](docs/collector.system.md) | System calls | ✓ [tcp](docs/collector.tcp.md) | TCP connections | -[teradici_pcoip](docs/collector.teradici_pcoip.md) | [Teradici PCoIP](https://www.teradici.com/web-help/pcoip_wmi_specs/) session metrics | [terminal_services](docs/collector.terminal_services.md) | Terminal services (RDS) [textfile](docs/collector.textfile.md) | Read prometheus metrics from a text file | [thermalzone](docs/collector.thermalzone.md) | Thermal information | [time](docs/collector.time.md) | Windows Time Service | [update](docs/collector.update.md) | Windows Update Service | -[vmware_blast](docs/collector.vmware_blast.md) | VMware Blast session metrics | [vmware](docs/collector.vmware.md) | Performance counters installed by the Vmware Guest agent | See the linked documentation on each collector for more information on reported metrics, configuration settings and usage examples. diff --git a/docs/README.md b/docs/README.md index c27faed8..5f000c80 100644 --- a/docs/README.md +++ b/docs/README.md @@ -37,10 +37,9 @@ This directory contains documentation of the collectors in the windows_exporter, - [`smtp`](collector.smtp.md) - [`system`](collector.system.md) - [`tcp`](collector.tcp.md) -- [`teradici_pcoip`](collector.teradici_pcoip.md) - [`terminal_services`](collector.terminal_services.md) - [`textfile`](collector.textfile.md) - [`thermalzone`](collector.thermalzone.md) - [`time`](collector.time.md) +- [`update`](collector.update.md) - [`vmware`](collector.vmware.md) -- [`vmware_blast`](collector.vmware_blast.md) diff --git a/docs/collector.teradici_pcoip.md b/docs/collector.teradici_pcoip.md deleted file mode 100644 index 2fc0d04c..00000000 --- a/docs/collector.teradici_pcoip.md +++ /dev/null @@ -1,64 +0,0 @@ -# teradici_pcoip collector - -The teradici_pcoip collector exposes metrics relating to Teradici PCoIP sessions - -||| --|- -Metric name prefix | `teradici_pcoip` -Classes | `Win32_PerfRawData_TeradiciPerf_PCoIPSessionAudioStatistics`, `Win32_PerfRawData_TeradiciPerf_PCoIPSessionGeneralStatistics`,`Win32_PerfRawData_TeradiciPerf_PCoIPSessionImagingStatistics`,`Win32_PerfRawData_TeradiciPerf_PCoIPSessionNetworkStatistics`,`Win32_PerfRawData_TeradiciPerf_PCoIPSessionUsbStatistics` -Enabled by default? | No - -## Flags - -None - -## Metrics - -Name | Description | Type | Labels ------|-------------|------|------- -`windows_teradici_pcoip_audio_bytes_received_total` | _Not yet documented_ | counter | None -`windows_teradici_pcoip_audio_bytes_sent_total` | _Not yet documented_ | counter | None -`windows_teradici_pcoip_audio_rx_bw_kbit_persec` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_audio_tx_bw_kbit_persec` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_audio_tx_bw_limit_kbit_persec` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_bytes_received_total` | _Not yet documented_ | counter | None -`windows_teradici_pcoip_bytes_sent_total` | _Not yet documented_ | counter | None -`windows_teradici_pcoip_packets_received_total` | _Not yet documented_ | counter | None -`windows_teradici_pcoip_packets_sent_total` | _Not yet documented_ | counter | None -`windows_teradici_pcoip_rx_packets_lost_total` | _Not yet documented_ | counter | None -`windows_teradici_pcoip_session_duration_seconds_total` | _Not yet documented_ | counter | None -`windows_teradici_pcoip_tx_packets_lost_total` | _Not yet documented_ | counter | None -`windows_teradici_pcoip_imaging_active_min_quality` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_imaging_apex2800_offload` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_imaging_bytes_received_total` | _Not yet documented_ | counter | None -`windows_teradici_pcoip_imaging_bytes_sent_total` | _Not yet documented_ | counter | None -`windows_teradici_pcoip_imaging_decoder_capability_kbit_persec` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_imaging_encoded_frames_persec` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_imaging_megapixel_persec` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_imaging_negative_acks_total` | _Not yet documented_ | counter | None -`windows_teradici_pcoip_imaging_rx_bw_kbit_persec` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_imaging_svga_devtap_frames_persec` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_imaging_tx_bw_kbit_persec` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_round_trip_latency_ms` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_rx_bw_kbit_persec` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_rx_bw_peak_kbit_persec` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_rx_packet_loss_percent` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_rx_packet_loss_percent_base` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_tx_bw_active_limit_kbit_persec` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_tx_bw_kbit_persec` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_tx_bw_limit_kbit_persec` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_tx_packet_loss_percent` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_tx_packet_loss_percent_base` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_usb_bytes_received_total` | _Not yet documented_ | counter | None -`windows_teradici_pcoip_usb_bytes_sent_total` | _Not yet documented_ | counter | None -`windows_teradici_pcoip_usb_rx_bw_kbit_persec` | _Not yet documented_ | gauge | None -`windows_teradici_pcoip_usb_tx_bw_kbit_persec` | _Not yet documented_ | gauge | None - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/docs/collector.vmware_blast.md b/docs/collector.vmware_blast.md deleted file mode 100644 index aac689ac..00000000 --- a/docs/collector.vmware_blast.md +++ /dev/null @@ -1,98 +0,0 @@ -# vmware_blast collector - -The vmware_blast collector exposes metrics relating to VMware Blast sessions - -||| --|- -Metric name prefix | `vmware_blast` -Classes | `Win32_PerfRawData_Counters_VMwareBlastAudioCounters`,`Win32_PerfRawData_Counters_VMwareBlastCDRCounters`,`Win32_PerfRawData_Counters_VMwareBlastClipboardCounters`,`Win32_PerfRawData_Counters_VMwareBlastHTML5MMRCounters`,`Win32_PerfRawData_Counters_VMwareBlastImagingCounters`,`Win32_PerfRawData_Counters_VMwareBlastRTAVCounters`,`Win32_PerfRawData_Counters_VMwareBlastSerialPortandScannerCounters`,`Win32_PerfRawData_Counters_VMwareBlastSessionCounters`,`Win32_PerfRawData_Counters_VMwareBlastSkypeforBusinessControlCounters`,`Win32_PerfRawData_Counters_VMwareBlastThinPrintCounters`,`Win32_PerfRawData_Counters_VMwareBlastUSBCounters`,`Win32_PerfRawData_Counters_VMwareBlastWindowsMediaMMRCounters` -Enabled by default? | No - -## Flags - -None - -## Metrics - -Some of these metrics may not be collected, depending on the installation options chosen when installing the Horizon agent - -Name | Description | Type | Labels ------|-------------|------|------- -`windows_vmware_blast_audio_received_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_audio_received_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_audio_transmitted_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_audio_transmitted_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_cdr_received_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_cdr_received_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_cdr_transmitted_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_cdr_transmitted_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_clipboard_received_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_clipboard_received_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_clipboard_transmitted_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_clipboard_transmitted_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_html5_mmr_received_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_html5_mmr_received_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_html5_mmr_transmitted_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_html5_mmr_transmitted_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_imaging_dirty_frames_per_second` | _Not yet documented_ | gauge | None -`windows_vmware_blast_imaging_fbc_rate` | _Not yet documented_ | gauge | None -`windows_vmware_blast_imaging_frames_per_second` | _Not yet documented_ | gauge | None -`windows_vmware_blast_imaging_poll_rate` | _Not yet documented_ | gauge | None -`windows_vmware_blast_imaging_received_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_imaging_received_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_imaging_dirty_frames_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_imaging_fbc_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_imaging_frames_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_imaging_poll_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_imaging_transmitted_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_imaging_transmitted_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_rtav_received_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_rtav_received_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_rtav_transmitted_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_rtav_transmitted_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_serial_port_and_scanner_received_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_serial_port_and_scanner_received_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_serial_port_and_scanner_transmitted_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_serial_port_and_scanner_transmitted_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_session_automatic_reconnect_count_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_session_cumlative_received_bytes_over_tcp_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_session_cumlative_received_bytes_over_udp_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_session_cumlative_transmitted_bytes_over_tcp_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_session_cumlative_transmitted_bytes_over_udp_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_session_estimated_bandwidth_uplink` | _Not yet documented_ | gauge | None -`windows_vmware_blast_session_instantaneous_received_bytes_over_tcp_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_session_instantaneous_received_bytes_over_udp_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_session_instantaneous_transmitted_bytes_over_tcp_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_session_instantaneous_transmitted_bytes_over_udp_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_session_jitter_uplink` | _Not yet documented_ | gauge | None -`windows_vmware_blast_session_packet_loss_uplink` | _Not yet documented_ | gauge | None -`windows_vmware_blast_session_received_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_session_received_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_session_rtt` | _Not yet documented_ | gauge | None -`windows_vmware_blast_session_transmitted_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_session_transmitted_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_skype_for_business_control_received_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_skype_for_business_control_received_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_skype_for_business_control_transmitted_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_skype_for_business_control_transmitted_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_thinprint_received_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_thinprint_received_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_thinprint_transmitted_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_thinprint_transmitted_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_usb_received_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_usb_received_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_usb_transmitted_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_usb_transmitted_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_windows_media_mmr_received_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_windows_media_mmr_received_packets_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_windows_media_mmr_transmitted_bytes_total` | _Not yet documented_ | counter | None -`windows_vmware_blast_windows_media_mmr_transmitted_packets_total` | _Not yet documented_ | counter | None - -### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ - -## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ - -## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ diff --git a/internal/collector/teradici_pcoip/teradici_pcoip.go b/internal/collector/teradici_pcoip/teradici_pcoip.go deleted file mode 100644 index 18591ee4..00000000 --- a/internal/collector/teradici_pcoip/teradici_pcoip.go +++ /dev/null @@ -1,727 +0,0 @@ -//go:build windows - -package teradici_pcoip - -import ( - "errors" - "log/slog" - - "github.com/alecthomas/kingpin/v2" - "github.com/prometheus-community/windows_exporter/internal/types" - "github.com/prometheus/client_golang/prometheus" - "github.com/yusufpapurcu/wmi" -) - -const Name = "teradici_pcoip" - -type Config struct{} - -var ConfigDefaults = Config{} - -// Collector is a Prometheus Collector for WMI metrics: -// win32_PerfRawData_TeradiciPerf_PCoIPSessionAudioStatistics -// win32_PerfRawData_TeradiciPerf_PCoIPSessionGeneralStatistics -// win32_PerfRawData_TeradiciPerf_PCoIPSessionImagingStatistics -// win32_PerfRawData_TeradiciPerf_PCoIPSessionNetworkStatistics -// win32_PerfRawData_TeradiciPerf_PCoIPSessionUsbStatistics. -type Collector struct { - config Config - wmiClient *wmi.Client - - audioBytesReceived *prometheus.Desc - audioBytesSent *prometheus.Desc - audioRXBWKBitPerSec *prometheus.Desc - audioTXBWKBitPerSec *prometheus.Desc - audioTXBWLimitKBitPerSec *prometheus.Desc - - bytesReceived *prometheus.Desc - bytesSent *prometheus.Desc - packetsReceived *prometheus.Desc - packetsSent *prometheus.Desc - rxPacketsLost *prometheus.Desc - sessionDurationSeconds *prometheus.Desc - txPacketsLost *prometheus.Desc - - imagingActiveMinimumQuality *prometheus.Desc - imagingApex2800Offload *prometheus.Desc - imagingBytesReceived *prometheus.Desc - imagingBytesSent *prometheus.Desc - imagingDecoderCapabilityKBitPerSec *prometheus.Desc - imagingEncodedFramesPerSec *prometheus.Desc - imagingMegapixelPerSec *prometheus.Desc - imagingNegativeAcknowledgements *prometheus.Desc - imagingRXBWKBitPerSec *prometheus.Desc - imagingSVGAdevTapframesPerSec *prometheus.Desc - imagingTXBWKBitPerSec *prometheus.Desc - - RoundTripLatencyms *prometheus.Desc - rxBWKBitPerSec *prometheus.Desc - rxBWPeakKBitPerSec *prometheus.Desc - rxPacketLossPercent *prometheus.Desc - rxPacketLossPercentBase *prometheus.Desc - txBWActiveLimitKBitPerSec *prometheus.Desc - txBWKBitPerSec *prometheus.Desc - txBWLimitKBitPerSec *prometheus.Desc - txPacketLossPercent *prometheus.Desc - txPacketLossPercentBase *prometheus.Desc - - usbBytesReceived *prometheus.Desc - usbBytesSent *prometheus.Desc - usbRXBWKBitPerSec *prometheus.Desc - usbTXBWKBitPerSec *prometheus.Desc -} - -func New(config *Config) *Collector { - if config == nil { - config = &ConfigDefaults - } - - c := &Collector{ - config: *config, - } - - return c -} - -func NewWithFlags(_ *kingpin.Application) *Collector { - return &Collector{} -} - -func (c *Collector) GetName() string { - return Name -} - -func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) { - return []string{}, nil -} - -func (c *Collector) Close(_ *slog.Logger) error { - return nil -} - -func (c *Collector) Build(logger *slog.Logger, wmiClient *wmi.Client) error { - logger.Warn("teradici_pcoip collector is deprecated and will be removed in the future.", - slog.String("collector", Name), - ) - - if wmiClient == nil || wmiClient.SWbemServicesClient == nil { - return errors.New("wmiClient or SWbemServicesClient is nil") - } - - c.wmiClient = wmiClient - - c.audioBytesReceived = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "audio_bytes_received_total"), - "(AudioBytesReceived)", - nil, - nil, - ) - c.audioBytesSent = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "audio_bytes_sent_total"), - "(AudioBytesSent)", - nil, - nil, - ) - c.audioRXBWKBitPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "audio_rx_bw_KBit_persec"), - "(AudioRXBWKBitPerSec)", - nil, - nil, - ) - c.audioTXBWKBitPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "audio_tx_bw_KBit_persec"), - "(AudioTXBWKBitPerSec)", - nil, - nil, - ) - c.audioTXBWLimitKBitPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "audio_tx_bw_limit_KBit_persec"), - "(AudioTXBWLimitKBitPerSec)", - nil, - nil, - ) - - c.bytesReceived = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "bytes_received_total"), - "(BytesReceived)", - nil, - nil, - ) - c.bytesSent = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "bytes_sent_total"), - "(BytesSent)", - nil, - nil, - ) - c.packetsReceived = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "packets_received_total"), - "(PacketsReceived)", - nil, - nil, - ) - c.packetsSent = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "packets_sent_total"), - "(PacketsSent)", - nil, - nil, - ) - c.rxPacketsLost = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "rx_packets_lost_total"), - "(RXPacketsLost)", - nil, - nil, - ) - c.sessionDurationSeconds = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_duration_seconds_total"), - "(SessionDurationSeconds)", - nil, - nil, - ) - c.txPacketsLost = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "tx_packets_lost_total"), - "(TXPacketsLost)", - nil, - nil, - ) - - c.imagingActiveMinimumQuality = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_active_min_quality"), - "(ImagingActiveMinimumQuality)", - nil, - nil, - ) - c.imagingApex2800Offload = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_apex2800_offload"), - "(ImagingApex2800Offload)", - nil, - nil, - ) - c.imagingBytesReceived = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_bytes_received_total"), - "(ImagingBytesReceived)", - nil, - nil, - ) - c.imagingBytesSent = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_bytes_sent_total"), - "(ImagingBytesSent)", - nil, - nil, - ) - c.imagingDecoderCapabilityKBitPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_decoder_capability_KBit_persec"), - "(ImagingDecoderCapabilityKBitPerSec)", - nil, - nil, - ) - c.imagingEncodedFramesPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_encoded_frames_persec"), - "(ImagingEncodedFramesPerSec)", - nil, - nil, - ) - c.imagingMegapixelPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_megapixel_persec"), - "(ImagingMegapixelPerSec)", - nil, - nil, - ) - c.imagingNegativeAcknowledgements = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_negative_acks_total"), - "(ImagingNegativeAcknowledgements)", - nil, - nil, - ) - c.imagingRXBWKBitPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_rx_bw_KBit_persec"), - "(ImagingRXBWKBitPerSec)", - nil, - nil, - ) - c.imagingSVGAdevTapframesPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_svga_devtap_frames_persec"), - "(ImagingSVGAdevTapframesPerSec)", - nil, - nil, - ) - c.imagingTXBWKBitPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_tx_bw_KBit_persec"), - "(ImagingTXBWKBitPerSec)", - nil, - nil, - ) - - c.RoundTripLatencyms = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "round_trip_latency_ms"), - "(RoundTripLatencyms)", - nil, - nil, - ) - c.rxBWKBitPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "rx_bw_KBit_persec"), - "(RXBWKBitPerSec)", - nil, - nil, - ) - c.rxBWPeakKBitPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "rx_bw_peak_KBit_persec"), - "(RXBWPeakKBitPerSec)", - nil, - nil, - ) - c.rxPacketLossPercent = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "rx_packet_loss_percent"), - "(RXPacketLossPercent)", - nil, - nil, - ) - c.rxPacketLossPercentBase = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "rx_packet_loss_percent_base"), - "(RXPacketLossPercent_Base)", - nil, - nil, - ) - c.txBWActiveLimitKBitPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "tx_bw_active_limit_KBit_persec"), - "(TXBWActiveLimitKBitPerSec)", - nil, - nil, - ) - c.txBWKBitPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "tx_bw_KBit_persec"), - "(TXBWKBitPerSec)", - nil, - nil, - ) - c.txBWLimitKBitPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "tx_bw_limit_KBit_persec"), - "(TXBWLimitKBitPerSec)", - nil, - nil, - ) - c.txPacketLossPercent = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "tx_packet_loss_percent"), - "(TXPacketLossPercent)", - nil, - nil, - ) - c.txPacketLossPercentBase = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "tx_packet_loss_percent_base"), - "(TXPacketLossPercent_Base)", - nil, - nil, - ) - - c.usbBytesReceived = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "usb_bytes_received_total"), - "(USBBytesReceived)", - nil, - nil, - ) - c.usbBytesSent = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "usb_bytes_sent_total"), - "(USBBytesSent)", - nil, - nil, - ) - c.usbRXBWKBitPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "usb_rx_bw_KBit_persec"), - "(USBRXBWKBitPerSec)", - nil, - nil, - ) - c.usbTXBWKBitPerSec = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "usb_tx_bw_KBit_persec"), - "(USBTXBWKBitPerSec)", - nil, - nil, - ) - - return nil -} - -// Collect sends the metric values for each metric -// to the provided prometheus Metric channel. -func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error { - logger = logger.With(slog.String("collector", Name)) - if err := c.collectAudio(ch); err != nil { - logger.Error("failed collecting teradici session audio metrics", - slog.Any("err", err), - ) - - return err - } - - if err := c.collectGeneral(ch); err != nil { - logger.Error("failed collecting teradici session general metrics", - slog.Any("err", err), - ) - - return err - } - - if err := c.collectImaging(ch); err != nil { - logger.Error("failed collecting teradici session imaging metrics", - slog.Any("err", err), - ) - - return err - } - - if err := c.collectNetwork(ch); err != nil { - logger.Error("failed collecting teradici session network metrics", - slog.Any("err", err), - ) - - return err - } - - if err := c.collectUsb(ch); err != nil { - logger.Error("failed collecting teradici session USB metrics", - slog.Any("err", err), - ) - - return err - } - - return nil -} - -type win32_PerfRawData_TeradiciPerf_PCoIPSessionAudioStatistics struct { - AudioBytesReceived uint64 - AudioBytesSent uint64 - AudioRXBWKBitPerSec uint64 - AudioTXBWKBitPerSec uint64 - AudioTXBWLimitKBitPerSec uint64 -} - -type win32_PerfRawData_TeradiciPerf_PCoIPSessionGeneralStatistics struct { - BytesReceived uint64 - BytesSent uint64 - PacketsReceived uint64 - PacketsSent uint64 - RXPacketsLost uint64 - SessionDurationSeconds uint64 - TXPacketsLost uint64 -} - -type win32_PerfRawData_TeradiciPerf_PCoIPSessionImagingStatistics struct { - ImagingActiveMinimumQuality uint32 - ImagingApex2800Offload uint32 - ImagingBytesReceived uint64 - ImagingBytesSent uint64 - ImagingDecoderCapabilityKBitPerSec uint32 - ImagingEncodedFramesPerSec uint32 - ImagingMegapixelPerSec uint32 - ImagingNegativeAcknowledgements uint32 - ImagingRXBWKBitPerSec uint64 - ImagingSVGAdevTapframesPerSec uint32 - ImagingTXBWKBitPerSec uint64 -} - -type win32_PerfRawData_TeradiciPerf_PCoIPSessionNetworkStatistics struct { - RoundTripLatencyms uint32 - RXBWKBitPerSec uint64 - RXBWPeakKBitPerSec uint32 - RXPacketLossPercent uint32 - RXPacketLossPercentBase uint32 - TXBWActiveLimitKBitPerSec uint32 - TXBWKBitPerSec uint64 - TXBWLimitKBitPerSec uint32 - TXPacketLossPercent uint32 - TXPacketLossPercentBase uint32 -} - -type win32_PerfRawData_TeradiciPerf_PCoIPSessionUsbStatistics struct { - USBBytesReceived uint64 - USBBytesSent uint64 - USBRXBWKBitPerSec uint64 - USBTXBWKBitPerSec uint64 -} - -func (c *Collector) collectAudio(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_TeradiciPerf_PCoIPSessionAudioStatistics - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_TeradiciPerf_PCoIPSessionAudioStatistics", &dst); err != nil { - return err - } - - if len(dst) == 0 { - return errors.New("WMI query returned empty result set") - } - - ch <- prometheus.MustNewConstMetric( - c.audioBytesReceived, - prometheus.CounterValue, - float64(dst[0].AudioBytesReceived), - ) - - ch <- prometheus.MustNewConstMetric( - c.audioBytesSent, - prometheus.CounterValue, - float64(dst[0].AudioBytesSent), - ) - - ch <- prometheus.MustNewConstMetric( - c.audioRXBWKBitPerSec, - prometheus.GaugeValue, - float64(dst[0].AudioRXBWKBitPerSec), - ) - - ch <- prometheus.MustNewConstMetric( - c.audioTXBWKBitPerSec, - prometheus.GaugeValue, - float64(dst[0].AudioTXBWKBitPerSec), - ) - - ch <- prometheus.MustNewConstMetric( - c.audioTXBWLimitKBitPerSec, - prometheus.GaugeValue, - float64(dst[0].AudioTXBWLimitKBitPerSec), - ) - - return nil -} - -func (c *Collector) collectGeneral(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_TeradiciPerf_PCoIPSessionGeneralStatistics - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_TeradiciPerf_PCoIPSessionGeneralStatistics", &dst); err != nil { - return err - } - - if len(dst) == 0 { - return errors.New("WMI query returned empty result set") - } - - ch <- prometheus.MustNewConstMetric( - c.bytesReceived, - prometheus.CounterValue, - float64(dst[0].BytesReceived), - ) - - ch <- prometheus.MustNewConstMetric( - c.bytesSent, - prometheus.CounterValue, - float64(dst[0].BytesSent), - ) - - ch <- prometheus.MustNewConstMetric( - c.packetsReceived, - prometheus.CounterValue, - float64(dst[0].PacketsReceived), - ) - - ch <- prometheus.MustNewConstMetric( - c.packetsSent, - prometheus.CounterValue, - float64(dst[0].PacketsSent), - ) - - ch <- prometheus.MustNewConstMetric( - c.rxPacketsLost, - prometheus.CounterValue, - float64(dst[0].RXPacketsLost), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionDurationSeconds, - prometheus.CounterValue, - float64(dst[0].SessionDurationSeconds), - ) - - ch <- prometheus.MustNewConstMetric( - c.txPacketsLost, - prometheus.CounterValue, - float64(dst[0].TXPacketsLost), - ) - - return nil -} - -func (c *Collector) collectImaging(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_TeradiciPerf_PCoIPSessionImagingStatistics - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_TeradiciPerf_PCoIPSessionImagingStatistics", &dst); err != nil { - return err - } - - if len(dst) == 0 { - return errors.New("WMI query returned empty result set") - } - - ch <- prometheus.MustNewConstMetric( - c.imagingActiveMinimumQuality, - prometheus.GaugeValue, - float64(dst[0].ImagingActiveMinimumQuality), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingApex2800Offload, - prometheus.GaugeValue, - float64(dst[0].ImagingApex2800Offload), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingBytesReceived, - prometheus.CounterValue, - float64(dst[0].ImagingBytesReceived), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingBytesSent, - prometheus.CounterValue, - float64(dst[0].ImagingBytesSent), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingDecoderCapabilityKBitPerSec, - prometheus.GaugeValue, - float64(dst[0].ImagingDecoderCapabilityKBitPerSec), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingEncodedFramesPerSec, - prometheus.GaugeValue, - float64(dst[0].ImagingEncodedFramesPerSec), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingMegapixelPerSec, - prometheus.GaugeValue, - float64(dst[0].ImagingMegapixelPerSec), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingNegativeAcknowledgements, - prometheus.CounterValue, - float64(dst[0].ImagingNegativeAcknowledgements), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingRXBWKBitPerSec, - prometheus.GaugeValue, - float64(dst[0].ImagingRXBWKBitPerSec), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingSVGAdevTapframesPerSec, - prometheus.GaugeValue, - float64(dst[0].ImagingSVGAdevTapframesPerSec), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingTXBWKBitPerSec, - prometheus.GaugeValue, - float64(dst[0].ImagingTXBWKBitPerSec), - ) - - return nil -} - -func (c *Collector) collectNetwork(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_TeradiciPerf_PCoIPSessionNetworkStatistics - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_TeradiciPerf_PCoIPSessionNetworkStatistics", &dst); err != nil { - return err - } - - if len(dst) == 0 { - return errors.New("WMI query returned empty result set") - } - - ch <- prometheus.MustNewConstMetric( - c.RoundTripLatencyms, - prometheus.GaugeValue, - float64(dst[0].RoundTripLatencyms), - ) - - ch <- prometheus.MustNewConstMetric( - c.rxBWKBitPerSec, - prometheus.GaugeValue, - float64(dst[0].RXBWKBitPerSec), - ) - - ch <- prometheus.MustNewConstMetric( - c.rxBWPeakKBitPerSec, - prometheus.GaugeValue, - float64(dst[0].RXBWPeakKBitPerSec), - ) - - ch <- prometheus.MustNewConstMetric( - c.rxPacketLossPercent, - prometheus.GaugeValue, - float64(dst[0].RXPacketLossPercent), - ) - - ch <- prometheus.MustNewConstMetric( - c.rxPacketLossPercentBase, - prometheus.GaugeValue, - float64(dst[0].RXPacketLossPercentBase), - ) - - ch <- prometheus.MustNewConstMetric( - c.txBWActiveLimitKBitPerSec, - prometheus.GaugeValue, - float64(dst[0].TXBWActiveLimitKBitPerSec), - ) - - ch <- prometheus.MustNewConstMetric( - c.txBWKBitPerSec, - prometheus.GaugeValue, - float64(dst[0].TXBWKBitPerSec), - ) - - ch <- prometheus.MustNewConstMetric( - c.txBWLimitKBitPerSec, - prometheus.GaugeValue, - float64(dst[0].TXBWLimitKBitPerSec), - ) - - ch <- prometheus.MustNewConstMetric( - c.txPacketLossPercent, - prometheus.GaugeValue, - float64(dst[0].TXPacketLossPercent), - ) - - ch <- prometheus.MustNewConstMetric( - c.txPacketLossPercentBase, - prometheus.GaugeValue, - float64(dst[0].TXPacketLossPercentBase), - ) - - return nil -} - -func (c *Collector) collectUsb(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_TeradiciPerf_PCoIPSessionUsbStatistics - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_TeradiciPerf_PCoIPSessionUsbStatistics", &dst); err != nil { - return err - } - - if len(dst) == 0 { - return errors.New("WMI query returned empty result set") - } - - ch <- prometheus.MustNewConstMetric( - c.usbBytesReceived, - prometheus.CounterValue, - float64(dst[0].USBBytesReceived), - ) - - ch <- prometheus.MustNewConstMetric( - c.usbBytesSent, - prometheus.CounterValue, - float64(dst[0].USBBytesSent), - ) - - ch <- prometheus.MustNewConstMetric( - c.usbRXBWKBitPerSec, - prometheus.GaugeValue, - float64(dst[0].USBRXBWKBitPerSec), - ) - - ch <- prometheus.MustNewConstMetric( - c.usbTXBWKBitPerSec, - prometheus.GaugeValue, - float64(dst[0].USBTXBWKBitPerSec), - ) - - return nil -} diff --git a/internal/collector/teradici_pcoip/teradici_pcoip_test.go b/internal/collector/teradici_pcoip/teradici_pcoip_test.go deleted file mode 100644 index 4121587d..00000000 --- a/internal/collector/teradici_pcoip/teradici_pcoip_test.go +++ /dev/null @@ -1,12 +0,0 @@ -package teradici_pcoip_test - -import ( - "testing" - - "github.com/prometheus-community/windows_exporter/internal/collector/teradici_pcoip" - "github.com/prometheus-community/windows_exporter/internal/testutils" -) - -func BenchmarkCollector(b *testing.B) { - testutils.FuncBenchmarkCollector(b, teradici_pcoip.Name, teradici_pcoip.NewWithFlags) -} diff --git a/internal/collector/vmware_blast/vmware_blast.go b/internal/collector/vmware_blast/vmware_blast.go deleted file mode 100644 index 8e8813d6..00000000 --- a/internal/collector/vmware_blast/vmware_blast.go +++ /dev/null @@ -1,1377 +0,0 @@ -//go:build windows - -package vmware_blast - -import ( - "errors" - "log/slog" - - "github.com/alecthomas/kingpin/v2" - "github.com/prometheus-community/windows_exporter/internal/types" - "github.com/prometheus/client_golang/prometheus" - "github.com/yusufpapurcu/wmi" -) - -const Name = "vmware_blast" - -type Config struct{} - -var ConfigDefaults = Config{} - -// A collector is a Prometheus collector for WMI metrics: -// win32_PerfRawData_Counters_VMwareBlastAudioCounters -// win32_PerfRawData_Counters_VMwareBlastCDRCounters -// win32_PerfRawData_Counters_VMwareBlastClipboardCounters -// win32_PerfRawData_Counters_VMwareBlastHTML5MMRCounters -// win32_PerfRawData_Counters_VMwareBlastImagingCounters -// win32_PerfRawData_Counters_VMwareBlastRTAVCounters -// win32_PerfRawData_Counters_VMwareBlastSerialPortandScannerCounters -// win32_PerfRawData_Counters_VMwareBlastSessionCounters -// win32_PerfRawData_Counters_VMwareBlastSkypeforBusinessControlCounters -// win32_PerfRawData_Counters_VMwareBlastThinPrintCounters -// win32_PerfRawData_Counters_VMwareBlastUSBCounters -// win32_PerfRawData_Counters_VMwareBlastWindowsMediaMMRCounters - -type Collector struct { - config Config - wmiClient *wmi.Client - - audioReceivedBytes *prometheus.Desc - audioReceivedPackets *prometheus.Desc - audioTransmittedBytes *prometheus.Desc - audioTransmittedPackets *prometheus.Desc - - cdrReceivedBytes *prometheus.Desc - cdrReceivedPackets *prometheus.Desc - cdrTransmittedBytes *prometheus.Desc - cdrTransmittedPackets *prometheus.Desc - - clipboardReceivedBytes *prometheus.Desc - clipboardReceivedPackets *prometheus.Desc - clipboardTransmittedBytes *prometheus.Desc - clipboardTransmittedPackets *prometheus.Desc - - html5MMRReceivedBytes *prometheus.Desc - html5MMRReceivedPackets *prometheus.Desc - html5MMRTransmittedBytes *prometheus.Desc - html5MMRTransmittedPackets *prometheus.Desc - - imagingDirtyFramesPerSecond *prometheus.Desc - imagingFBCRate *prometheus.Desc - imagingFramesPerSecond *prometheus.Desc - imagingPollRate *prometheus.Desc - imagingReceivedBytes *prometheus.Desc - imagingReceivedPackets *prometheus.Desc - imagingTotalDirtyFrames *prometheus.Desc - imagingTotalFBC *prometheus.Desc - imagingTotalFrames *prometheus.Desc - imagingTotalPoll *prometheus.Desc - imagingTransmittedBytes *prometheus.Desc - imagingTransmittedPackets *prometheus.Desc - - rtAVReceivedBytes *prometheus.Desc - rtAVReceivedPackets *prometheus.Desc - rtAVTransmittedBytes *prometheus.Desc - rtAVTransmittedPackets *prometheus.Desc - - serialPortAndScannerReceivedBytes *prometheus.Desc - serialPortAndScannerReceivedPackets *prometheus.Desc - serialPortAndScannerTransmittedBytes *prometheus.Desc - serialPortAndScannerTransmittedPackets *prometheus.Desc - - sessionAutomaticReconnectCount *prometheus.Desc - sessionCumulativeReceivedBytesOverTCP *prometheus.Desc - sessionCumulativeReceivedBytesOverUDP *prometheus.Desc - sessionCumulativeTransmittedBytesOverTCP *prometheus.Desc - sessionCumulativeTransmittedBytesOverUDP *prometheus.Desc - sessionEstimatedBandwidthUplink *prometheus.Desc - sessionInstantaneousReceivedBytesOverTCP *prometheus.Desc - sessionInstantaneousReceivedBytesOverUDP *prometheus.Desc - sessionInstantaneousTransmittedBytesOverTCP *prometheus.Desc - sessionInstantaneousTransmittedBytesOverUDP *prometheus.Desc - sessionJitterUplink *prometheus.Desc - sessionPacketLossUplink *prometheus.Desc - sessionReceivedBytes *prometheus.Desc - sessionReceivedPackets *prometheus.Desc - sessionRTT *prometheus.Desc - sessionTransmittedBytes *prometheus.Desc - sessionTransmittedPackets *prometheus.Desc - - skypeForBusinessControlReceivedBytes *prometheus.Desc - skypeForBusinessControlReceivedPackets *prometheus.Desc - skypeForBusinessControlTransmittedBytes *prometheus.Desc - skypeForBusinessControlTransmittedPackets *prometheus.Desc - - thinPrintReceivedBytes *prometheus.Desc - thinPrintReceivedPackets *prometheus.Desc - thinPrintTransmittedBytes *prometheus.Desc - thinPrintTransmittedPackets *prometheus.Desc - - usbReceivedBytes *prometheus.Desc - usbReceivedPackets *prometheus.Desc - usbTransmittedBytes *prometheus.Desc - usbTransmittedPackets *prometheus.Desc - - windowsMediaMMRReceivedBytes *prometheus.Desc - windowsMediaMMRReceivedPackets *prometheus.Desc - windowsMediaMMRTransmittedBytes *prometheus.Desc - windowsMediaMMRTransmittedPackets *prometheus.Desc -} - -func New(config *Config) *Collector { - if config == nil { - config = &ConfigDefaults - } - - c := &Collector{ - config: *config, - } - - return c -} - -func NewWithFlags(_ *kingpin.Application) *Collector { - return &Collector{} -} - -func (c *Collector) GetName() string { - return Name -} - -func (c *Collector) GetPerfCounter(_ *slog.Logger) ([]string, error) { - return []string{}, nil -} - -func (c *Collector) Close(_ *slog.Logger) error { - return nil -} - -func (c *Collector) Build(logger *slog.Logger, wmiClient *wmi.Client) error { - logger.Warn("vmware_blast collector is deprecated and will be removed in the future.", - slog.String("collector", Name), - ) - - if wmiClient == nil || wmiClient.SWbemServicesClient == nil { - return errors.New("wmiClient or SWbemServicesClient is nil") - } - - c.wmiClient = wmiClient - - c.audioReceivedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "audio_received_bytes_total"), - "(AudioReceivedBytes)", - nil, - nil, - ) - c.audioReceivedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "audio_received_packets_total"), - "(AudioReceivedPackets)", - nil, - nil, - ) - c.audioTransmittedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "audio_transmitted_bytes_total"), - "(AudioTransmittedBytes)", - nil, - nil, - ) - c.audioTransmittedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "audio_transmitted_packets_total"), - "(AudioTransmittedPackets)", - nil, - nil, - ) - - c.cdrReceivedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "cdr_received_bytes_total"), - "(CDRReceivedBytes)", - nil, - nil, - ) - c.cdrReceivedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "cdr_received_packets_total"), - "(CDRReceivedPackets)", - nil, - nil, - ) - c.cdrTransmittedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "cdr_transmitted_bytes_total"), - "(CDRTransmittedBytes)", - nil, - nil, - ) - c.cdrTransmittedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "cdr_transmitted_packets_total"), - "(CDRTransmittedPackets)", - nil, - nil, - ) - - c.clipboardReceivedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "clipboard_received_bytes_total"), - "(ClipboardReceivedBytes)", - nil, - nil, - ) - c.clipboardReceivedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "clipboard_received_packets_total"), - "(ClipboardReceivedPackets)", - nil, - nil, - ) - c.clipboardTransmittedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "clipboard_transmitted_bytes_total"), - "(ClipboardTransmittedBytes)", - nil, - nil, - ) - c.clipboardTransmittedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "clipboard_transmitted_packets_total"), - "(ClipboardTransmittedPackets)", - nil, - nil, - ) - - c.html5MMRReceivedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "html5_mmr_received_bytes_total"), - "(HTML5MMRReceivedBytes)", - nil, - nil, - ) - c.html5MMRReceivedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "html5_mmr_received_packets_total"), - "(HTML5MMRReceivedPackets)", - nil, - nil, - ) - c.html5MMRTransmittedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "html5_mmr_transmitted_bytes_total"), - "(HTML5MMRTransmittedBytes)", - nil, - nil, - ) - c.html5MMRTransmittedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "html5_mmr_transmitted_packets_total"), - "(HTML5MMRTransmittedPackets)", - nil, - nil, - ) - - c.imagingDirtyFramesPerSecond = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_dirty_frames_per_second"), - "(ImagingDirtyFramesPerSecond)", - nil, - nil, - ) - c.imagingFBCRate = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_fbc_rate"), - "(ImagingFBCRate)", - nil, - nil, - ) - c.imagingFramesPerSecond = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_frames_per_second"), - "(ImagingFramesPerSecond)", - nil, - nil, - ) - c.imagingPollRate = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_poll_rate"), - "(ImagingPollRate)", - nil, - nil, - ) - c.imagingReceivedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_received_bytes_total"), - "(ImagingReceivedBytes)", - nil, - nil, - ) - c.imagingReceivedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_received_packets_total"), - "(ImagingReceivedPackets)", - nil, - nil, - ) - c.imagingTotalDirtyFrames = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_total_dirty_frames_total"), - "(ImagingTotalDirtyFrames)", - nil, - nil, - ) - c.imagingTotalFBC = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_fbc_total"), - "(ImagingTotalFBC)", - nil, - nil, - ) - c.imagingTotalFrames = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_frames_total"), - "(ImagingTotalFrames)", - nil, - nil, - ) - c.imagingTotalPoll = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_poll_total"), - "(ImagingTotalPoll)", - nil, - nil, - ) - c.imagingTransmittedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_transmitted_bytes_total"), - "(ImagingTransmittedBytes)", - nil, - nil, - ) - c.imagingTransmittedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "imaging_transmitted_packets_total"), - "(ImagingTransmittedPackets)", - nil, - nil, - ) - - c.rtAVReceivedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "rtav_received_bytes_total"), - "(RTAVReceivedBytes)", - nil, - nil, - ) - c.rtAVReceivedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "rtav_received_packets_total"), - "(RTAVReceivedPackets)", - nil, - nil, - ) - c.rtAVTransmittedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "rtav_transmitted_bytes_total"), - "(RTAVTransmittedBytes)", - nil, - nil, - ) - c.rtAVTransmittedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "rtav_transmitted_packets_total"), - "(RTAVTransmittedPackets)", - nil, - nil, - ) - - c.serialPortAndScannerReceivedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "serial_port_and_scanner_received_bytes_total"), - "(SerialPortandScannerReceivedBytes)", - nil, - nil, - ) - c.serialPortAndScannerReceivedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "serial_port_and_scanner_received_packets_total"), - "(SerialPortandScannerReceivedPackets)", - nil, - nil, - ) - c.serialPortAndScannerTransmittedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "serial_port_and_scanner_transmitted_bytes_total"), - "(SerialPortandScannerTransmittedBytes)", - nil, - nil, - ) - c.serialPortAndScannerTransmittedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "serial_port_and_scanner_transmitted_packets_total"), - "(SerialPortandScannerTransmittedPackets)", - nil, - nil, - ) - - c.sessionAutomaticReconnectCount = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_automatic_reconnect_count_total"), - "(SessionAutomaticReconnectCount)", - nil, - nil, - ) - c.sessionCumulativeReceivedBytesOverTCP = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_cumlative_received_bytes_over_tcp_total"), - "(SessionCumulativeReceivedBytesOverTCP)", - nil, - nil, - ) - c.sessionCumulativeReceivedBytesOverUDP = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_cumlative_received_bytes_over_udp_total"), - "(SessionCumulativeReceivedBytesOverUDP)", - nil, - nil, - ) - c.sessionCumulativeTransmittedBytesOverTCP = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_cumlative_transmitted_bytes_over_tcp_total"), - "(SessionCumulativeTransmittedBytesOverTCP)", - nil, - nil, - ) - c.sessionCumulativeTransmittedBytesOverUDP = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_cumlative_transmitted_bytes_over_udp_total"), - "(SessionCumulativeTransmittedBytesOverUDP)", - nil, - nil, - ) - c.sessionEstimatedBandwidthUplink = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_estimated_bandwidth_uplink"), - "(SessionEstimatedBandwidthUplink)", - nil, - nil, - ) - c.sessionInstantaneousReceivedBytesOverTCP = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_instantaneous_received_bytes_over_tcp_total"), - "(SessionInstantaneousReceivedBytesOverTCP)", - nil, - nil, - ) - c.sessionInstantaneousReceivedBytesOverUDP = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_instantaneous_received_bytes_over_udp_total"), - "(SessionInstantaneousReceivedBytesOverUDP)", - nil, - nil, - ) - c.sessionInstantaneousTransmittedBytesOverTCP = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_instantaneous_transmitted_bytes_over_tcp_total"), - "(SessionInstantaneousTransmittedBytesOverTCP)", - nil, - nil, - ) - c.sessionInstantaneousTransmittedBytesOverUDP = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_instantaneous_transmitted_bytes_over_udp_total"), - "(SessionInstantaneousTransmittedBytesOverUDP)", - nil, - nil, - ) - c.sessionJitterUplink = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_jitter_uplink"), - "(SessionJitterUplink)", - nil, - nil, - ) - c.sessionPacketLossUplink = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_packet_loss_uplink"), - "(SessionPacketLossUplink)", - nil, - nil, - ) - c.sessionReceivedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_received_bytes_total"), - "(SessionReceivedBytes)", - nil, - nil, - ) - c.sessionReceivedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_received_packets_total"), - "(SessionReceivedPackets)", - nil, - nil, - ) - c.sessionRTT = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_rtt"), - "(SessionRTT)", - nil, - nil, - ) - c.sessionTransmittedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_transmitted_bytes_total"), - "(SessionTransmittedBytes)", - nil, - nil, - ) - c.sessionTransmittedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "session_transmitted_packets_total"), - "(SessionTransmittedPackets)", - nil, - nil, - ) - - c.skypeForBusinessControlReceivedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "skype_for_business_control_received_bytes_total"), - "(SkypeforBusinessControlReceivedBytes)", - nil, - nil, - ) - c.skypeForBusinessControlReceivedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "skype_for_business_control_received_packets_total"), - "(SkypeforBusinessControlReceivedPackets)", - nil, - nil, - ) - c.skypeForBusinessControlTransmittedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "skype_for_business_control_transmitted_bytes_total"), - "(SkypeforBusinessControlTransmittedBytes)", - nil, - nil, - ) - c.skypeForBusinessControlTransmittedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "skype_for_business_control_transmitted_packets_total"), - "(SkypeforBusinessControlTransmittedPackets)", - nil, - nil, - ) - - c.thinPrintReceivedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "thinprint_received_bytes_total"), - "(ThinPrintReceivedBytes)", - nil, - nil, - ) - c.thinPrintReceivedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "thinprint_received_packets_total"), - "(ThinPrintReceivedPackets)", - nil, - nil, - ) - c.thinPrintTransmittedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "thinprint_transmitted_bytes_total"), - "(ThinPrintTransmittedBytes)", - nil, - nil, - ) - c.thinPrintTransmittedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "thinprint_transmitted_packets_total"), - "(ThinPrintTransmittedPackets)", - nil, - nil, - ) - - c.usbReceivedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "usb_received_bytes_total"), - "(USBReceivedBytes)", - nil, - nil, - ) - c.usbReceivedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "usb_received_packets_total"), - "(USBReceivedPackets)", - nil, - nil, - ) - c.usbTransmittedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "usb_transmitted_bytes_total"), - "(USBTransmittedBytes)", - nil, - nil, - ) - c.usbTransmittedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "usb_transmitted_packets_total"), - "(USBTransmittedPackets)", - nil, - nil, - ) - - c.windowsMediaMMRReceivedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "windows_media_mmr_received_bytes_total"), - "(WindowsMediaMMRReceivedBytes)", - nil, - nil, - ) - c.windowsMediaMMRReceivedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "windows_media_mmr_received_packets_total"), - "(WindowsMediaMMRReceivedPackets)", - nil, - nil, - ) - c.windowsMediaMMRTransmittedBytes = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "windows_media_mmr_transmitted_bytes_total"), - "(WindowsMediaMMRTransmittedBytes)", - nil, - nil, - ) - c.windowsMediaMMRTransmittedPackets = prometheus.NewDesc( - prometheus.BuildFQName(types.Namespace, Name, "windows_media_mmr_transmitted_packets_total"), - "(WindowsMediaMMRTransmittedPackets)", - nil, - nil, - ) - - return nil -} - -// Collect sends the metric values for each metric -// to the provided prometheus Metric channel. -func (c *Collector) Collect(_ *types.ScrapeContext, logger *slog.Logger, ch chan<- prometheus.Metric) error { - logger = logger.With(slog.String("collector", Name)) - if err := c.collectAudio(ch); err != nil { - logger.Error("failed collecting vmware blast audio metrics", - slog.Any("err", err), - ) - - return err - } - - if err := c.collectCdr(ch); err != nil { - logger.Error("failed collecting vmware blast CDR metrics", - slog.Any("err", err), - ) - - return err - } - - if err := c.collectClipboard(ch); err != nil { - logger.Error("failed collecting vmware blast clipboard metrics", - slog.Any("err", err), - ) - - return err - } - - if err := c.collectHtml5Mmr(ch); err != nil { - logger.Error("failed collecting vmware blast HTML5 MMR metrics", - slog.Any("err", err), - ) - - return err - } - - if err := c.collectImaging(ch); err != nil { - logger.Error("failed collecting vmware blast imaging metrics", - slog.Any("err", err), - ) - - return err - } - - if err := c.collectRtav(ch); err != nil { - logger.Error("failed collecting vmware blast RTAV metrics", - slog.Any("err", err), - ) - - return err - } - - if err := c.collectSerialPortandScanner(ch); err != nil { - logger.Error("failed collecting vmware blast serial port and scanner metrics", - slog.Any("err", err), - ) - - return err - } - - if err := c.collectSession(ch); err != nil { - logger.Error("failed collecting vmware blast metrics", - slog.Any("err", err), - ) - - return err - } - - if err := c.collectSkypeforBusinessControl(ch); err != nil { - logger.Error("failed collecting vmware blast skype for business control metrics", - slog.Any("err", err), - ) - - return err - } - - if err := c.collectThinPrint(ch); err != nil { - logger.Error("failed collecting vmware blast thin print metrics", - slog.Any("err", err), - ) - - return err - } - - if err := c.collectUsb(ch); err != nil { - logger.Error("failed collecting vmware blast USB metrics", - slog.Any("err", err), - ) - - return err - } - - if err := c.collectWindowsMediaMmr(ch); err != nil { - logger.Error("failed collecting vmware blast windows media MMR metrics", - slog.Any("err", err), - ) - - return err - } - - return nil -} - -type win32_PerfRawData_Counters_VMwareBlastAudioCounters struct { - ReceivedBytes uint32 - ReceivedPackets uint32 - TransmittedBytes uint32 - TransmittedPackets uint32 -} - -type win32_PerfRawData_Counters_VMwareBlastCDRCounters struct { - ReceivedBytes uint32 - ReceivedPackets uint32 - TransmittedBytes uint32 - TransmittedPackets uint32 -} - -type win32_PerfRawData_Counters_VMwareBlastClipboardCounters struct { - ReceivedBytes uint32 - ReceivedPackets uint32 - TransmittedBytes uint32 - TransmittedPackets uint32 -} - -type win32_PerfRawData_Counters_VMwareBlastHTML5MMRcounters struct { - ReceivedBytes uint32 - ReceivedPackets uint32 - TransmittedBytes uint32 - TransmittedPackets uint32 -} - -type win32_PerfRawData_Counters_VMwareBlastImagingCounters struct { - Dirtyframespersecond uint32 - FBCRate uint32 - Framespersecond uint32 - PollRate uint32 - ReceivedBytes uint32 - ReceivedPackets uint32 - Totaldirtyframes uint32 - TotalFBC uint32 - Totalframes uint32 - Totalpoll uint32 - TransmittedBytes uint32 - TransmittedPackets uint32 -} - -type win32_PerfRawData_Counters_VMwareBlastRTAVCounters struct { - ReceivedBytes uint32 - ReceivedPackets uint32 - TransmittedBytes uint32 - TransmittedPackets uint32 -} - -type win32_PerfRawData_Counters_VMwareBlastSerialPortandScannerCounters struct { - ReceivedBytes uint32 - ReceivedPackets uint32 - TransmittedBytes uint32 - TransmittedPackets uint32 -} - -type win32_PerfRawData_Counters_VMwareBlastSessionCounters struct { - AutomaticReconnectCount uint32 - CumulativeReceivedBytesoverTCP uint32 - CumulativeReceivedBytesoverUDP uint32 - CumulativeTransmittedBytesoverTCP uint32 - CumulativeTransmittedBytesoverUDP uint32 - EstimatedBandwidthUplink uint32 - InstantaneousReceivedBytesoverTCP uint32 - InstantaneousReceivedBytesoverUDP uint32 - InstantaneousTransmittedBytesoverTCP uint32 - InstantaneousTransmittedBytesoverUDP uint32 - JitterUplink uint32 - PacketLossUplink uint32 - ReceivedBytes uint32 - ReceivedPackets uint32 - RTT uint32 - TransmittedBytes uint32 - TransmittedPackets uint32 -} - -type win32_PerfRawData_Counters_VMwareBlastSkypeforBusinessControlCounters struct { - ReceivedBytes uint32 - ReceivedPackets uint32 - TransmittedBytes uint32 - TransmittedPackets uint32 -} - -type win32_PerfRawData_Counters_VMwareBlastThinPrintCounters struct { - ReceivedBytes uint32 - ReceivedPackets uint32 - TransmittedBytes uint32 - TransmittedPackets uint32 -} - -type win32_PerfRawData_Counters_VMwareBlastUSBCounters struct { - ReceivedBytes uint32 - ReceivedPackets uint32 - TransmittedBytes uint32 - TransmittedPackets uint32 -} - -type win32_PerfRawData_Counters_VMwareBlastWindowsMediaMMRCounters struct { - ReceivedBytes uint32 - ReceivedPackets uint32 - TransmittedBytes uint32 - TransmittedPackets uint32 -} - -func (c *Collector) collectAudio(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_Counters_VMwareBlastAudioCounters - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_Counters_VMwareBlastAudioCounters", &dst); err != nil { - return err - } - - if len(dst) == 0 { - // It's possible for these classes to legitimately return null when queried - return nil - } - - ch <- prometheus.MustNewConstMetric( - c.audioReceivedBytes, - prometheus.CounterValue, - float64(dst[0].ReceivedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.audioReceivedPackets, - prometheus.CounterValue, - float64(dst[0].ReceivedPackets), - ) - - ch <- prometheus.MustNewConstMetric( - c.audioTransmittedBytes, - prometheus.CounterValue, - float64(dst[0].TransmittedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.audioTransmittedPackets, - prometheus.CounterValue, - float64(dst[0].TransmittedPackets), - ) - - return nil -} - -func (c *Collector) collectCdr(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_Counters_VMwareBlastCDRCounters - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_Counters_VMwareBlastCDRCounters", &dst); err != nil { - return err - } - - if len(dst) == 0 { - // It's possible for these classes to legitimately return null when queried - return nil - } - - ch <- prometheus.MustNewConstMetric( - c.cdrReceivedBytes, - prometheus.CounterValue, - float64(dst[0].ReceivedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.cdrReceivedPackets, - prometheus.CounterValue, - float64(dst[0].ReceivedPackets), - ) - - ch <- prometheus.MustNewConstMetric( - c.cdrTransmittedBytes, - prometheus.CounterValue, - float64(dst[0].TransmittedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.cdrTransmittedPackets, - prometheus.CounterValue, - float64(dst[0].TransmittedPackets), - ) - - return nil -} - -func (c *Collector) collectClipboard(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_Counters_VMwareBlastClipboardCounters - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_Counters_VMwareBlastClipboardCounters", &dst); err != nil { - return err - } - - if len(dst) == 0 { - // It's possible for these classes to legitimately return null when queried - return nil - } - - ch <- prometheus.MustNewConstMetric( - c.clipboardReceivedBytes, - prometheus.CounterValue, - float64(dst[0].ReceivedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.clipboardReceivedPackets, - prometheus.CounterValue, - float64(dst[0].ReceivedPackets), - ) - - ch <- prometheus.MustNewConstMetric( - c.clipboardTransmittedBytes, - prometheus.CounterValue, - float64(dst[0].TransmittedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.clipboardTransmittedPackets, - prometheus.CounterValue, - float64(dst[0].TransmittedPackets), - ) - - return nil -} - -func (c *Collector) collectHtml5Mmr(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_Counters_VMwareBlastHTML5MMRcounters - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_Counters_VMwareBlastHTML5MMRcounters", &dst); err != nil { - return err - } - - if len(dst) == 0 { - // It's possible for these classes to legitimately return null when queried - return nil - } - - ch <- prometheus.MustNewConstMetric( - c.html5MMRReceivedBytes, - prometheus.CounterValue, - float64(dst[0].ReceivedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.html5MMRReceivedPackets, - prometheus.CounterValue, - float64(dst[0].ReceivedPackets), - ) - - ch <- prometheus.MustNewConstMetric( - c.html5MMRTransmittedBytes, - prometheus.CounterValue, - float64(dst[0].TransmittedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.html5MMRTransmittedPackets, - prometheus.CounterValue, - float64(dst[0].TransmittedPackets), - ) - - return nil -} - -func (c *Collector) collectImaging(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_Counters_VMwareBlastImagingCounters - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_Counters_VMwareBlastImagingCounters", &dst); err != nil { - return err - } - - if len(dst) == 0 { - // It's possible for these classes to legitimately return null when queried - return nil - } - - ch <- prometheus.MustNewConstMetric( - c.imagingDirtyFramesPerSecond, - prometheus.GaugeValue, - float64(dst[0].Dirtyframespersecond), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingFBCRate, - prometheus.GaugeValue, - float64(dst[0].FBCRate), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingFramesPerSecond, - prometheus.GaugeValue, - float64(dst[0].Framespersecond), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingPollRate, - prometheus.GaugeValue, - float64(dst[0].PollRate), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingReceivedBytes, - prometheus.CounterValue, - float64(dst[0].ReceivedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingReceivedPackets, - prometheus.CounterValue, - float64(dst[0].ReceivedPackets), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingTotalDirtyFrames, - prometheus.CounterValue, - float64(dst[0].Totaldirtyframes), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingTotalFBC, - prometheus.CounterValue, - float64(dst[0].TotalFBC), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingTotalFrames, - prometheus.CounterValue, - float64(dst[0].Totalframes), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingTotalPoll, - prometheus.CounterValue, - float64(dst[0].Totalpoll), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingTransmittedBytes, - prometheus.CounterValue, - float64(dst[0].TransmittedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.imagingTransmittedPackets, - prometheus.CounterValue, - float64(dst[0].TransmittedPackets), - ) - - return nil -} - -func (c *Collector) collectRtav(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_Counters_VMwareBlastRTAVCounters - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_Counters_VMwareBlastRTAVCounters", &dst); err != nil { - return err - } - - if len(dst) == 0 { - // It's possible for these classes to legitimately return null when queried - return nil - } - - ch <- prometheus.MustNewConstMetric( - c.rtAVReceivedBytes, - prometheus.CounterValue, - float64(dst[0].ReceivedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.rtAVReceivedPackets, - prometheus.CounterValue, - float64(dst[0].ReceivedPackets), - ) - - ch <- prometheus.MustNewConstMetric( - c.rtAVTransmittedBytes, - prometheus.CounterValue, - float64(dst[0].TransmittedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.rtAVTransmittedPackets, - prometheus.CounterValue, - float64(dst[0].TransmittedPackets), - ) - - return nil -} - -func (c *Collector) collectSerialPortandScanner(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_Counters_VMwareBlastSerialPortandScannerCounters - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_Counters_VMwareBlastSerialPortandScannerCounters", &dst); err != nil { - return err - } - - if len(dst) == 0 { - // It's possible for these classes to legitimately return null when queried - return nil - } - - ch <- prometheus.MustNewConstMetric( - c.serialPortAndScannerReceivedBytes, - prometheus.CounterValue, - float64(dst[0].ReceivedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.serialPortAndScannerReceivedPackets, - prometheus.CounterValue, - float64(dst[0].ReceivedPackets), - ) - - ch <- prometheus.MustNewConstMetric( - c.serialPortAndScannerTransmittedBytes, - prometheus.CounterValue, - float64(dst[0].TransmittedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.serialPortAndScannerTransmittedPackets, - prometheus.CounterValue, - float64(dst[0].TransmittedPackets), - ) - - return nil -} - -func (c *Collector) collectSession(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_Counters_VMwareBlastSessionCounters - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_Counters_VMwareBlastSessionCounters", &dst); err != nil { - return err - } - - if len(dst) == 0 { - // It's possible for these classes to legitimately return null when queried - return nil - } - - ch <- prometheus.MustNewConstMetric( - c.sessionAutomaticReconnectCount, - prometheus.CounterValue, - float64(dst[0].AutomaticReconnectCount), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionCumulativeReceivedBytesOverTCP, - prometheus.CounterValue, - float64(dst[0].CumulativeReceivedBytesoverTCP), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionCumulativeReceivedBytesOverUDP, - prometheus.CounterValue, - float64(dst[0].CumulativeReceivedBytesoverUDP), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionCumulativeTransmittedBytesOverTCP, - prometheus.CounterValue, - float64(dst[0].CumulativeTransmittedBytesoverTCP), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionCumulativeTransmittedBytesOverUDP, - prometheus.CounterValue, - float64(dst[0].CumulativeTransmittedBytesoverUDP), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionEstimatedBandwidthUplink, - prometheus.GaugeValue, - float64(dst[0].EstimatedBandwidthUplink), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionInstantaneousReceivedBytesOverTCP, - prometheus.CounterValue, - float64(dst[0].InstantaneousReceivedBytesoverTCP), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionInstantaneousReceivedBytesOverUDP, - prometheus.CounterValue, - float64(dst[0].InstantaneousReceivedBytesoverUDP), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionInstantaneousTransmittedBytesOverTCP, - prometheus.CounterValue, - float64(dst[0].InstantaneousTransmittedBytesoverTCP), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionInstantaneousTransmittedBytesOverUDP, - prometheus.CounterValue, - float64(dst[0].InstantaneousTransmittedBytesoverUDP), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionJitterUplink, - prometheus.GaugeValue, - float64(dst[0].JitterUplink), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionPacketLossUplink, - prometheus.GaugeValue, - float64(dst[0].PacketLossUplink), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionReceivedBytes, - prometheus.CounterValue, - float64(dst[0].ReceivedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionReceivedPackets, - prometheus.CounterValue, - float64(dst[0].ReceivedPackets), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionRTT, - prometheus.GaugeValue, - float64(dst[0].RTT), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionTransmittedBytes, - prometheus.CounterValue, - float64(dst[0].TransmittedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.sessionTransmittedPackets, - prometheus.CounterValue, - float64(dst[0].TransmittedPackets), - ) - - return nil -} - -func (c *Collector) collectSkypeforBusinessControl(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_Counters_VMwareBlastSkypeforBusinessControlCounters - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_Counters_VMwareBlastSkypeforBusinessControlCounters", &dst); err != nil { - return err - } - - if len(dst) == 0 { - // It's possible for these classes to legitimately return null when queried - return nil - } - - ch <- prometheus.MustNewConstMetric( - c.skypeForBusinessControlReceivedBytes, - prometheus.CounterValue, - float64(dst[0].ReceivedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.skypeForBusinessControlReceivedPackets, - prometheus.CounterValue, - float64(dst[0].ReceivedPackets), - ) - - ch <- prometheus.MustNewConstMetric( - c.skypeForBusinessControlTransmittedBytes, - prometheus.CounterValue, - float64(dst[0].TransmittedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.skypeForBusinessControlTransmittedPackets, - prometheus.CounterValue, - float64(dst[0].TransmittedPackets), - ) - - return nil -} - -func (c *Collector) collectThinPrint(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_Counters_VMwareBlastThinPrintCounters - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_Counters_VMwareBlastThinPrintCounters", &dst); err != nil { - return err - } - - if len(dst) == 0 { - // It's possible for these classes to legitimately return null when queried - return nil - } - - ch <- prometheus.MustNewConstMetric( - c.thinPrintReceivedBytes, - prometheus.CounterValue, - float64(dst[0].ReceivedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.thinPrintReceivedPackets, - prometheus.CounterValue, - float64(dst[0].ReceivedPackets), - ) - - ch <- prometheus.MustNewConstMetric( - c.thinPrintTransmittedBytes, - prometheus.CounterValue, - float64(dst[0].TransmittedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.thinPrintTransmittedPackets, - prometheus.CounterValue, - float64(dst[0].TransmittedPackets), - ) - - return nil -} - -func (c *Collector) collectUsb(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_Counters_VMwareBlastUSBCounters - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_Counters_VMwareBlastUSBCounters", &dst); err != nil { - return err - } - - if len(dst) == 0 { - // It's possible for these classes to legitimately return null when queried - return nil - } - - ch <- prometheus.MustNewConstMetric( - c.usbReceivedBytes, - prometheus.CounterValue, - float64(dst[0].ReceivedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.usbReceivedPackets, - prometheus.CounterValue, - float64(dst[0].ReceivedPackets), - ) - - ch <- prometheus.MustNewConstMetric( - c.usbTransmittedBytes, - prometheus.CounterValue, - float64(dst[0].TransmittedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.usbTransmittedPackets, - prometheus.CounterValue, - float64(dst[0].TransmittedPackets), - ) - - return nil -} - -func (c *Collector) collectWindowsMediaMmr(ch chan<- prometheus.Metric) error { - var dst []win32_PerfRawData_Counters_VMwareBlastWindowsMediaMMRCounters - if err := c.wmiClient.Query("SELECT * FROM win32_PerfRawData_Counters_VMwareBlastWindowsMediaMMRCounters", &dst); err != nil { - return err - } - - if len(dst) == 0 { - // It's possible for these classes to legitimately return null when queried - return nil - } - - ch <- prometheus.MustNewConstMetric( - c.windowsMediaMMRReceivedBytes, - prometheus.CounterValue, - float64(dst[0].ReceivedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.windowsMediaMMRReceivedPackets, - prometheus.CounterValue, - float64(dst[0].ReceivedPackets), - ) - - ch <- prometheus.MustNewConstMetric( - c.windowsMediaMMRTransmittedBytes, - prometheus.CounterValue, - float64(dst[0].TransmittedBytes), - ) - - ch <- prometheus.MustNewConstMetric( - c.windowsMediaMMRTransmittedPackets, - prometheus.CounterValue, - float64(dst[0].TransmittedPackets), - ) - - return nil -} diff --git a/internal/collector/vmware_blast/vmware_blast_test.go b/internal/collector/vmware_blast/vmware_blast_test.go deleted file mode 100644 index 272a0440..00000000 --- a/internal/collector/vmware_blast/vmware_blast_test.go +++ /dev/null @@ -1,12 +0,0 @@ -package vmware_blast_test - -import ( - "testing" - - "github.com/prometheus-community/windows_exporter/internal/collector/vmware_blast" - "github.com/prometheus-community/windows_exporter/internal/testutils" -) - -func BenchmarkCollector(b *testing.B) { - testutils.FuncBenchmarkCollector(b, vmware_blast.Name, vmware_blast.NewWithFlags) -} diff --git a/pkg/collector/collector.go b/pkg/collector/collector.go index ba592892..9414fb42 100644 --- a/pkg/collector/collector.go +++ b/pkg/collector/collector.go @@ -51,14 +51,12 @@ import ( "github.com/prometheus-community/windows_exporter/internal/collector/smtp" "github.com/prometheus-community/windows_exporter/internal/collector/system" "github.com/prometheus-community/windows_exporter/internal/collector/tcp" - "github.com/prometheus-community/windows_exporter/internal/collector/teradici_pcoip" "github.com/prometheus-community/windows_exporter/internal/collector/terminal_services" "github.com/prometheus-community/windows_exporter/internal/collector/textfile" "github.com/prometheus-community/windows_exporter/internal/collector/thermalzone" "github.com/prometheus-community/windows_exporter/internal/collector/time" "github.com/prometheus-community/windows_exporter/internal/collector/updates" "github.com/prometheus-community/windows_exporter/internal/collector/vmware" - "github.com/prometheus-community/windows_exporter/internal/collector/vmware_blast" v1 "github.com/prometheus-community/windows_exporter/internal/perfdata/v1" "github.com/prometheus-community/windows_exporter/internal/types" "github.com/yusufpapurcu/wmi" @@ -119,7 +117,6 @@ func NewWithConfig(config Config) *MetricCollectors { collectors[smbclient.Name] = smbclient.New(&config.SMBClient) collectors[smtp.Name] = smtp.New(&config.SMTP) collectors[system.Name] = system.New(&config.System) - collectors[teradici_pcoip.Name] = teradici_pcoip.New(&config.TeradiciPcoip) collectors[tcp.Name] = tcp.New(&config.TCP) collectors[terminal_services.Name] = terminal_services.New(&config.TerminalServices) collectors[textfile.Name] = textfile.New(&config.Textfile) @@ -127,7 +124,6 @@ func NewWithConfig(config Config) *MetricCollectors { collectors[time.Name] = time.New(&config.Time) collectors[updates.Name] = updates.New(&config.Updates) collectors[vmware.Name] = vmware.New(&config.Vmware) - collectors[vmware_blast.Name] = vmware_blast.New(&config.VmwareBlast) return New(collectors) } diff --git a/pkg/collector/config.go b/pkg/collector/config.go index 122b15b2..f62e25d5 100644 --- a/pkg/collector/config.go +++ b/pkg/collector/config.go @@ -41,14 +41,12 @@ import ( "github.com/prometheus-community/windows_exporter/internal/collector/smtp" "github.com/prometheus-community/windows_exporter/internal/collector/system" "github.com/prometheus-community/windows_exporter/internal/collector/tcp" - "github.com/prometheus-community/windows_exporter/internal/collector/teradici_pcoip" "github.com/prometheus-community/windows_exporter/internal/collector/terminal_services" "github.com/prometheus-community/windows_exporter/internal/collector/textfile" "github.com/prometheus-community/windows_exporter/internal/collector/thermalzone" "github.com/prometheus-community/windows_exporter/internal/collector/time" "github.com/prometheus-community/windows_exporter/internal/collector/updates" "github.com/prometheus-community/windows_exporter/internal/collector/vmware" - "github.com/prometheus-community/windows_exporter/internal/collector/vmware_blast" ) type Config struct { @@ -91,7 +89,6 @@ type Config struct { SMBClient smbclient.Config `yaml:"smb_client"` SMTP smtp.Config `yaml:"smtp"` System system.Config `yaml:"system"` - TeradiciPcoip teradici_pcoip.Config `yaml:"teradici_pcoip"` TCP tcp.Config `yaml:"tcp"` TerminalServices terminal_services.Config `yaml:"terminal_services"` Textfile textfile.Config `yaml:"textfile"` @@ -99,7 +96,6 @@ type Config struct { Time time.Config `yaml:"time"` Updates updates.Config `yaml:"updates"` Vmware vmware.Config `yaml:"vmware"` - VmwareBlast vmware_blast.Config `yaml:"vmware_blast"` } // ConfigDefaults Is an interface to be used by the external libraries. It holds all ConfigDefaults form all collectors @@ -145,7 +141,6 @@ var ConfigDefaults = Config{ SMBClient: smbclient.ConfigDefaults, SMTP: smtp.ConfigDefaults, System: system.ConfigDefaults, - TeradiciPcoip: teradici_pcoip.ConfigDefaults, TCP: tcp.ConfigDefaults, TerminalServices: terminal_services.ConfigDefaults, Textfile: textfile.ConfigDefaults, @@ -153,5 +148,4 @@ var ConfigDefaults = Config{ Time: time.ConfigDefaults, Updates: updates.ConfigDefaults, Vmware: vmware.ConfigDefaults, - VmwareBlast: vmware_blast.ConfigDefaults, } diff --git a/pkg/collector/map.go b/pkg/collector/map.go index 2624960b..c78d3923 100644 --- a/pkg/collector/map.go +++ b/pkg/collector/map.go @@ -45,14 +45,12 @@ import ( "github.com/prometheus-community/windows_exporter/internal/collector/smtp" "github.com/prometheus-community/windows_exporter/internal/collector/system" "github.com/prometheus-community/windows_exporter/internal/collector/tcp" - "github.com/prometheus-community/windows_exporter/internal/collector/teradici_pcoip" "github.com/prometheus-community/windows_exporter/internal/collector/terminal_services" "github.com/prometheus-community/windows_exporter/internal/collector/textfile" "github.com/prometheus-community/windows_exporter/internal/collector/thermalzone" "github.com/prometheus-community/windows_exporter/internal/collector/time" "github.com/prometheus-community/windows_exporter/internal/collector/updates" "github.com/prometheus-community/windows_exporter/internal/collector/vmware" - "github.com/prometheus-community/windows_exporter/internal/collector/vmware_blast" ) func NewBuilderWithFlags[C Collector](fn BuilderWithFlags[C]) BuilderWithFlags[Collector] { @@ -101,7 +99,6 @@ var BuildersWithFlags = map[string]BuilderWithFlags[Collector]{ smbclient.Name: NewBuilderWithFlags(smbclient.NewWithFlags), smtp.Name: NewBuilderWithFlags(smtp.NewWithFlags), system.Name: NewBuilderWithFlags(system.NewWithFlags), - teradici_pcoip.Name: NewBuilderWithFlags(teradici_pcoip.NewWithFlags), tcp.Name: NewBuilderWithFlags(tcp.NewWithFlags), terminal_services.Name: NewBuilderWithFlags(terminal_services.NewWithFlags), textfile.Name: NewBuilderWithFlags(textfile.NewWithFlags), @@ -109,7 +106,6 @@ var BuildersWithFlags = map[string]BuilderWithFlags[Collector]{ time.Name: NewBuilderWithFlags(time.NewWithFlags), updates.Name: NewBuilderWithFlags(updates.NewWithFlags), vmware.Name: NewBuilderWithFlags(vmware.NewWithFlags), - vmware_blast.Name: NewBuilderWithFlags(vmware_blast.NewWithFlags), } func Available() []string {