Skip to content
Snippets Groups Projects
Commit 8aa4598d authored by jurgenhaas's avatar jurgenhaas
Browse files

ansible-inventories/knime#110 Make Zabbix agent configurable

parent 039b79c9
Branches
No related tags found
No related merge requests found
zabbix_agent_url: 'http://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-1+xenial_all.deb' zabbix_agent_url: 'http://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-1+xenial_all.deb'
zabbix_agent_logfile_size: 0
zabbix_agent_server: '127.0.0.1'
zabbix_agent_server_active: '127.0.0.1'
zabbix_agent_hostname: 'Zabbix server'
zabbix_agent_userparameter:
mysql:
- mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}'
- mysql.size[*],bash -c 'echo "select sum($(case "$3" in both|"") echo "data_length+index_length";; data|index) echo "$3_length";; free) echo "data_free";; esac)) from information_schema.tables$([[ "$1" = "all" || ! "$1" ]] || echo " where table_schema=\"$1\"")$([[ "$2" = "all" || ! "$2" ]] || echo "and table_name=\"$2\"");" | HOME=/var/lib/zabbix mysql -N'
- mysql.ping,HOME=/var/lib/zabbix mysqladmin ping | grep -c alive
- mysql.version,mysql -V
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
src: 'zabbix_agentd.conf' src: 'zabbix_agentd.conf'
dest: '/etc/zabbix/zabbix_agentd.conf' dest: '/etc/zabbix/zabbix_agentd.conf'
- name: "Agent User Config: MySQL" - name: "Agent User Config"
template: template:
src: 'userparameter_mysql.conf' src: 'userparameter.conf'
dest: '/etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf' dest: '/etc/zabbix/zabbix_agentd.d/userparameter_{{ item }}.conf'
when: groups['dbserver-mysql'] is defined and inventory_hostname in groups['dbserver-mysql'] with_items: '{{ zabbix_agent_userparameter }}'
{% for line in zabbix_agent_userparameter[item] %}
UserParameter={{ line }}
{% endfor %}
# For all the following commands HOME should be set to the directory that has .my.cnf file with password information.
# Flexible parameter to grab global variables. On the frontend side, use keys like mysql.status[Com_insert].
# Key syntax is mysql.status[variable].
UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}'
# Flexible parameter to determine database or table size. On the frontend side, use keys like mysql.size[zabbix,history,data].
# Key syntax is mysql.size[<database>,<table>,<type>].
# Database may be a database name or "all". Default is "all".
# Table may be a table name or "all". Default is "all".
# Type may be "data", "index", "free" or "both". Both is a sum of data and index. Default is "both".
# Database is mandatory if a table is specified. Type may be specified always.
# Returns value in bytes.
# 'sum' on data_length or index_length alone needed when we are getting this information for whole database instead of a single table
UserParameter=mysql.size[*],bash -c 'echo "select sum($(case "$3" in both|"") echo "data_length+index_length";; data|index) echo "$3_length";; free) echo "data_free";; esac)) from information_schema.tables$([[ "$1" = "all" || ! "$1" ]] || echo " where table_schema=\"$1\"")$([[ "$2" = "all" || ! "$2" ]] || echo "and table_name=\"$2\"");" | HOME=/var/lib/zabbix mysql -N'
UserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin ping | grep -c alive
UserParameter=mysql.version,mysql -V
...@@ -40,7 +40,7 @@ LogFile=/var/log/zabbix/zabbix_agentd.log ...@@ -40,7 +40,7 @@ LogFile=/var/log/zabbix/zabbix_agentd.log
# Default: # Default:
# LogFileSize=1 # LogFileSize=1
LogFileSize=0 LogFileSize={{ zabbix_agent_logfile_size }}
### Option: DebugLevel ### Option: DebugLevel
# Specifies debug level: # Specifies debug level:
...@@ -92,7 +92,7 @@ LogFileSize=0 ...@@ -92,7 +92,7 @@ LogFileSize=0
# Default: # Default:
# Server= # Server=
Server=127.0.0.1 Server={{ zabbix_agent_server }}
### Option: ListenPort ### Option: ListenPort
# Agent will listen on this port for connections from the server. # Agent will listen on this port for connections from the server.
...@@ -133,7 +133,9 @@ Server=127.0.0.1 ...@@ -133,7 +133,9 @@ Server=127.0.0.1
# Default: # Default:
# ServerActive= # ServerActive=
ServerActive=127.0.0.1 {% if zabbix_agent_server_active != '' %}
ServerActive={{ zabbix_agent_server_active }}
{% endif %}
### Option: Hostname ### Option: Hostname
# Unique, case sensitive hostname. # Unique, case sensitive hostname.
...@@ -144,7 +146,9 @@ ServerActive=127.0.0.1 ...@@ -144,7 +146,9 @@ ServerActive=127.0.0.1
# Default: # Default:
# Hostname= # Hostname=
Hostname=Zabbix server {% if zabbix_agent_server_active != '' %}
Hostname={{ zabbix_agent_hostname }}
{% endif %}
### Option: HostnameItem ### Option: HostnameItem
# Item used for generating Hostname if it is undefined. Ignored if Hostname is defined. # Item used for generating Hostname if it is undefined. Ignored if Hostname is defined.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment