mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-23 13:16:36 +00:00
logical_disk: add bitlocker status sub-collector (#2077)
This commit is contained in:
@@ -20,7 +20,7 @@ package hcn
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/headers/guid"
|
||||
"github.com/go-ole/go-ole"
|
||||
"github.com/prometheus-community/windows_exporter/internal/utils"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
@@ -30,7 +30,7 @@ var (
|
||||
defaultQuery = utils.Must(windows.UTF16PtrFromString(`{"SchemaVersion":{"Major": 2,"Minor": 0},"Flags":"None"}`))
|
||||
)
|
||||
|
||||
func GetEndpointProperties(endpointID guid.GUID) (EndpointProperties, error) {
|
||||
func GetEndpointProperties(endpointID ole.GUID) (EndpointProperties, error) {
|
||||
endpoint, err := OpenEndpoint(endpointID)
|
||||
if err != nil {
|
||||
return EndpointProperties{}, fmt.Errorf("failed to open endpoint: %w", err)
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"fmt"
|
||||
"unsafe"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/headers/guid"
|
||||
"github.com/go-ole/go-ole"
|
||||
"github.com/prometheus-community/windows_exporter/internal/headers/hcs"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
@@ -40,7 +40,7 @@ var (
|
||||
// EnumerateEndpoints enumerates the endpoints.
|
||||
//
|
||||
// https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnenumerateendpoints
|
||||
func EnumerateEndpoints() ([]guid.GUID, error) {
|
||||
func EnumerateEndpoints() ([]ole.GUID, error) {
|
||||
var (
|
||||
endpointsJSON *uint16
|
||||
errorRecord *uint16
|
||||
@@ -59,7 +59,7 @@ func EnumerateEndpoints() ([]guid.GUID, error) {
|
||||
return nil, fmt.Errorf("HcnEnumerateEndpoints failed: HRESULT 0x%X: %w", r1, hcs.Win32FromHResult(r1))
|
||||
}
|
||||
|
||||
var endpoints []guid.GUID
|
||||
var endpoints []ole.GUID
|
||||
|
||||
if err := json.Unmarshal([]byte(result), &endpoints); err != nil {
|
||||
return nil, fmt.Errorf("failed to unmarshal JSON: %w", err)
|
||||
@@ -71,7 +71,7 @@ func EnumerateEndpoints() ([]guid.GUID, error) {
|
||||
// OpenEndpoint opens an endpoint.
|
||||
//
|
||||
// https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnopenendpoint
|
||||
func OpenEndpoint(id guid.GUID) (Endpoint, error) {
|
||||
func OpenEndpoint(id ole.GUID) (Endpoint, error) {
|
||||
var (
|
||||
endpoint Endpoint
|
||||
errorRecord *uint16
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
package hcn
|
||||
|
||||
import (
|
||||
"github.com/prometheus-community/windows_exporter/internal/headers/guid"
|
||||
"github.com/go-ole/go-ole"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
@@ -38,7 +38,7 @@ type EndpointPropertiesResources struct {
|
||||
Allocators []EndpointPropertiesAllocators `json:"Allocators"`
|
||||
}
|
||||
type EndpointPropertiesAllocators struct {
|
||||
AdapterNetCfgInstanceId *guid.GUID `json:"AdapterNetCfgInstanceId"`
|
||||
AdapterNetCfgInstanceId *ole.GUID `json:"AdapterNetCfgInstanceId"`
|
||||
}
|
||||
|
||||
type EndpointStats struct {
|
||||
|
||||
Reference in New Issue
Block a user