Hello,
After successful update of the agents and zabbix server from 3.4 up to 4.0 I was really happy, but unfortunately I didn't notice in time that some of the scripts will need to be re-worked. In this case I need assistance on how to deal with the postfix collection script, here is what Zabbix web says "Value "/etc/zabbix/zabbix_agentd.scripts/postfix: line 48: logtail: command not found
0" of type "string" is not suitable for value type "Numeric (unsigned)"" and here is the script itself:
In this case i know that some changes need to be made, from the example in the documentation it was "$1" to be changed to "#FSNAME", but I didn't quite understand it. Could anyone simply inform me what needs to be changed here exactly and with what, so that I can afterwards work on all of the rest scripts/templates that the server is currently using I will be very thankful.
Ho ho ho Happy Holidays.
After successful update of the agents and zabbix server from 3.4 up to 4.0 I was really happy, but unfortunately I didn't notice in time that some of the scripts will need to be re-worked. In this case I need assistance on how to deal with the postfix collection script, here is what Zabbix web says "Value "/etc/zabbix/zabbix_agentd.scripts/postfix: line 48: logtail: command not found
0" of type "string" is not suitable for value type "Numeric (unsigned)"" and here is the script itself:
Code:
module=$1
item=$2
function usage(){
name=$(basename $0)
echo "Postfix collect script for zabbix - http://www.netkiller.cn"
echo "${name} <module> <item>"
echo "<queue> <active|deferred>"
echo "<status> <active|deferred|sent|bounced|expired>"
echo "<log> <active|deferred|sent|bounced|expired|string>"
echo "<code> <200|550|421|......>"
exit
}
if [ -z ${module} ]; then
usage
fi
if [ ${module} == "discovery" ]; then
echo '{"data":[{"{#CODE}":"200"},{"{#CODE}":"211"},{"{#CODE}":"214"},{"{#CODE}":"220"},{"{#CODE}":"221"},{"{#CODE}":"250"},{"{#CODE}":"251"},{"{#CODE}":"252"},{"{#CODE}":"354"},{"{#CODE}":"421"},{"{#CODE}":"450"},{"{#CODE}":"451"},{"{#CODE}":"452"},{"{#CODE}":"50$
exit
else
if [ -z ${item} ]; then
usage
fi
fi
if [ ${module} == "queue" ]; then
if [ ${item} == "active" ]; then
postqueue -p | egrep -c "^[0-9A-F]{10}[*]"
fi
if [ ${item} == "deferred" ]; then
postqueue -p | egrep -c "^[0-9A-F]{10}[^*]"
fi
elif [ ${module} == "status" ]; then
status=("active" "deferred" "sent" "bounced" "expired")
for val in ${status[@]}; do
if [ $val == $item ]; then
logtail -f /var/log/maillog -o /var/tmp/postfix.${item}.logtail | grep -c "postfix/smtp.*status=${item}"
fi
done
elif [ ${module} == "log" ]; then
if [ ${item} == "timeout" ]; then
logtail -f /var/log/maillog -o /var/tmp/postfix.timeout.logtail | grep -c "postfix/smtp.* Connection timed out"
elif [ ${item} == "unreachable" ]; then
logtail -f /var/log/maillog -o /var/tmp/postfix.unreachable.logtail | grep -c "Network is unreachable"
elif [ ${item} == "refused" ]; then
logtail -f /var/log/maillog -o /var/tmp/postfix.refused.logtail | grep -c "Connection refused"
fi
elif [ ${module} == "code" ]; then
logtail -f /var/log/maillog -o /var/tmp/postfix.${item}.logtail | grep -c "said: ${item} "
else
usage
fi
Ho ho ho Happy Holidays.
Comment