diff --git a/plugins/zabbix/index.py b/plugins/zabbix/index.py index cba44234d..efd16da6e 100755 --- a/plugins/zabbix/index.py +++ b/plugins/zabbix/index.py @@ -303,6 +303,22 @@ def runLog(): def installPreInspection(): + cmd = "cat /etc/*-release | grep PRETTY_NAME |awk -F = '{print $2}' | awk -F '\"' '{print $2}'| awk '{print $1}'" + sys = mw.execShell(cmd) + + if sys[1] != '': + return '不支持该系统' + + cmd = "cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F '\"' '{print $2}'" + sys_id = mw.execShell(cmd) + + sysName = sys[0].strip().lower() + sysId = sys_id[0].strip() + + if not sysName in ['debain']: + return '不支持该系统' + + openresty_dir = mw.getServerDir() + "/openresty" if not os.path.exists(openresty_dir): return '需要安装Openresty插件' diff --git a/plugins/zabbix_agent/conf/zabbix_agentd/userparameter_examples.conf b/plugins/zabbix_agent/conf/zabbix_agentd/userparameter_examples.conf new file mode 100644 index 000000000..5c0aea987 --- /dev/null +++ b/plugins/zabbix_agent/conf/zabbix_agentd/userparameter_examples.conf @@ -0,0 +1,27 @@ +# 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#,}']}' diff --git a/plugins/zabbix_agent/conf/zabbix_agentd/userparameter_mysql.conf b/plugins/zabbix_agent/conf/zabbix_agentd/userparameter_mysql.conf new file mode 100644 index 000000000..2d6430e29 --- /dev/null +++ b/plugins/zabbix_agent/conf/zabbix_agentd/userparameter_mysql.conf @@ -0,0 +1,15 @@ +#template_db_mysql.conf created by Zabbix for "Template DB MySQL" and Zabbix 4.2 +#For OS Linux: You need create .my.cnf in zabbix-agent home directory (/var/lib/zabbix by default) +#For OS Windows: You need add PATH to mysql and mysqladmin and create my.cnf in %WINDIR%\my.cnf,C:\my.cnf,BASEDIR\my.cnf https://dev.mysql.com/doc/refman/5.7/en/option-files.html +#The file must have three strings: +#[client] +#user=zbx_monitor +#password= +# +UserParameter=mysql.ping[*], mysqladmin -h"$1" -P"$2" ping +UserParameter=mysql.get_status_variables[*], mysql -h"$1" -P"$2" -sNX -e "show global status" +UserParameter=mysql.version[*], mysqladmin -s -h"$1" -P"$2" version +UserParameter=mysql.db.discovery[*], mysql -h"$1" -P"$2" -sN -e "show databases" +UserParameter=mysql.dbsize[*], mysql -h"$1" -P"$2" -sN -e "SELECT SUM(DATA_LENGTH + INDEX_LENGTH) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='$3'" +UserParameter=mysql.replication.discovery[*], mysql -h"$1" -P"$2" -sNX -e "show slave status" +UserParameter=mysql.slave_status[*], mysql -h"$1" -P"$2" -sNX -e "show slave status" diff --git a/plugins/zabbix_agent/ico.svg b/plugins/zabbix_agent/ico.svg deleted file mode 100644 index 9425964a3..000000000 --- a/plugins/zabbix_agent/ico.svg +++ /dev/null @@ -1 +0,0 @@ -