Skip to content

Commit

Permalink
Merge pull request #86 from sentrysoftware/85-add-os-information-to-l…
Browse files Browse the repository at this point in the history
…inux-and-windows-connectors

Issue #85: Added new metrics system.uptime
  • Loading branch information
NassimBtk authored Jul 8, 2024
2 parents 72e321d + 47c011c commit b7b93ee
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/main/connector/system/Linux/Linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,24 @@ monitors:
system.filesystem.usage{system.filesystem.state=free}: $5
system.filesystem.utilization{system.filesystem.state=used}: $6
system.filesystem.utilization{system.filesystem.state=free}: $7
system:
simple:
sources:
# Distribution;Version;Kernel
osInformation:
type: commandLine
commandLine: |
. /etc/os-release
echo "$NAME;$VERSION;`uname -r`;`cut -d. -f1 /proc/uptime`"
mapping:
source: ${source::osInformation}
attributes:
id: $3
name: $1
version: $2
os_version: $3
metrics:
system.uptime: $4
translations:
serviceLoadedTranslationTable:
not-found: "0"
Expand Down
6 changes: 5 additions & 1 deletion src/main/connector/system/System/System.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,8 @@ metrics:
system.linux.memory.available:
description: An estimate of how much memory is available for starting new applications, without causing swapping
type: UpDownCounter
unit: By
unit: By
system.uptime:
description: System uptime in seconds indicates how long the host has been running since its last boot
type: Gauge
unit: s
27 changes: 27 additions & 0 deletions src/main/connector/system/Windows/Windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,30 @@ monitors:
system.disk.io_time: $6
system.disk.operation_time{disk.io.direction="read"}: $7
system.disk.operation_time{disk.io.direction="write"}: $8
system:
simple:
sources:
# Uptime
uptime:
type: wmi
namespace: root\CIMv2
query: SELECT SystemUpTime FROM Win32_PerfFormattedData_PerfOS_System
# SerialNumber;Caption;Version;BuildNumber
osInformation:
type: wmi
namespace: root\CIMv2
query: SELECT SerialNumber, Caption, Version, BuildNumber FROM Win32_OperatingSystem
computes:
- type: prepend
column: 5
value: ${source::uptime}
mapping:
source: ${source::osInformation}
attributes:
id: $1
serial_number: $1
name: $2
version: $4
os_version: $3
metrics:
system.uptime: $5

0 comments on commit b7b93ee

Please sign in to comment.