Skip to content

Commit df28d73

Browse files
committed
enhance memory/swap with max_expr
1 parent f089846 commit df28d73

6 files changed

Lines changed: 36 additions & 28 deletions

File tree

tests/os/linux/snmp/generic-snmp/memory-64.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
"value": "{memAvailReal}",
2222
"uom": "B",
2323
"min": 0,
24+
"max_expr": "{memTotalReal}",
2425
"threshold-suffix": "memory-free-bytes"
2526
},
2627
{
2728
"name": "memory.usage.bytes",
2829
"value": "{memTotalReal} - {memAvailReal}",
2930
"uom": "B",
3031
"min": 0,
32+
"max_expr": "{memTotalReal}",
3133
"threshold-suffix": "memory-bytes"
3234
},
3335
{

tests/os/linux/snmp/generic-snmp/memory.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
"value": "{memAvailReal}",
2222
"uom": "B",
2323
"min": 0,
24+
"max_expr": "{memTotalReal}",
2425
"threshold-suffix": "memory-free-bytes"
2526
},
2627
{
2728
"name": "memory.usage.bytes",
2829
"value": "{memTotalReal} - {memAvailReal}",
2930
"uom": "B",
3031
"min": 0,
32+
"max_expr": "{memTotalReal}",
3133
"threshold-suffix": "memory-bytes"
3234
},
3335
{

tests/os/linux/snmp/generic-snmp/swap-64.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
"value": "{memAvailSwap}",
2222
"uom": "B",
2323
"min": 0,
24+
"max_expr": "{memTotalSwap}",
2425
"threshold-suffix": "swap-free-bytes"
2526
},
2627
{
2728
"name": "swap.usage.bytes",
2829
"value": "{memTotalSwap} - {memAvailSwap}",
2930
"uom": "B",
3031
"min": 0,
32+
"max_expr": "{memTotalSwap}",
3133
"threshold-suffix": "swap-bytes"
3234
},
3335
{

tests/os/linux/snmp/generic-snmp/swap.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
"value": "{memAvailSwap}",
2222
"uom": "B",
2323
"min": 0,
24+
"max_expr": "{memTotalSwap}",
2425
"threshold-suffix": "swap-free-bytes"
2526
},
2627
{
2728
"name": "swap.usage.bytes",
2829
"value": "{memTotalSwap} - {memAvailSwap}",
2930
"uom": "B",
3031
"min": 0,
32+
"max_expr": "{memTotalSwap}",
3133
"threshold-suffix": "swap-bytes"
3234
},
3335
{

tests/os/linux/snmp/memory.robot

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -221,28 +221,28 @@ cgs-mem ${tc}
221221
... --
222222
... 1
223223
... ${EMPTY}
224-
... OK: Memory Used: 1266544B - Free: 747712 - Total: 2014256 | memory.free.bytes=747712B;;;0; memory.usage.bytes=1266544B;;;0; memory.usage.percent=62.88%;;;0;100
224+
... OK: Memory Used: 1266544B - Free: 747712 - Total: 2014256 | memory.free.bytes=747712B;;;0;2014256 memory.usage.bytes=1266544B;;;0;2014256 memory.usage.percent=62.88%;;;0;100
225225
... 2
226226
... --warning-memory-bytes=0.1
227-
... WARNING: memory.usage.bytes is 1266544B | memory.free.bytes=747712B;;;0; memory.usage.bytes=1266544B;0.1;;0; memory.usage.percent=62.88%;;;0;100
227+
... WARNING: memory.usage.bytes is 1266544B | memory.free.bytes=747712B;;;0;2014256 memory.usage.bytes=1266544B;0.1;;0;2014256 memory.usage.percent=62.88%;;;0;100
228228
... 3
229229
... --critical-memory-bytes=0.1
230-
... CRITICAL: memory.usage.bytes is 1266544B | memory.free.bytes=747712B;;;0; memory.usage.bytes=1266544B;;0.1;0; memory.usage.percent=62.88%;;;0;100
230+
... CRITICAL: memory.usage.bytes is 1266544B | memory.free.bytes=747712B;;;0;2014256 memory.usage.bytes=1266544B;;0.1;0;2014256 memory.usage.percent=62.88%;;;0;100
231231
... 4
232232
... --warning-memory-prct=0.1
233-
... WARNING: memory.usage.percent is 62.88% | memory.free.bytes=747712B;;;0; memory.usage.bytes=1266544B;;;0; memory.usage.percent=62.88%;0.1;;0;100
233+
... WARNING: memory.usage.percent is 62.88% | memory.free.bytes=747712B;;;0;2014256 memory.usage.bytes=1266544B;;;0;2014256 memory.usage.percent=62.88%;0.1;;0;100
234234
... 5
235235
... --critical-memory-prct=0.1
236-
... CRITICAL: memory.usage.percent is 62.88% | memory.free.bytes=747712B;;;0; memory.usage.bytes=1266544B;;;0; memory.usage.percent=62.88%;;0.1;0;100
236+
... CRITICAL: memory.usage.percent is 62.88% | memory.free.bytes=747712B;;;0;2014256 memory.usage.bytes=1266544B;;;0;2014256 memory.usage.percent=62.88%;;0.1;0;100
237237
... 6
238238
... --check-format
239239
... Check format of JSON file '${CURDIR}/generic-snmp/memory.json' JSON is valid
240240
... 7
241241
... --warning-memory-free-bytes=1
242-
... WARNING: memory.free.bytes is 747712B | memory.free.bytes=747712B;1;;0; memory.usage.bytes=1266544B;;;0; memory.usage.percent=62.88%;;;0;100
242+
... WARNING: memory.free.bytes is 747712B | memory.free.bytes=747712B;1;;0;2014256 memory.usage.bytes=1266544B;;;0;2014256 memory.usage.percent=62.88%;;;0;100
243243
... 8
244244
... --critical-memory-free-bytes=1
245-
... CRITICAL: memory.free.bytes is 747712B | memory.free.bytes=747712B;;1;0; memory.usage.bytes=1266544B;;;0; memory.usage.percent=62.88%;;;0;100
245+
... CRITICAL: memory.free.bytes is 747712B | memory.free.bytes=747712B;;1;0;2014256 memory.usage.bytes=1266544B;;;0;2014256 memory.usage.percent=62.88%;;;0;100
246246

247247
cgs-mem-64 ${tc}
248248
[Tags] os linux centreon-generic-snmp
@@ -264,25 +264,25 @@ cgs-mem-64 ${tc}
264264
... --
265265
... 1
266266
... ${EMPTY}
267-
... OK: Memory Used: 6320981920B - Free: 20050780 - Total: 6341032700 | memory.free.bytes=20050780B;;;0; memory.usage.bytes=6320981920B;;;0; memory.usage.percent=99.68%;;;0;100
267+
... OK: Memory Used: 6320981920B - Free: 20050780 - Total: 6341032700 | memory.free.bytes=20050780B;;;0;6341032700 memory.usage.bytes=6320981920B;;;0;6341032700 memory.usage.percent=99.68%;;;0;100
268268
... 2
269269
... --warning-memory-bytes=0.1
270-
... WARNING: memory.usage.bytes is 6320981920B | memory.free.bytes=20050780B;;;0; memory.usage.bytes=6320981920B;0.1;;0; memory.usage.percent=99.68%;;;0;100
270+
... WARNING: memory.usage.bytes is 6320981920B | memory.free.bytes=20050780B;;;0;6341032700 memory.usage.bytes=6320981920B;0.1;;0;6341032700 memory.usage.percent=99.68%;;;0;100
271271
... 3
272272
... --critical-memory-bytes=0.1
273-
... CRITICAL: memory.usage.bytes is 6320981920B | memory.free.bytes=20050780B;;;0; memory.usage.bytes=6320981920B;;0.1;0; memory.usage.percent=99.68%;;;0;100
273+
... CRITICAL: memory.usage.bytes is 6320981920B | memory.free.bytes=20050780B;;;0;6341032700 memory.usage.bytes=6320981920B;;0.1;0;6341032700 memory.usage.percent=99.68%;;;0;100
274274
... 4
275275
... --warning-memory-prct=0.1
276-
... WARNING: memory.usage.percent is 99.68% | memory.free.bytes=20050780B;;;0; memory.usage.bytes=6320981920B;;;0; memory.usage.percent=99.68%;0.1;;0;100
276+
... WARNING: memory.usage.percent is 99.68% | memory.free.bytes=20050780B;;;0;6341032700 memory.usage.bytes=6320981920B;;;0;6341032700 memory.usage.percent=99.68%;0.1;;0;100
277277
... 5
278278
... --critical-memory-prct=0.1
279-
... CRITICAL: memory.usage.percent is 99.68% | memory.free.bytes=20050780B;;;0; memory.usage.bytes=6320981920B;;;0; memory.usage.percent=99.68%;;0.1;0;100
279+
... CRITICAL: memory.usage.percent is 99.68% | memory.free.bytes=20050780B;;;0;6341032700 memory.usage.bytes=6320981920B;;;0;6341032700 memory.usage.percent=99.68%;;0.1;0;100
280280
... 6
281281
... --check-format
282282
... Check format of JSON file '${CURDIR}/generic-snmp/memory-64.json' JSON is valid
283283
... 7
284284
... --warning-memory-free-bytes=1
285-
... WARNING: memory.free.bytes is 20050780B | memory.free.bytes=20050780B;1;;0; memory.usage.bytes=6320981920B;;;0; memory.usage.percent=99.68%;;;0;100
285+
... WARNING: memory.free.bytes is 20050780B | memory.free.bytes=20050780B;1;;0;6341032700 memory.usage.bytes=6320981920B;;;0;6341032700 memory.usage.percent=99.68%;;;0;100
286286
... 8
287287
... --critical-memory-free-bytes=1
288-
... CRITICAL: memory.free.bytes is 20050780B | memory.free.bytes=20050780B;;1;0; memory.usage.bytes=6320981920B;;;0; memory.usage.percent=99.68%;;;0;100
288+
... CRITICAL: memory.free.bytes is 20050780B | memory.free.bytes=20050780B;;1;0;6341032700 memory.usage.bytes=6320981920B;;;0;6341032700 memory.usage.percent=99.68%;;;0;100

tests/os/linux/snmp/swap.robot

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,28 +120,28 @@ cgs-swap ${tc}
120120
... --
121121
... 1
122122
... ${EMPTY}
123-
... OK: Swap Used: 499420B - Free: 500000B - Total: 999420B | swap.free.bytes=500000B;;;0; swap.usage.bytes=499420B;;;0; swap.usage.percent=49.97%;;;0;100
123+
... OK: Swap Used: 499420B - Free: 500000B - Total: 999420B | swap.free.bytes=500000B;;;0;999420 swap.usage.bytes=499420B;;;0;999420 swap.usage.percent=49.97%;;;0;100
124124
... 2
125125
... --warning-swap-bytes=0.1
126-
... WARNING: swap.usage.bytes is 499420B | swap.free.bytes=500000B;;;0; swap.usage.bytes=499420B;0.1;;0; swap.usage.percent=49.97%;;;0;100
126+
... WARNING: swap.usage.bytes is 499420B | swap.free.bytes=500000B;;;0;999420 swap.usage.bytes=499420B;0.1;;0;999420 swap.usage.percent=49.97%;;;0;100
127127
... 3
128128
... --critical-swap-bytes=0.1
129-
... CRITICAL: swap.usage.bytes is 499420B | swap.free.bytes=500000B;;;0; swap.usage.bytes=499420B;;0.1;0; swap.usage.percent=49.97%;;;0;100
129+
... CRITICAL: swap.usage.bytes is 499420B | swap.free.bytes=500000B;;;0;999420 swap.usage.bytes=499420B;;0.1;0;999420 swap.usage.percent=49.97%;;;0;100
130130
... 4
131131
... --warning-swap-prct=0.1
132-
... WARNING: swap.usage.percent is 49.97% | swap.free.bytes=500000B;;;0; swap.usage.bytes=499420B;;;0; swap.usage.percent=49.97%;0.1;;0;100
132+
... WARNING: swap.usage.percent is 49.97% | swap.free.bytes=500000B;;;0;999420 swap.usage.bytes=499420B;;;0;999420 swap.usage.percent=49.97%;0.1;;0;100
133133
... 5
134134
... --critical-swap-prct=0.1
135-
... CRITICAL: swap.usage.percent is 49.97% | swap.free.bytes=500000B;;;0; swap.usage.bytes=499420B;;;0; swap.usage.percent=49.97%;;0.1;0;100
135+
... CRITICAL: swap.usage.percent is 49.97% | swap.free.bytes=500000B;;;0;999420 swap.usage.bytes=499420B;;;0;999420 swap.usage.percent=49.97%;;0.1;0;100
136136
... 6
137137
... --check-format
138138
... Check format of JSON file '${CURDIR}/generic-snmp/swap.json' JSON is valid
139139
... 7
140140
... --warning-swap-free-bytes=1
141-
... WARNING: swap.free.bytes is 500000B | swap.free.bytes=500000B;1;;0; swap.usage.bytes=499420B;;;0; swap.usage.percent=49.97%;;;0;100
141+
... WARNING: swap.free.bytes is 500000B | swap.free.bytes=500000B;1;;0;999420 swap.usage.bytes=499420B;;;0;999420 swap.usage.percent=49.97%;;;0;100
142142
... 8
143143
... --critical-swap-free-bytes=1
144-
... CRITICAL: swap.free.bytes is 500000B | swap.free.bytes=500000B;;1;0; swap.usage.bytes=499420B;;;0; swap.usage.percent=49.97%;;;0;100
144+
... CRITICAL: swap.free.bytes is 500000B | swap.free.bytes=500000B;;1;0;999420 swap.usage.bytes=499420B;;;0;999420 swap.usage.percent=49.97%;;;0;100
145145

146146
cgs-swap-64 ${tc}
147147
[Tags] os linux centreon-generic-snmp
@@ -163,25 +163,25 @@ cgs-swap-64 ${tc}
163163
... --
164164
... 1
165165
... ${EMPTY}
166-
... OK: Swap Used: 499420B - Free: 500000B - Total: 999420B | swap.free.bytes=500000B;;;0; swap.usage.bytes=499420B;;;0; swap.usage.percent=49.97%;;;0;100
166+
... OK: Swap Used: 499420B - Free: 500000B - Total: 999420B | swap.free.bytes=500000B;;;0;999420 swap.usage.bytes=499420B;;;0;999420 swap.usage.percent=49.97%;;;0;100
167167
... 2
168168
... --warning-swap-bytes=0.1
169-
... WARNING: swap.usage.bytes is 499420B | swap.free.bytes=500000B;;;0; swap.usage.bytes=499420B;0.1;;0; swap.usage.percent=49.97%;;;0;100
169+
... WARNING: swap.usage.bytes is 499420B | swap.free.bytes=500000B;;;0;999420 swap.usage.bytes=499420B;0.1;;0;999420 swap.usage.percent=49.97%;;;0;100
170170
... 3
171171
... --critical-swap-bytes=0.1
172-
... CRITICAL: swap.usage.bytes is 499420B | swap.free.bytes=500000B;;;0; swap.usage.bytes=499420B;;0.1;0; swap.usage.percent=49.97%;;;0;100
172+
... CRITICAL: swap.usage.bytes is 499420B | swap.free.bytes=500000B;;;0;999420 swap.usage.bytes=499420B;;0.1;0;999420 swap.usage.percent=49.97%;;;0;100
173173
... 4
174174
... --warning-swap-prct=0.1
175-
... WARNING: swap.usage.percent is 49.97% | swap.free.bytes=500000B;;;0; swap.usage.bytes=499420B;;;0; swap.usage.percent=49.97%;0.1;;0;100
175+
... WARNING: swap.usage.percent is 49.97% | swap.free.bytes=500000B;;;0;999420 swap.usage.bytes=499420B;;;0;999420 swap.usage.percent=49.97%;0.1;;0;100
176176
... 5
177177
... --critical-swap-prct=0.1
178-
... CRITICAL: swap.usage.percent is 49.97% | swap.free.bytes=500000B;;;0; swap.usage.bytes=499420B;;;0; swap.usage.percent=49.97%;;0.1;0;100
178+
... CRITICAL: swap.usage.percent is 49.97% | swap.free.bytes=500000B;;;0;999420 swap.usage.bytes=499420B;;;0;999420 swap.usage.percent=49.97%;;0.1;0;100
179179
... 6
180180
... --check-format
181181
... Check format of JSON file '${CURDIR}/generic-snmp/swap-64.json' JSON is valid
182182
... 7
183183
... --warning-swap-free-bytes=1
184-
... WARNING: swap.free.bytes is 500000B | swap.free.bytes=500000B;1;;0; swap.usage.bytes=499420B;;;0; swap.usage.percent=49.97%;;;0;100
184+
... WARNING: swap.free.bytes is 500000B | swap.free.bytes=500000B;1;;0;999420 swap.usage.bytes=499420B;;;0;999420 swap.usage.percent=49.97%;;;0;100
185185
... 8
186186
... --critical-swap-free-bytes=1
187-
... CRITICAL: swap.free.bytes is 500000B | swap.free.bytes=500000B;;1;0; swap.usage.bytes=499420B;;;0; swap.usage.percent=49.97%;;;0;100
187+
... CRITICAL: swap.free.bytes is 500000B | swap.free.bytes=500000B;;1;0;999420 swap.usage.bytes=499420B;;;0;999420 swap.usage.percent=49.97%;;;0;100

0 commit comments

Comments
 (0)