You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zabbix/conf/zabbix_agentd/userparameter_examples.conf

28 lines
1.3 KiB

1 year ago
# Emulating built-in agent parameter 'system.users.num'
UserParameter=system.test,who | wc -l
# Get size of a directory
# Defaults to /tmp
UserParameter=vfs.dir.size[*],dir="$1"; du -s -B 1 "${dir:-/tmp}" | cut -f1
# Total CPU utilisation by all processes with a given name.
# Returns empty value if no such processes are present, numeric items will turn unsupported
# Defaults to zabbix_agentd
UserParameter=proc.cpu[*],proc="$1"; ps -o pcpu= -C "${proc:-zabbix_agentd}" | awk '{sum += $$1} END {print sum}'
# Mail queue length from mailq
UserParameter=unix_mail.queue,mailq | grep -v "Mail queue is empty" | grep -c '^[0-9A-Z]'
# Partition discovery on Linux
UserParameter=vfs.partitions.discovery.linux,for partition in $(awk 'NR > 2 {print $4}' /proc/partitions); do partitionlist="$partitionlist,"'{"{#PARTITION}":"'$partition'"}'; done; echo '{"data":['${partitionlist#,}']}'
# Partition discovery on Solaris (using iostat output)
# On Solaris bash usually is not the one linked from /bin/sh, so a wrapper script is suggested
UserParameter=vfs.partitions.discovery.solaris,/somewhere/solaris_partitions.sh
# Wrapper script (solaris_partitions.sh) contents:
##!/bin/bash
#for partition in $(iostat -x | tail +3 | awk '{print $1}'); do
# partitionlist="$partitionlist,"'{"{#PARTITION}":"'$partition'"}'
#done
#echo '{"data":['${partitionlist#,}']}'