Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ommunity-connectors into feature/issue-31-update-constant-references
  • Loading branch information
MedMaalej committed Feb 8, 2024
2 parents 03bd51c + b705709 commit 178b4ee
Showing 1 changed file with 264 additions and 0 deletions.
264 changes: 264 additions & 0 deletions src/main/connector/system/Windows/Windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
extends:
- ../System/System
metrics:
system.service.state:
description: Service Status
type:
stateSet:
- Running
- Stopped
- Paused
- Start Pending
- Stop Pending
- Pause Pending
- Continue Pending
- Unknown
connector:
displayName: WindowsOS
platform: Any platform with Windows
reliesOn: WMI
information: Gives OS specific information and metrics
detection:
connectionTypes:
- remote
- local
appliesTo:
- nt
criteria:
- type: wmi
namespace: root\CIMv2
query: SELECT * FROM Win32_OperatingSystem
monitors:
cpu:
simple:
sources:
processorInformation:
# cpuId;user;system;idle;
type: wmi
namespace: root\CIMv2
query: SELECT Name,PercentUserTime,PercentPrivilegedTime,PercentIdleTime FROM Win32_PerfRawData_Counters_ProcessorInformation
computes:
- type: excludeMatchingLines
column: 1
regExp: _Total
- type: extract
column: 1
subSeparators: ","
subColumn: 2
# Convert 100ns to s
- type: divide
column: 2
value: 100000000
- type: divide
column: 3
value: 100000000
- type: divide
column: 4
value: 100000000
mapping:
source: ${source::processorInformation}
attributes:
id: $1
name: cpu $1
system.cpu.logical_number: $1
metrics:
system.cpu.utilization{system.cpu.state="user"}: rate($2)
system.cpu.utilization{system.cpu.state="system"}: rate($3)
system.cpu.utilization{system.cpu.state="idle"}: rate($4)
system.cpu.time{system.cpu.state="user"}: $2
system.cpu.time{system.cpu.state="system"}: $3
system.cpu.time{system.cpu.state="idle"}: $4
memory:
simple:
sources:
# Free;Free;Cached;Cached
memoryInformation:
type: wmi
namespace: root\CIMv2
query: SELECT FreeAndZeroPageListBytes,FreeAndZeroPageListBytes,CacheBytes,CacheBytes FROM Win32_PerfRawData_PerfOS_Memory
calculatedMemoryInformation:
# Free;Free%;Cached;Cached%;Used;Used%;Total
type: wmi
namespace: root\CIMv2
query: SELECT TotalVisibleMemorySize FROM Win32_OperatingSystem
computes:
# Combining both sources for calculations
- type: leftConcat
column: 1
value: ${source::memoryInformation}
# Converting total to bytes and making a copy for used memory
- type: multiply
column: 5
value: 1024
- type: duplicateColumn
column: 5
# Finding used memory and making a copy for utilization
- type: subtract
column: 5
value: $1
- type: duplicateColumn
column: 5
# Calculate utilization by dividing usage by total memory
- type: divide
column: 2
value: $7
- type: divide
column: 4
value: $7
- type: divide
column: 6
value: $7
mapping:
source: ${source::calculatedMemoryInformation}
attributes:
id: memory_usage
system.memory.limit: $7
metrics:
system.memory.usage{system.memory.usage="free"}: $1
system.memory.usage{system.memory.usage="used"}: $5
system.memory.usage{system.memory.usage="cached"}: $3
system.memory.utilization{system.memory.usage="free"}: $2
system.memory.utilization{system.memory.usage="used"}: $6
system.memory.utilization{system.memory.usage="cached"}: $4
file_system:
simple:
sources:
# DeviceID;FreeSpace;UsedSpace;VolumeName
fileSystemInformation:
type: wmi
namespace: root\CIMv2
query: SELECT DeviceID,FreeSpace,Size,VolumeName FROM Win32_LogicalDisk
computes:
- type: subtract
column: 3
value: $2
mapping:
source: ${source::fileSystemInformation}
attributes:
id: $1
system.filesystem.device: $1
system.filesystem.volumeName: $4
metrics:
system.filesystem.usage{system.filesystem.state=free}: $2
system.filesystem.usage{system.filesystem.state=used}: $3
service:
simple:
sources:
# Name;ProcessId;StartMode;State
serviceInformation:
type: wmi
namespace: root\CIMv2
query: SELECT Name,ProcessId,State FROM Win32_Service WHERE StartMode != 'Disabled'
mapping:
source: ${source::serviceInformation}
attributes:
id: $1
processId: $2
metrics:
system.service.state: $3
paging:
simple:
sources:
# BytesUsed;BytesFree;UtilizationUsed;UtilizationFree;TotalBytes
pagingUsageInformation:
type: wmi
namespace: root\CIMv2
query: SELECT PercentUsage,PercentUsage_Base,PercentUsage,PercentUsage_Base FROM Win32_PerfRawData_PerfOS_PagingFile WHERE Name = '_Total'
computes:
- type: subtract
column: 2
value: $1
- type: divide
column: 3
value: $4
- type: rightConcat
column: 3
value: ;1
- type: subtract
column: 4
value: $3
# BytesUsed;BytesFree;UtilizationUsed;UtilizationFree;TotalBytes;PageOutputPersec;PageInputPersec;PageFaultsPersec;WriteCopiesPersec
pagingCombinedInformation:
type: wmi
namespace: root\CIMv2
query: SELECT PageWritesPersec,PageReadsPersec,PageFaultsPersec,WriteCopiesPersec FROM Win32_PerfRawData_PerfOS_Memory
computes:
- type: subtract
column: 3
value: $4
- type: leftConcat
column: 1
value: ${source::pagingUsageInformation}
mapping:
source: ${source::pagingCombinedInformation}
attributes:
id: paging
metrics:
system.paging.usage{system.paging.state="used"}: $1
system.paging.usage{system.paging.state="free"}: $2
system.paging.utilization{system.paging.state="used"}: $3
system.paging.utilization{system.paging.state="free"}: $4
system.paging.operations{system.paging.direction="out"}: $6
system.paging.operations{system.paging.direction="in"}: $7
system.paging.faults{system.paging.type="soft"}: $8
system.paging.faults{system.paging.type="hard"}: $9
network:
simple:
sources:
# Name;PacketsOutboundDiscarded;PacketsReceivedDiscarded;PacketsSentPersec;PacketsReceivedPersec;PacketsOutboundErrors;PacketsReceivedErrors
networkInformation:
type: wmi
namespace: root\CIMv2
query: >
SELECT Name,
PacketsOutboundDiscarded,
PacketsReceivedDiscarded,
PacketsSentPersec,
PacketsReceivedPersec,
PacketsOutboundErrors,
PacketsReceivedErrors,
BytesSentPerSec,
BytesReceivedPerSec
FROM Win32_PerfRawData_Tcpip_NetworkInterface
mapping:
source: ${source::networkInformation}
attributes:
id: $1
metrics:
system.network.dropped{network.io.direction="transmit"}: $2
system.network.dropped{network.io.direction="receive"}: $3
system.network.packets{network.io.direction="transmit"}: $4
system.network.packets{network.io.direction="receive"}: $5
system.network.errors{network.io.direction="transmit"}: $6
system.network.errors{network.io.direction="receive"}: $7
system.network.io{network.io.direction="transmit"}: $8
system.network.io{network.io.direction="receive"}: $9
physical_disk:
simple:
sources:
# Name;DiskReadBytesPersec;DiskWriteBytesPersec;DiskReadsPersec;DiskWritesPersec;PercentDiskTime;PercentDiskReadTime;PercentDiskWriteTime
physicalDiskInformation:
type: wmi
namespace: root\CIMv2
query: >
SELECT Name,
DiskReadBytesPersec,
DiskWriteBytesPersec,
DiskReadsPersec,
DiskWritesPersec,
PercentDiskTime,
PercentDiskReadTime,
PercentDiskWriteTime
FROM Win32_PerfRawData_PerfDisk_PhysicalDisk WHERE NAME != '_Total'
mapping:
source: ${source::physicalDiskInformation}
attributes:
id: $1
metrics:
system.disk.io{disk.io.direction="read"}: $2
system.disk.io{disk.io.direction="write"}: $3
system.disk.operations{disk.io.direction="read"}: $4
system.disk.operations{disk.io.direction="write"}: $5
system.disk.io_time: $6
system.disk.operation_time{disk.io.direction="read"}: $7
system.disk.operation_time{disk.io.direction="write"}: $8

0 comments on commit 178b4ee

Please sign in to comment.