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 #57: Fixing memory size on Linux and Windows connectors #61

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
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
58 changes: 45 additions & 13 deletions src/main/connector/system/Linux/Linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ connector:
- linux
criteria:
- type: osCommand
commandLine: /usr/bin/uname -o
commandLine: (/usr/bin/uname -o) || (/bin/uname -o )
alexdgilbert marked this conversation as resolved.
Show resolved Hide resolved
expectedResult: GNU/Linux
errorMessage: Not a valid Linux host.
tags: [ system ]
Expand All @@ -33,14 +33,14 @@ monitors:
cpuInfo:
# cpuId;user;nice;system;idle;iowait
type: osCommand
commandLine: /usr/bin/cat /proc/stat
commandLine: cat /proc/stat
computes:
- type: awk
script: |
/cpu[0-9]/ {
sub("cpu","");
print $1 ";" $2 / 100 ";" $3 / 100 ";" $4 / 100 ";" $5 / 100 ";" $6 / 100
}
}
mapping:
source: ${source::cpuInfo}
attributes:
Expand All @@ -58,30 +58,62 @@ monitors:
system.cpu.time{system.cpu.state="system"}: $4
system.cpu.time{system.cpu.state="idle"}: $5
system.cpu.time{system.cpu.state="io_wait"}: $6
process:
simple:
sources:
procrb:
type: osCommand
commandLine: (cat /proc/stat)
computes:
- type: awk
script: |
/procs_/ {s = s ";" $2} END {print s}
alexdgilbert marked this conversation as resolved.
Show resolved Hide resolved
mapping:
source: ${source::procrb}
attributes:
id: $1
name: $2
metrics:
system.cpu.process{system.cpu.process="running"}: $2
system.cpu.process{system.cpu.process="blocked"}: $3
memory:
simple:
sources:
memorySys:
# memSystem
type: osCommand
commandLine: (/usr/bin/lsmem -b) || (free -b | awk '/Mem/ {print "Total online memory " $2}')
alexdgilbert marked this conversation as resolved.
Show resolved Hide resolved
computes:
- type: awk
script: |
/Total online memory/ { print $4 }
alexdgilbert marked this conversation as resolved.
Show resolved Hide resolved
memoryInfo:
# memTotal;memFree;memUsed;memBuffers;memCached;memFreeUtilization;memUsedUtilization;memBuffersUtilization;memCachedUtilization
type: osCommand
commandLine: /usr/bin/cat /proc/meminfo
commandLine: cat /proc/meminfo
computes:
- type: awk
script: ${file::memory.awk}
- type: leftConcat
column: 1
value: ;
- type: rightConcat
column: 1
value: ${source::memorySys}
mapping:
source: ${source::memoryInfo}
attributes:
id: memory_usage
alexdgilbert marked this conversation as resolved.
Show resolved Hide resolved
system.memory.limit: $1
metrics:
system.memory.usage{system.memory.usage="free"}: $2
system.memory.usage{system.memory.usage="used"}: $3
system.memory.usage{system.memory.usage="buffers"}: $4
system.memory.usage{system.memory.usage="cached"}: $5
system.memory.utilization{system.memory.usage="free"}: $6
system.memory.utilization{system.memory.usage="used"}: $7
system.memory.utilization{system.memory.usage="buffers"}: $8
system.memory.utilization{system.memory.usage="cached"}: $9
system.memory.limit: $1
system.memory.usage{system.memory.usage="free"}: $3
system.memory.usage{system.memory.usage="used"}: $4
system.memory.usage{system.memory.usage="buffers"}: $5
system.memory.usage{system.memory.usage="cached"}: $6
system.memory.utilization{system.memory.usage="free"}: $7
system.memory.utilization{system.memory.usage="used"}: $8
system.memory.utilization{system.memory.usage="buffers"}: $9
system.memory.utilization{system.memory.usage="cached"}: $10
network:
simple:
sources:
Expand Down
2 changes: 1 addition & 1 deletion src/main/connector/system/Windows/Windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ monitors:
source: ${source::calculatedMemoryInformation}
attributes:
id: memory_usage
system.memory.limit: $7
metrics:
system.memory.limit: $7
system.memory.usage{system.memory.usage="free"}: $1
system.memory.usage{system.memory.usage="used"}: $5
system.memory.usage{system.memory.usage="cached"}: $3
Expand Down