pull/618/head
Mr Chen 10 months ago
parent a10f31f4fb
commit 1ff24a2835
  1. 16
      plugins/zabbix/index.py
  2. 27
      plugins/zabbix_agent/conf/zabbix_agentd/userparameter_examples.conf
  3. 15
      plugins/zabbix_agent/conf/zabbix_agentd/userparameter_mysql.conf
  4. 1
      plugins/zabbix_agent/ico.svg

@ -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插件'

@ -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#,}']}'

@ -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=<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"

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="#d40000" d="M0 0h24v24H0z"/><path fill="#fff" stroke="#fff" stroke-width=".2" d="M21.099 18.887v1.455H3.645v-.963l13.921-14.31H4.372V3.615h16v1.136L6.388 18.887z"/></svg>

Before

Width:  |  Height:  |  Size: 246 B

Loading…
Cancel
Save