Post Syndicated from Arturs Lontons original https://blog.zabbix.com/handy-tips-34-creating-context-sensitive-problem-thresholds-with-zabbix-user-macros/22281/
Provide context and define custom problem thresholds by using Zabbix user macros.
Problem thresholds can vary for the same metric on different monitoring endpoints. We can have a server where having 10% of free space is perfectly fine, and a server where anything below 20% is a cause for concern.
Define Zabbix user macros with context:
- Override the default macro value with a context-specific value
- Add flexibility by using context macros as problem thresholds
- Define a default value that will be used if a matching context is not found
- Any low-level discovery macro value can be used as the context
Check out the video to learn how to define and use user macros with context:
How to define macros with context:
- Navigate to Configuration → Hosts
- Click on the Discovery button next to your host
- Press the Create discovery rule button
- We will use the net.if.discovery key to discover network interfaces
- Add the discovery rule
- Press the Item prototypes button
- Press the Create item prototype button
- We will use the net.if.in[“{#IFNAME}”] item key
- Add the Change per second and Custom multiplier:8 preprocessing steps
- Add the item prototype
- Press the trigger prototypes button
- Press the Create trigger prototype button
- Create a trigger prototype: avg(/Linux server/net.if.in[“{#IFNAME}”],1m)>{$IF.BAND.MAX:”{#IFNAME}”}
- Add the trigger prototype
- Click on the host and navigate to the Macros section
- Create macros with context
- Provide context for interface names: {$IF.BAND.MAX:”enp0s3″}
- Press the Update button
- Simulate a problem and check if context is taken into account
Tips and best practices
- Macro context can be matched with static text or a regular expression
- Only low-level discovery macros are supported in the context
- Simple context macros are matched before matching context macros that contain regular expressions
- Macro context must be quoted with ” if the context contains a } character or starts with a ” character
Learn how to get the most out of your low-level discovery rules to create smart and flexible items, triggers, and hosts by registering for the Zabbix Certified Professional course. During the course, you will learn how to enhance your low-level discovery workflows by using overrides, filters, macro context, and receive hands-on practical experience in creating fully custom low-level discovery rules from scratch.
The post Handy Tips #34: Creating context-sensitive problem thresholds with Zabbix user macros appeared first on Zabbix Blog.