Hi, some of our Linux servers are configured to heavily swap unused memory do get free memory for disk cache.
as a result I often see memory situations like this:
so free swap is less than 25% but lot of memory is available. so swap-in of all data is always possible. which means we often have Alerts about High swap usage by zabbix. I suggest this small patch:
--- linux-template.orig 2023-08-24 16:54:31.439127713 +0000
+++ linux-template.new 2023-08-24 16:54:53.458292768 +0000
@@ -479,6 +479,17 @@
value: memory
- tag: component
value: storage
+ - uuid: 2e4e665e1b664d889ad690692e031aba
+ name: 'Linux: Used swap space'
+ key: 'system.swap.size[,used]'
+ history: 7d
+ units: B
+ description: 'The used space of the swap volume/file expressed in bytes.'
+ tags:
+ - tag: component
+ value: memory
+ - tag: component
+ value: storage
- uuid: fc6898682f904c57ba28bcb3748b237f
name: 'Linux: System description'
key: system.uname
@@ -1921,12 +1932,14 @@
- tag: scope
value: performance
- uuid: f49fc01c5ac945d59455563bdbcc6469
- expression: 'max(/Linux by Zabbix agent/system.swap.size[,pfree],5m)<{$SWAP.PFREE.MIN.WARN} and last(/Linux by Zabbix agent/system.swap.size[,total])>0'
+ expression: 'max(/Linux by Zabbix agent/system.swap.size[,pfree],5m)<{$SWAP.PFREE.MIN.WARN} and last(/Linux by Zabbix agent/system.swap.size[,total])>0 and last(/Linux by Zabbix agent/system.swap.size[,used]) > last(/Linux by Zabbix agent/vm.memory.size[available])'
name: 'Linux: High swap space usage'
- event_name: 'Linux: High swap space usage (less than {$SWAP.PFREE.MIN.WARN}% free)'
+ event_name: 'Linux: High swap space usage (less than {$SWAP.PFREE.MIN.WARN}% free) and available memory lower than used swap space'
opdata: 'Free: {ITEM.LASTVALUE1}, total: {ITEM.LASTVALUE2}'
priority: WARNING
- description: 'If there is no swap configured, this trigger is ignored.'
+ description: |
+ If there is no swap configured, this trigger is ignored.
+ Do not trigger as long as enough memory is available
dependencies:
- name: 'Linux: High memory utilization'
expression: 'min(/Linux by Zabbix agent/vm.memory.utilization,5m)>{$MEMORY.UTIL.MAX}'
explanation:
1. Polling also Used Swapspace
2. only Trigger "High Swap usage" if available memory is less than used swap.
BR. Jörg
as a result I often see memory situations like this:
so free swap is less than 25% but lot of memory is available. so swap-in of all data is always possible. which means we often have Alerts about High swap usage by zabbix. I suggest this small patch:
--- linux-template.orig 2023-08-24 16:54:31.439127713 +0000
+++ linux-template.new 2023-08-24 16:54:53.458292768 +0000
@@ -479,6 +479,17 @@
value: memory
- tag: component
value: storage
+ - uuid: 2e4e665e1b664d889ad690692e031aba
+ name: 'Linux: Used swap space'
+ key: 'system.swap.size[,used]'
+ history: 7d
+ units: B
+ description: 'The used space of the swap volume/file expressed in bytes.'
+ tags:
+ - tag: component
+ value: memory
+ - tag: component
+ value: storage
- uuid: fc6898682f904c57ba28bcb3748b237f
name: 'Linux: System description'
key: system.uname
@@ -1921,12 +1932,14 @@
- tag: scope
value: performance
- uuid: f49fc01c5ac945d59455563bdbcc6469
- expression: 'max(/Linux by Zabbix agent/system.swap.size[,pfree],5m)<{$SWAP.PFREE.MIN.WARN} and last(/Linux by Zabbix agent/system.swap.size[,total])>0'
+ expression: 'max(/Linux by Zabbix agent/system.swap.size[,pfree],5m)<{$SWAP.PFREE.MIN.WARN} and last(/Linux by Zabbix agent/system.swap.size[,total])>0 and last(/Linux by Zabbix agent/system.swap.size[,used]) > last(/Linux by Zabbix agent/vm.memory.size[available])'
name: 'Linux: High swap space usage'
- event_name: 'Linux: High swap space usage (less than {$SWAP.PFREE.MIN.WARN}% free)'
+ event_name: 'Linux: High swap space usage (less than {$SWAP.PFREE.MIN.WARN}% free) and available memory lower than used swap space'
opdata: 'Free: {ITEM.LASTVALUE1}, total: {ITEM.LASTVALUE2}'
priority: WARNING
- description: 'If there is no swap configured, this trigger is ignored.'
+ description: |
+ If there is no swap configured, this trigger is ignored.
+ Do not trigger as long as enough memory is available
dependencies:
- name: 'Linux: High memory utilization'
expression: 'min(/Linux by Zabbix agent/vm.memory.utilization,5m)>{$MEMORY.UTIL.MAX}'
explanation:
1. Polling also Used Swapspace
2. only Trigger "High Swap usage" if available memory is less than used swap.
BR. Jörg
Comment