Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #20: Create Windows.yaml #21

Merged
merged 5 commits into from
Feb 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 78 additions & 26 deletions src/main/connector/system/Windows/Windows.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
extends:
- ../System/System
metrics:
system.service.status:
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
Expand All @@ -18,9 +31,8 @@ connector:
monitors:
cpu:
simple:
type: multiInstance
sources:
source(1):
processorInformation:
# cpuId;user;system;idle;
type: wmi
namespace: root\CIMv2
Expand All @@ -44,7 +56,7 @@ monitors:
column: 4
value: 100000000
mapping:
source: ${source::monitors.cpu.simple.sources.source(1)}
source: ${source::monitors.cpu.simple.sources.processorInformation}
attributes:
id: $1
name: ${awk::sprintf("%s %s", "cpu", $1)}
alexdgilbert marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -58,14 +70,13 @@ monitors:
system.cpu.time{system.cpu.state="idle"}: $4
memory:
simple:
type: multiInstance
sources:
# Free;Free;Cached;Cached
source(1):
memoryInformation:
type: wmi
namespace: root\CIMv2
query: SELECT FreeAndZeroPageListBytes,FreeAndZeroPageListBytes,CacheBytes,CacheBytes FROM Win32_PerfRawData_PerfOS_Memory
source(2):
calculatedMemoryInformation:
# Free;Free%;Cached;Cached%;Used;Used%;Total
type: wmi
namespace: root\CIMv2
Expand All @@ -74,7 +85,7 @@ monitors:
# Combining both sources for calculations
- type: leftConcat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a terrible way of joining 2 tables 😅

The problem with this hack is that the leftConcat operation is not specified with a table as the value to concatenate:

  • Do we concatenate the entire table into each line of the source?
  • Do we concatenate line-by-line?

If we could find a better way to "merge" source(1) and source(2), that would be preferrable and clearer.

column: 1
value: ${source::monitors.memory.simple.sources.source(1)}
value: ${source::monitors.memory.simple.sources.memoryInformation}
# Converting total to bytes and making a copy for used memory
- type: multiply
column: 5
Expand All @@ -98,7 +109,7 @@ monitors:
column: 6
value: $7
mapping:
source: ${source::monitors.memory.simple.sources.source(2)}
source: ${source::monitors.memory.simple.sources.calculatedMemoryInformation}
attributes:
id: memory_usage
system.memory.limit: $7
Expand All @@ -111,10 +122,9 @@ monitors:
system.memory.utilization{system.memory.usage="cached"}: $4
fileSystem:
simple:
type: multiInstance
sources:
# DeviceID,FreeSpace,UsedSpace,VolumeName
source(1):
# DeviceID;FreeSpace;UsedSpace;VolumeName
fileSystemInformation:
type: wmi
namespace: root\CIMv2
query: SELECT DeviceID,FreeSpace,Size,VolumeName FROM Win32_LogicalDisk
Expand All @@ -123,7 +133,7 @@ monitors:
column: 3
value: $2
mapping:
source: ${source::monitors.fileSystem.simple.sources.source(1)}
source: ${source::monitors.fileSystem.simple.sources.fileSystemInformation}
attributes:
id: $1
system.filesystem.device: $1
Expand All @@ -133,26 +143,68 @@ monitors:
system.filesystem.usage{system.filesystem.state=used}: $3
service:
simple:
type: multiInstance
sources:
# Name,ProcessId,StartMode,State
source(1):
# Name;ProcessId;StartMode;State
serviceInformation:
type: wmi
namespace: root\CIMv2
query: SELECT Name,ProcessId,StartMode,State From Win32_Service
query: SELECT Name,ProcessId,State FROM Win32_Service WHERE StartMode != 'Disabled'
mapping:
source: ${source::monitors.service.simple.sources.serviceInformation}
attributes:
id: $1
processId: $2
metrics:
system.service.state: $3
pageFile:
simple:
sources:
# Name;CurrentUsage;CurrentUsage
pageFileUsageInformation:
type: wmi
namespace: root\CIMv2
query: SELECT Name,CurrentUsage,CurrentUsage FROM Win32_PageFileUsage
# Name;MaximumSize
pageFileSettingsInformation:
type: wmi
namespace: root\CIMv2
query: SELECT Name,MaximumSize FROM Win32_PageFileSetting
#Name;CurrentUsage;Utilization;Name;MaximumSize
pageFileCombinedInformation:
type: tableJoin
leftTable: ${source::monitors.pageFile.simple.sources.pageFileUsageInformation}
rightTable: ${source::monitors.pageFile.simple.sources.pageFileSettingsInformation}
leftKeyColumn: 1
rightKeyColumn: 1
computes:
alexdgilbert marked this conversation as resolved.
Show resolved Hide resolved
- type: translate
- type: divide
column: 3
translationTable: ${translation::serviceStatusTranslationTable}
value: $5
mapping:
source: ${source::monitors.service.simple.sources.source(1)}
source: ${source::monitors.pageFile.simple.sources.pageFileCombinedInformation}
attributes:
id: $1
alexdgilbert marked this conversation as resolved.
Show resolved Hide resolved
metrics:
system.paging.usage: $2
system.paging.utilization: $3
alexdgilbert marked this conversation as resolved.
Show resolved Hide resolved
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
alexdgilbert marked this conversation as resolved.
Show resolved Hide resolved
FROM Win32_PerfFormattedData_Tcpip_NetworkInterface
mapping:
source: ${source::monitors.network.simple.sources.networkInformation}
attributes:
id: $1
processId: $2
startMode: $3
metrics:
system.service.state: $4
translations:
serviceStatusTranslationTable:
Stopped: "0"
Running: "1"
system.network.dropped{network.io.direction="transmit"}: $2
alexdgilbert marked this conversation as resolved.
Show resolved Hide resolved
system.network.dropped{network.io.direction="receive"}: $3
system.network.packets{network.io.direction="transmit"}: fakeCounter($4)
system.network.packets{network.io.direction="receive"}: fakeCounter($5)
system.network.errors{network.io.direction="transmit"}: $6
system.network.errors{network.io.direction="receive"}: $7