Add docker test environment for Zabbix 6.0
This commit is contained in:
1
devenv/README.md
Normal file
1
devenv/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Development environment for the plugin
|
||||||
17
devenv/zabbix60/bootstrap/Dockerfile
Normal file
17
devenv/zabbix60/bootstrap/Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
FROM python:2.7
|
||||||
|
|
||||||
|
ENV ZBX_API_URL=http://zabbix-web:8080
|
||||||
|
ENV ZBX_API_USER="Admin"
|
||||||
|
ENV ZBX_API_PASSWORD="zabbix"
|
||||||
|
ENV ZBX_CONFIG="zbx_export_hosts.xml"
|
||||||
|
ENV ZBX_BOOTSTRAP_SCRIPT="bootstrap_config.py"
|
||||||
|
|
||||||
|
RUN pip install pyzabbix
|
||||||
|
|
||||||
|
ADD ./bootstrap_config.py /bootstrap_config.py
|
||||||
|
ADD ${ZBX_CONFIG} /${ZBX_CONFIG}
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
|
# Run bootstrap_config.py when the container launches
|
||||||
|
CMD ["python", "/bootstrap_config.py"]
|
||||||
80
devenv/zabbix60/bootstrap/bootstrap_config.py
Normal file
80
devenv/zabbix60/bootstrap/bootstrap_config.py
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
import os
|
||||||
|
from time import sleep
|
||||||
|
from pyzabbix import ZabbixAPI, ZabbixAPIException
|
||||||
|
|
||||||
|
zabbix_url = os.environ['ZBX_API_URL']
|
||||||
|
zabbix_user = os.environ['ZBX_API_USER']
|
||||||
|
zabbix_password = os.environ['ZBX_API_PASSWORD']
|
||||||
|
print(zabbix_url, zabbix_user, zabbix_password)
|
||||||
|
|
||||||
|
zapi = ZabbixAPI(zabbix_url, timeout=5)
|
||||||
|
|
||||||
|
for i in range(10):
|
||||||
|
print("Trying to connected to Zabbix API %s" % zabbix_url)
|
||||||
|
try:
|
||||||
|
zapi.login(zabbix_user, zabbix_password)
|
||||||
|
print("Connected to Zabbix API Version %s" % zapi.api_version())
|
||||||
|
break
|
||||||
|
except ZabbixAPIException as e:
|
||||||
|
print e
|
||||||
|
sleep(5)
|
||||||
|
except:
|
||||||
|
print("Waiting")
|
||||||
|
sleep(5)
|
||||||
|
|
||||||
|
|
||||||
|
config_path = os.environ['ZBX_CONFIG']
|
||||||
|
import_rules = {
|
||||||
|
'discoveryRules': {
|
||||||
|
'createMissing': True,
|
||||||
|
'updateExisting': True
|
||||||
|
},
|
||||||
|
'graphs': {
|
||||||
|
'createMissing': True,
|
||||||
|
'updateExisting': True
|
||||||
|
},
|
||||||
|
'groups': {
|
||||||
|
'createMissing': True
|
||||||
|
},
|
||||||
|
'hosts': {
|
||||||
|
'createMissing': True,
|
||||||
|
'updateExisting': True
|
||||||
|
},
|
||||||
|
'images': {
|
||||||
|
'createMissing': True,
|
||||||
|
'updateExisting': True
|
||||||
|
},
|
||||||
|
'items': {
|
||||||
|
'createMissing': True,
|
||||||
|
'updateExisting': True
|
||||||
|
},
|
||||||
|
'maps': {
|
||||||
|
'createMissing': True,
|
||||||
|
'updateExisting': True
|
||||||
|
},
|
||||||
|
'templateLinkage': {
|
||||||
|
'createMissing': True,
|
||||||
|
},
|
||||||
|
'templates': {
|
||||||
|
'createMissing': True,
|
||||||
|
'updateExisting': True
|
||||||
|
},
|
||||||
|
'triggers': {
|
||||||
|
'createMissing': True,
|
||||||
|
'updateExisting': True
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
print("Importing Zabbix config from %s" % config_path)
|
||||||
|
with open(config_path, 'r') as f:
|
||||||
|
config = f.read()
|
||||||
|
|
||||||
|
try:
|
||||||
|
# https://github.com/lukecyca/pyzabbix/issues/62
|
||||||
|
import_result = zapi.confimport("xml", config, import_rules)
|
||||||
|
print(import_result)
|
||||||
|
except ZabbixAPIException as e:
|
||||||
|
print e
|
||||||
|
|
||||||
|
for h in zapi.host.get(output="extend"):
|
||||||
|
print(h['name'])
|
||||||
432
devenv/zabbix60/bootstrap/zbx_export_hosts.xml
Normal file
432
devenv/zabbix60/bootstrap/zbx_export_hosts.xml
Normal file
@@ -0,0 +1,432 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<zabbix_export>
|
||||||
|
<version>6.0</version>
|
||||||
|
<date>2022-04-28T13:04:18Z</date>
|
||||||
|
<groups>
|
||||||
|
<group>
|
||||||
|
<uuid>2e427c268ac1468b9add94b65e2d6c14</uuid>
|
||||||
|
<name>Backend</name>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<uuid>d97ba66b283544339628b71975a6e68d</uuid>
|
||||||
|
<name>Frontend</name>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<uuid>dc579cd7a1a34222933f24f52a68bcd8</uuid>
|
||||||
|
<name>Linux servers</name>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<uuid>6f6799aa69e844b4b3918f779f2abf08</uuid>
|
||||||
|
<name>Zabbix servers</name>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<uuid>7df96b18c230490a9a0a9e2307226338</uuid>
|
||||||
|
<name>Templates</name>
|
||||||
|
</group>
|
||||||
|
</groups>
|
||||||
|
<hosts>
|
||||||
|
<host>
|
||||||
|
<host>backend01</host>
|
||||||
|
<name>backend01</name>
|
||||||
|
<templates>
|
||||||
|
<template>
|
||||||
|
<name>Template ZAS Agent</name>
|
||||||
|
</template>
|
||||||
|
</templates>
|
||||||
|
<groups>
|
||||||
|
<group>
|
||||||
|
<name>Backend</name>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<name>Linux servers</name>
|
||||||
|
</group>
|
||||||
|
</groups>
|
||||||
|
<interfaces>
|
||||||
|
<interface>
|
||||||
|
<useip>NO</useip>
|
||||||
|
<dns>zas_backend_01</dns>
|
||||||
|
<interface_ref>if1</interface_ref>
|
||||||
|
</interface>
|
||||||
|
</interfaces>
|
||||||
|
<tags>
|
||||||
|
<tag>
|
||||||
|
<tag>backend</tag>
|
||||||
|
</tag>
|
||||||
|
<tag>
|
||||||
|
<tag>service</tag>
|
||||||
|
<value>backend</value>
|
||||||
|
</tag>
|
||||||
|
</tags>
|
||||||
|
<inventory_mode>DISABLED</inventory_mode>
|
||||||
|
</host>
|
||||||
|
<host>
|
||||||
|
<host>backend02</host>
|
||||||
|
<name>backend02</name>
|
||||||
|
<templates>
|
||||||
|
<template>
|
||||||
|
<name>Template ZAS Agent</name>
|
||||||
|
</template>
|
||||||
|
</templates>
|
||||||
|
<groups>
|
||||||
|
<group>
|
||||||
|
<name>Backend</name>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<name>Linux servers</name>
|
||||||
|
</group>
|
||||||
|
</groups>
|
||||||
|
<interfaces>
|
||||||
|
<interface>
|
||||||
|
<useip>NO</useip>
|
||||||
|
<dns>zas_backend_02</dns>
|
||||||
|
<interface_ref>if1</interface_ref>
|
||||||
|
</interface>
|
||||||
|
</interfaces>
|
||||||
|
<tags>
|
||||||
|
<tag>
|
||||||
|
<tag>backend</tag>
|
||||||
|
</tag>
|
||||||
|
<tag>
|
||||||
|
<tag>service</tag>
|
||||||
|
<value>backend</value>
|
||||||
|
</tag>
|
||||||
|
</tags>
|
||||||
|
<inventory_mode>DISABLED</inventory_mode>
|
||||||
|
</host>
|
||||||
|
<host>
|
||||||
|
<host>frontend01</host>
|
||||||
|
<name>frontend01</name>
|
||||||
|
<templates>
|
||||||
|
<template>
|
||||||
|
<name>Template ZAS Agent</name>
|
||||||
|
</template>
|
||||||
|
</templates>
|
||||||
|
<groups>
|
||||||
|
<group>
|
||||||
|
<name>Frontend</name>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<name>Linux servers</name>
|
||||||
|
</group>
|
||||||
|
</groups>
|
||||||
|
<interfaces>
|
||||||
|
<interface>
|
||||||
|
<useip>NO</useip>
|
||||||
|
<dns>zas_frontend_01</dns>
|
||||||
|
<interface_ref>if1</interface_ref>
|
||||||
|
</interface>
|
||||||
|
</interfaces>
|
||||||
|
<tags>
|
||||||
|
<tag>
|
||||||
|
<tag>frontend</tag>
|
||||||
|
</tag>
|
||||||
|
<tag>
|
||||||
|
<tag>service</tag>
|
||||||
|
<value>frontend</value>
|
||||||
|
</tag>
|
||||||
|
</tags>
|
||||||
|
<inventory_mode>DISABLED</inventory_mode>
|
||||||
|
</host>
|
||||||
|
<host>
|
||||||
|
<host>frontend02</host>
|
||||||
|
<name>frontend02</name>
|
||||||
|
<templates>
|
||||||
|
<template>
|
||||||
|
<name>Template ZAS Agent</name>
|
||||||
|
</template>
|
||||||
|
</templates>
|
||||||
|
<groups>
|
||||||
|
<group>
|
||||||
|
<name>Frontend</name>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<name>Linux servers</name>
|
||||||
|
</group>
|
||||||
|
</groups>
|
||||||
|
<interfaces>
|
||||||
|
<interface>
|
||||||
|
<useip>NO</useip>
|
||||||
|
<dns>zas_frontend_02</dns>
|
||||||
|
<interface_ref>if1</interface_ref>
|
||||||
|
</interface>
|
||||||
|
</interfaces>
|
||||||
|
<tags>
|
||||||
|
<tag>
|
||||||
|
<tag>frontend</tag>
|
||||||
|
</tag>
|
||||||
|
<tag>
|
||||||
|
<tag>service</tag>
|
||||||
|
<value>frontend</value>
|
||||||
|
</tag>
|
||||||
|
</tags>
|
||||||
|
<inventory_mode>DISABLED</inventory_mode>
|
||||||
|
</host>
|
||||||
|
<host>
|
||||||
|
<host>Zabbix server</host>
|
||||||
|
<name>Zabbix server</name>
|
||||||
|
<templates>
|
||||||
|
<template>
|
||||||
|
<name>Linux by Zabbix agent</name>
|
||||||
|
</template>
|
||||||
|
<template>
|
||||||
|
<name>Zabbix server health</name>
|
||||||
|
</template>
|
||||||
|
</templates>
|
||||||
|
<groups>
|
||||||
|
<group>
|
||||||
|
<name>Zabbix servers</name>
|
||||||
|
</group>
|
||||||
|
</groups>
|
||||||
|
<interfaces>
|
||||||
|
<interface>
|
||||||
|
<useip>NO</useip>
|
||||||
|
<dns>zabbix-agent</dns>
|
||||||
|
<interface_ref>if1</interface_ref>
|
||||||
|
</interface>
|
||||||
|
</interfaces>
|
||||||
|
<inventory_mode>DISABLED</inventory_mode>
|
||||||
|
</host>
|
||||||
|
</hosts>
|
||||||
|
<templates>
|
||||||
|
<template>
|
||||||
|
<uuid>2d7a65bb369c48199361913b223b1695</uuid>
|
||||||
|
<template>Template ZAS Agent</template>
|
||||||
|
<name>Template ZAS Agent</name>
|
||||||
|
<templates>
|
||||||
|
<template>
|
||||||
|
<name>Zabbix agent</name>
|
||||||
|
</template>
|
||||||
|
</templates>
|
||||||
|
<groups>
|
||||||
|
<group>
|
||||||
|
<name>Templates</name>
|
||||||
|
</group>
|
||||||
|
</groups>
|
||||||
|
<items>
|
||||||
|
<item>
|
||||||
|
<uuid>e79d4215ec014b74923b905bb8f82410</uuid>
|
||||||
|
<name>Incoming network traffic on eth0</name>
|
||||||
|
<key>net.if.in[eth0]</key>
|
||||||
|
<history>1d</history>
|
||||||
|
<units>bps</units>
|
||||||
|
<request_method>POST</request_method>
|
||||||
|
<tags>
|
||||||
|
<tag>
|
||||||
|
<tag>Application</tag>
|
||||||
|
<value>Network interfaces</value>
|
||||||
|
</tag>
|
||||||
|
</tags>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<uuid>18b377dae9fe48d093c16ee7a7c93320</uuid>
|
||||||
|
<name>Outgoing network traffic on eth0</name>
|
||||||
|
<key>net.if.out[eth0]</key>
|
||||||
|
<history>1d</history>
|
||||||
|
<units>bps</units>
|
||||||
|
<request_method>POST</request_method>
|
||||||
|
<tags>
|
||||||
|
<tag>
|
||||||
|
<tag>Application</tag>
|
||||||
|
<value>Network interfaces</value>
|
||||||
|
</tag>
|
||||||
|
</tags>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<uuid>2479e055e91c476f9be93b5f363cfa2f</uuid>
|
||||||
|
<name>Processor load (1 min average per core)</name>
|
||||||
|
<key>system.cpu.load[percpu,avg1]</key>
|
||||||
|
<history>1d</history>
|
||||||
|
<value_type>FLOAT</value_type>
|
||||||
|
<description>The processor load is calculated as system CPU load divided by number of CPU cores.</description>
|
||||||
|
<request_method>POST</request_method>
|
||||||
|
<tags>
|
||||||
|
<tag>
|
||||||
|
<tag>Application</tag>
|
||||||
|
<value>CPU</value>
|
||||||
|
</tag>
|
||||||
|
<tag>
|
||||||
|
<tag>Application</tag>
|
||||||
|
<value>Performance</value>
|
||||||
|
</tag>
|
||||||
|
</tags>
|
||||||
|
<triggers>
|
||||||
|
<trigger>
|
||||||
|
<uuid>60e5484b60ca4061b21bd23f8364bd6e</uuid>
|
||||||
|
<expression>last(/Template ZAS Agent/system.cpu.load[percpu,avg1])>2</expression>
|
||||||
|
<name>Processor load is too high on {HOST.NAME}</name>
|
||||||
|
<priority>WARNING</priority>
|
||||||
|
<tags>
|
||||||
|
<tag>
|
||||||
|
<tag>app</tag>
|
||||||
|
<value>performance</value>
|
||||||
|
</tag>
|
||||||
|
<tag>
|
||||||
|
<tag>type</tag>
|
||||||
|
<value>cpu</value>
|
||||||
|
</tag>
|
||||||
|
</tags>
|
||||||
|
</trigger>
|
||||||
|
</triggers>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<uuid>f0dd4221793c49889cf2789806afa597</uuid>
|
||||||
|
<name>Processor load (15 min average per core)</name>
|
||||||
|
<key>system.cpu.load[percpu,avg15]</key>
|
||||||
|
<history>1d</history>
|
||||||
|
<value_type>FLOAT</value_type>
|
||||||
|
<description>The processor load is calculated as system CPU load divided by number of CPU cores.</description>
|
||||||
|
<request_method>POST</request_method>
|
||||||
|
<tags>
|
||||||
|
<tag>
|
||||||
|
<tag>Application</tag>
|
||||||
|
<value>CPU</value>
|
||||||
|
</tag>
|
||||||
|
<tag>
|
||||||
|
<tag>Application</tag>
|
||||||
|
<value>Performance</value>
|
||||||
|
</tag>
|
||||||
|
</tags>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<uuid>9a8b4a1f173b4f209723d820dc2e054a</uuid>
|
||||||
|
<name>CPU $2 time</name>
|
||||||
|
<key>system.cpu.util[,iowait]</key>
|
||||||
|
<history>1d</history>
|
||||||
|
<value_type>FLOAT</value_type>
|
||||||
|
<units>%</units>
|
||||||
|
<description>Amount of time the CPU has been waiting for I/O to complete.</description>
|
||||||
|
<request_method>POST</request_method>
|
||||||
|
<tags>
|
||||||
|
<tag>
|
||||||
|
<tag>Application</tag>
|
||||||
|
<value>CPU</value>
|
||||||
|
</tag>
|
||||||
|
<tag>
|
||||||
|
<tag>Application</tag>
|
||||||
|
<value>Performance</value>
|
||||||
|
</tag>
|
||||||
|
</tags>
|
||||||
|
<triggers>
|
||||||
|
<trigger>
|
||||||
|
<uuid>ceb468b9eb434fa6bd4c8a5d7507fd87</uuid>
|
||||||
|
<expression>avg(/Template ZAS Agent/system.cpu.util[,iowait],5m)>20</expression>
|
||||||
|
<name>Disk I/O is overloaded on {HOST.NAME}</name>
|
||||||
|
<priority>WARNING</priority>
|
||||||
|
<description>OS spends significant time waiting for I/O (input/output) operations. It could be indicator of performance issues with storage system.</description>
|
||||||
|
<tags>
|
||||||
|
<tag>
|
||||||
|
<tag>disk</tag>
|
||||||
|
</tag>
|
||||||
|
<tag>
|
||||||
|
<tag>type</tag>
|
||||||
|
<value>disk</value>
|
||||||
|
</tag>
|
||||||
|
</tags>
|
||||||
|
</trigger>
|
||||||
|
</triggers>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<uuid>e6d19d47cf60452ead1e791da2d5c0dc</uuid>
|
||||||
|
<name>CPU $2 time</name>
|
||||||
|
<key>system.cpu.util[,system]</key>
|
||||||
|
<history>1d</history>
|
||||||
|
<value_type>FLOAT</value_type>
|
||||||
|
<units>%</units>
|
||||||
|
<description>The time the CPU has spent running the kernel and its processes.</description>
|
||||||
|
<request_method>POST</request_method>
|
||||||
|
<tags>
|
||||||
|
<tag>
|
||||||
|
<tag>Application</tag>
|
||||||
|
<value>CPU</value>
|
||||||
|
</tag>
|
||||||
|
<tag>
|
||||||
|
<tag>Application</tag>
|
||||||
|
<value>Performance</value>
|
||||||
|
</tag>
|
||||||
|
</tags>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<uuid>2d81fbc139774306959712a627c99b9a</uuid>
|
||||||
|
<name>CPU $2 time</name>
|
||||||
|
<key>system.cpu.util[,user]</key>
|
||||||
|
<history>1d</history>
|
||||||
|
<value_type>FLOAT</value_type>
|
||||||
|
<units>%</units>
|
||||||
|
<description>The time the CPU has spent running users' processes that are not niced.</description>
|
||||||
|
<request_method>POST</request_method>
|
||||||
|
<tags>
|
||||||
|
<tag>
|
||||||
|
<tag>Application</tag>
|
||||||
|
<value>CPU</value>
|
||||||
|
</tag>
|
||||||
|
<tag>
|
||||||
|
<tag>Application</tag>
|
||||||
|
<value>Performance</value>
|
||||||
|
</tag>
|
||||||
|
</tags>
|
||||||
|
</item>
|
||||||
|
</items>
|
||||||
|
</template>
|
||||||
|
</templates>
|
||||||
|
<graphs>
|
||||||
|
<graph>
|
||||||
|
<uuid>7aac0ec0c0e04b7a8bb6472d1faa7a09</uuid>
|
||||||
|
<name>CPU load</name>
|
||||||
|
<ymin_type_1>FIXED</ymin_type_1>
|
||||||
|
<graph_items>
|
||||||
|
<graph_item>
|
||||||
|
<color>009900</color>
|
||||||
|
<item>
|
||||||
|
<host>Template ZAS Agent</host>
|
||||||
|
<key>system.cpu.load[percpu,avg1]</key>
|
||||||
|
</item>
|
||||||
|
</graph_item>
|
||||||
|
<graph_item>
|
||||||
|
<sortorder>2</sortorder>
|
||||||
|
<color>990000</color>
|
||||||
|
<item>
|
||||||
|
<host>Template ZAS Agent</host>
|
||||||
|
<key>system.cpu.load[percpu,avg15]</key>
|
||||||
|
</item>
|
||||||
|
</graph_item>
|
||||||
|
</graph_items>
|
||||||
|
</graph>
|
||||||
|
<graph>
|
||||||
|
<uuid>f25064d88b964a678fac7ea6095b238a</uuid>
|
||||||
|
<name>CPU utilization</name>
|
||||||
|
<show_triggers>NO</show_triggers>
|
||||||
|
<type>STACKED</type>
|
||||||
|
<ymin_type_1>FIXED</ymin_type_1>
|
||||||
|
<ymax_type_1>FIXED</ymax_type_1>
|
||||||
|
<graph_items>
|
||||||
|
<graph_item>
|
||||||
|
<sortorder>4</sortorder>
|
||||||
|
<drawtype>FILLED_REGION</drawtype>
|
||||||
|
<color>999900</color>
|
||||||
|
<item>
|
||||||
|
<host>Template ZAS Agent</host>
|
||||||
|
<key>system.cpu.util[,iowait]</key>
|
||||||
|
</item>
|
||||||
|
</graph_item>
|
||||||
|
<graph_item>
|
||||||
|
<sortorder>5</sortorder>
|
||||||
|
<drawtype>FILLED_REGION</drawtype>
|
||||||
|
<color>990000</color>
|
||||||
|
<item>
|
||||||
|
<host>Template ZAS Agent</host>
|
||||||
|
<key>system.cpu.util[,system]</key>
|
||||||
|
</item>
|
||||||
|
</graph_item>
|
||||||
|
<graph_item>
|
||||||
|
<sortorder>6</sortorder>
|
||||||
|
<drawtype>FILLED_REGION</drawtype>
|
||||||
|
<color>000099</color>
|
||||||
|
<item>
|
||||||
|
<host>Template ZAS Agent</host>
|
||||||
|
<key>system.cpu.util[,user]</key>
|
||||||
|
</item>
|
||||||
|
</graph_item>
|
||||||
|
</graph_items>
|
||||||
|
</graph>
|
||||||
|
</graphs>
|
||||||
|
</zabbix_export>
|
||||||
107
devenv/zabbix60/docker-compose.yml
Normal file
107
devenv/zabbix60/docker-compose.yml
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
# Zabbix
|
||||||
|
zabbix-server:
|
||||||
|
image: zabbix/zabbix-server-pgsql:alpine-6.0-latest
|
||||||
|
ports:
|
||||||
|
- "10051:10051"
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
|
environment:
|
||||||
|
DB_SERVER_HOST: database
|
||||||
|
DB_SERVER_PORT: 5432
|
||||||
|
POSTGRES_USER: zabbix
|
||||||
|
POSTGRES_PASSWORD: zabbix
|
||||||
|
POSTGRES_DB: zabbix
|
||||||
|
ZBX_TIMEOUT: 10
|
||||||
|
ZBX_STARTPOLLERS: 10
|
||||||
|
ZBX_STARTPOLLERSUNREACHABLE: 5
|
||||||
|
ZBX_DEBUGLEVEL: 3
|
||||||
|
|
||||||
|
zabbix-web:
|
||||||
|
image: zabbix/zabbix-web-apache-pgsql:alpine-6.0-latest
|
||||||
|
ports:
|
||||||
|
- "8188:8080"
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
|
- zabbix-server
|
||||||
|
environment:
|
||||||
|
ZBX_SERVER_HOST: zabbix-server
|
||||||
|
ZBX_SERVER_PORT: 10051
|
||||||
|
DB_SERVER_HOST: database
|
||||||
|
DB_SERVER_PORT: 5432
|
||||||
|
POSTGRES_USER: zabbix
|
||||||
|
POSTGRES_PASSWORD: zabbix
|
||||||
|
POSTGRES_DB: zabbix
|
||||||
|
|
||||||
|
database:
|
||||||
|
image: postgres
|
||||||
|
ports:
|
||||||
|
- "15432:5432"
|
||||||
|
command: postgres -c 'max_connections=1000'
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: zabbix
|
||||||
|
POSTGRES_PASSWORD: zabbix
|
||||||
|
|
||||||
|
zabbix-agent:
|
||||||
|
image: zabbix/zabbix-agent:alpine-6.0-latest
|
||||||
|
environment:
|
||||||
|
ZBX_SERVER_HOST: zabbix-server
|
||||||
|
ZBX_SERVER_PORT: 10051
|
||||||
|
|
||||||
|
#########################################################
|
||||||
|
# Bootstrap config
|
||||||
|
#########################################################
|
||||||
|
|
||||||
|
bootstrap:
|
||||||
|
build: ./bootstrap
|
||||||
|
environment:
|
||||||
|
ZBX_API_URL: http://zabbix-web:8080
|
||||||
|
ZBX_API_USER: Admin
|
||||||
|
ZBX_API_PASSWORD: zabbix
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
|
- zabbix-server
|
||||||
|
- zabbix-web
|
||||||
|
|
||||||
|
#########################################################
|
||||||
|
# Fake agents
|
||||||
|
#########################################################
|
||||||
|
|
||||||
|
# backend
|
||||||
|
redis_backend:
|
||||||
|
image: redis:alpine
|
||||||
|
|
||||||
|
zas_backend_01:
|
||||||
|
build: ../zas-agent
|
||||||
|
volumes:
|
||||||
|
- ../zas-agent/conf/zas_scenario_backend.cfg:/etc/zas_scenario.cfg
|
||||||
|
environment:
|
||||||
|
REDIS_HOST: redis_backend
|
||||||
|
# restart: always
|
||||||
|
|
||||||
|
zas_backend_02:
|
||||||
|
build: ../zas-agent
|
||||||
|
volumes:
|
||||||
|
- ../zas-agent/conf/zas_scenario_backend.cfg:/etc/zas_scenario.cfg
|
||||||
|
environment:
|
||||||
|
REDIS_HOST: redis_backend
|
||||||
|
|
||||||
|
# frontend
|
||||||
|
redis_frontend:
|
||||||
|
image: redis:alpine
|
||||||
|
|
||||||
|
zas_frontend_01:
|
||||||
|
build: ../zas-agent
|
||||||
|
volumes:
|
||||||
|
- ../zas-agent/conf/zas_scenario_frontend.cfg:/etc/zas_scenario.cfg
|
||||||
|
environment:
|
||||||
|
REDIS_HOST: redis_frontend
|
||||||
|
|
||||||
|
zas_frontend_02:
|
||||||
|
build: ../zas-agent
|
||||||
|
volumes:
|
||||||
|
- ../zas-agent/conf/zas_scenario_frontend.cfg:/etc/zas_scenario.cfg
|
||||||
|
environment:
|
||||||
|
REDIS_HOST: redis_frontend
|
||||||
6
devenv/zas-agent/.dockerignore
Normal file
6
devenv/zas-agent/.dockerignore
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# *.md
|
||||||
|
# *.pdf
|
||||||
|
Dockerfile
|
||||||
|
Dockerfile*
|
||||||
|
run_zas.sh
|
||||||
|
*/.git
|
||||||
36
devenv/zas-agent/Dockerfile
Normal file
36
devenv/zas-agent/Dockerfile
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
FROM python:2.7
|
||||||
|
|
||||||
|
ENV ZAS_SOURCE_URL=https://github.com/vulogov/zas_agent/archive/master.zip
|
||||||
|
ENV ZAS_ARC_NAME=zas_agent-master
|
||||||
|
# ENV ZAS_SOURCE_URL=https://github.com/alexanderzobnin/zas_agent/archive/numpy-dependency.zip
|
||||||
|
# ENV ZAS_ARC_NAME=zas_agent-numpy-dependency
|
||||||
|
ENV ZAS_ARC_FILE=${ZAS_ARC_NAME}.zip
|
||||||
|
ENV ZAS_WORKDIR="/zas-agent"
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y ca-certificates
|
||||||
|
RUN apt-get install -y unzip wget
|
||||||
|
|
||||||
|
# Download and extract
|
||||||
|
WORKDIR ${ZAS_WORKDIR}
|
||||||
|
RUN wget ${ZAS_SOURCE_URL} -O ${ZAS_ARC_FILE}
|
||||||
|
RUN unzip ${ZAS_ARC_FILE}
|
||||||
|
|
||||||
|
# Install zas_agent
|
||||||
|
WORKDIR ${ZAS_WORKDIR}/${ZAS_ARC_NAME}/install
|
||||||
|
RUN python ./check_python_packages.py
|
||||||
|
WORKDIR ${ZAS_WORKDIR}/${ZAS_ARC_NAME}
|
||||||
|
RUN python setup.py build
|
||||||
|
RUN python setup.py install
|
||||||
|
|
||||||
|
COPY ./run_zas_agent.sh ${ZAS_WORKDIR}/${ZAS_ARC_NAME}/run_zas_agent.sh
|
||||||
|
|
||||||
|
# Make port 10050 available to the world outside this container
|
||||||
|
EXPOSE 10050
|
||||||
|
|
||||||
|
# Set default redis port to connect
|
||||||
|
ENV REDIS_PORT=6379
|
||||||
|
ENV REDIS_HOST=redis
|
||||||
|
|
||||||
|
# Run zas_agent.py when the container launches
|
||||||
|
# ENTRYPOINT ["./run_zas_agent.sh"]
|
||||||
|
CMD ["./run_zas_agent.sh"]
|
||||||
54
devenv/zas-agent/conf/zas_scenario_backend.cfg
Normal file
54
devenv/zas-agent/conf/zas_scenario_backend.cfg
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
##
|
||||||
|
## This target will match agent.ping requests
|
||||||
|
## and return static value 1
|
||||||
|
[agent.ping]
|
||||||
|
value=static:1
|
||||||
|
|
||||||
|
[agent.version]
|
||||||
|
value=static:"zas-agent-master"
|
||||||
|
|
||||||
|
[agent.hostname]
|
||||||
|
value=cmd:uname,-n
|
||||||
|
|
||||||
|
##
|
||||||
|
## CPU time
|
||||||
|
##
|
||||||
|
[system.cpu.util system]
|
||||||
|
match=system.cpu.util\[,system\]
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":5,"max":30,"type":"float","variation_min":10,"variation_max":10, "spike_barrier":3,"spike_width":6}
|
||||||
|
|
||||||
|
[system.cpu.util user]
|
||||||
|
match=system.cpu.util\[,user\]
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":10,"max":40,"type":"float","variation_min":20,"variation_max":20, "spike_barrier":3,"spike_width":18}
|
||||||
|
|
||||||
|
[system.cpu.util iowait]
|
||||||
|
match=system.cpu.util\[,iowait\]
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":1,"max":30,"type":"float","variation_min":5,"variation_max":5, "spike_barrier":2,"spike_width":18}
|
||||||
|
|
||||||
|
##
|
||||||
|
## System load (1 min average)
|
||||||
|
##
|
||||||
|
[system.cpu.load avg1]
|
||||||
|
match=system.cpu.load\[percpu,avg1\]
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":0,"max":5,"type":"float","variation_min":20,"variation_max":20,"spike_barrier":5,"spike_width":6}
|
||||||
|
|
||||||
|
[system.cpu.load avg15]
|
||||||
|
match=system.cpu.load\[percpu,avg15\]
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":0.1,"max":3,"type":"float","variation_min":10,"variation_max":20, "spike_barrier":3,"spike_width":6}
|
||||||
|
|
||||||
|
##
|
||||||
|
## Network interfaces
|
||||||
|
##
|
||||||
|
[all net.if.in]
|
||||||
|
match=net.if.in*
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":10000000,"max":20000000,"type":"int","variation_rnd":1,"spike_barrier":3,"spike_width":6}
|
||||||
|
[all net.if.out]
|
||||||
|
match=net.if.out*
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":30000000,"max":50000000,"type":"int","variation_min":5,"variation_max":5,"spike_barrier":3,"spike_width":18}
|
||||||
54
devenv/zas-agent/conf/zas_scenario_database.cfg
Normal file
54
devenv/zas-agent/conf/zas_scenario_database.cfg
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
##
|
||||||
|
## This target will match agent.ping requests
|
||||||
|
## and return static value 1
|
||||||
|
[agent.ping]
|
||||||
|
value=static:1
|
||||||
|
|
||||||
|
[agent.version]
|
||||||
|
value=static:"zas-agent-master"
|
||||||
|
|
||||||
|
[agent.hostname]
|
||||||
|
value=cmd:uname,-n
|
||||||
|
|
||||||
|
##
|
||||||
|
## CPU time
|
||||||
|
##
|
||||||
|
[system.cpu.util system]
|
||||||
|
match=system.cpu.util\[,system\]
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":20,"max":30,"type":"float","variation_min":5,"variation_max":5, "spike_barrier":2,"spike_width":3}
|
||||||
|
|
||||||
|
[system.cpu.util user]
|
||||||
|
match=system.cpu.util\[,user\]
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":30,"max":50,"type":"float","variation_min":10,"variation_max":10, "spike_barrier":3,"spike_width":24}
|
||||||
|
|
||||||
|
[system.cpu.util iowait]
|
||||||
|
match=system.cpu.util\[,iowait\]
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":1,"max":20,"type":"float","variation_min":5,"variation_max":5, "spike_barrier":2,"spike_width":12}
|
||||||
|
|
||||||
|
##
|
||||||
|
## System load (1 min average)
|
||||||
|
##
|
||||||
|
[system.cpu.load avg1]
|
||||||
|
match=system.cpu.load\[percpu,avg1\]
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":1,"max":5,"type":"float","variation_min":20,"variation_max":20,"spike_barrier":5,"spike_width":6}
|
||||||
|
|
||||||
|
[system.cpu.load avg15]
|
||||||
|
match=system.cpu.load\[percpu,avg15\]
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":0.5,"max":3,"type":"float","variation_min":10,"variation_max":20, "spike_barrier":3,"spike_width":30}
|
||||||
|
|
||||||
|
##
|
||||||
|
## Network interfaces
|
||||||
|
##
|
||||||
|
[all net.if.in]
|
||||||
|
match=net.if.in*
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":60000000,"max":90000000,"type":"int","variation_rnd":1,"spike_barrier":2,"spike_width":3}
|
||||||
|
[all net.if.out]
|
||||||
|
match=net.if.out*
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":60000000,"max":90000000,"type":"int","variation_min":20,"variation_max":20,"spike_barrier":5,"spike_width":6}
|
||||||
44
devenv/zas-agent/conf/zas_scenario_default.cfg
Normal file
44
devenv/zas-agent/conf/zas_scenario_default.cfg
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
##
|
||||||
|
## This target will match all vfs.fs.size[*,pfree] requests
|
||||||
|
## and generate uniform random numbers in range 1 to 100
|
||||||
|
##
|
||||||
|
[filesystems.size pfree]
|
||||||
|
match=vfs.fs.size\[(.?),pfree\]
|
||||||
|
value=uniform:1,100
|
||||||
|
[application.connections]
|
||||||
|
value=uniform_int:1,100
|
||||||
|
|
||||||
|
##
|
||||||
|
## This target will match all vfs.fs.size[*,free] requests
|
||||||
|
## and request data from REDIS
|
||||||
|
##
|
||||||
|
[filesystem.size free]
|
||||||
|
match=vfs.fs.size\[(.?),free\]
|
||||||
|
value=redis:
|
||||||
|
[all net.if.in]
|
||||||
|
match=net.if.in*
|
||||||
|
value=redis:
|
||||||
|
[all net.if.out]
|
||||||
|
match=net.if.out*
|
||||||
|
value=redis:
|
||||||
|
##
|
||||||
|
## Scenario calculations
|
||||||
|
##
|
||||||
|
[all system.cpu.util]
|
||||||
|
match=system.cpu.util*
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":0,"max":20,"type":"float","variation_min":10,"variation_max":10}
|
||||||
|
|
||||||
|
##
|
||||||
|
## This target will match all vfs.fs.size[*,used] requests
|
||||||
|
## and request data from REDIS lists
|
||||||
|
##
|
||||||
|
[filesystem.size used]
|
||||||
|
match=vfs.fs.size\[(.?),used\]
|
||||||
|
value=rqueue:
|
||||||
|
|
||||||
|
##
|
||||||
|
## This target will match agent.ping requests
|
||||||
|
## and return static value 1
|
||||||
|
[agent.ping]
|
||||||
|
value=static:1
|
||||||
54
devenv/zas-agent/conf/zas_scenario_frontend.cfg
Normal file
54
devenv/zas-agent/conf/zas_scenario_frontend.cfg
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
##
|
||||||
|
## This target will match agent.ping requests
|
||||||
|
## and return static value 1
|
||||||
|
[agent.ping]
|
||||||
|
value=static:1
|
||||||
|
|
||||||
|
[agent.version]
|
||||||
|
value=static:"zas-agent-master"
|
||||||
|
|
||||||
|
[agent.hostname]
|
||||||
|
value=cmd:uname,-n
|
||||||
|
|
||||||
|
##
|
||||||
|
## CPU time
|
||||||
|
##
|
||||||
|
[system.cpu.util system]
|
||||||
|
match=system.cpu.util\[,system\]
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":15,"max":20,"type":"float","variation_min":5,"variation_max":5, "spike_barrier":2,"spike_width":3}
|
||||||
|
|
||||||
|
[system.cpu.util user]
|
||||||
|
match=system.cpu.util\[,user\]
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":30,"max":50,"type":"float","variation_min":10,"variation_max":10, "spike_barrier":3,"spike_width":24}
|
||||||
|
|
||||||
|
[system.cpu.util iowait]
|
||||||
|
match=system.cpu.util\[,iowait\]
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":1,"max":30,"type":"float","variation_min":5,"variation_max":5, "spike_barrier":2,"spike_width":12}
|
||||||
|
|
||||||
|
##
|
||||||
|
## System load (1 min average)
|
||||||
|
##
|
||||||
|
[system.cpu.load avg1]
|
||||||
|
match=system.cpu.load\[percpu,avg1\]
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":0,"max":5,"type":"float","variation_min":10,"variation_max":30,"spike_barrier":5,"spike_width":30}
|
||||||
|
|
||||||
|
[system.cpu.load avg15]
|
||||||
|
match=system.cpu.load\[percpu,avg15\]
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":0.1,"max":3,"type":"float","variation_min":5,"variation_max":10, "spike_barrier":3,"spike_width":30}
|
||||||
|
|
||||||
|
##
|
||||||
|
## Network interfaces
|
||||||
|
##
|
||||||
|
[all net.if.in]
|
||||||
|
match=net.if.in*
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":5000000,"max":10000000,"type":"int","variation_rnd":1,"spike_barrier":3,"spike_width":20}
|
||||||
|
[all net.if.out]
|
||||||
|
match=net.if.out*
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":60000000,"max":90000000,"type":"int","variation_min":20,"variation_max":20,"spike_barrier":5,"spike_width":20}
|
||||||
12
devenv/zas-agent/run_zas_agent.sh
Executable file
12
devenv/zas-agent/run_zas_agent.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Run redis server first
|
||||||
|
# cd /zas/redis-3.2.9/src/
|
||||||
|
# nohup redis-server > /tmp/redis.log &
|
||||||
|
|
||||||
|
REDIS_HOST=${REDIS_HOST:-"redis"}
|
||||||
|
REDIS_PORT=${REDIS_PORT:-"6381"}
|
||||||
|
|
||||||
|
rm -f /tmp/zas_agent.pid
|
||||||
|
echo Using redis host: ${REDIS_HOST} and port: ${REDIS_PORT}
|
||||||
|
zas_agent.py --start --user root --group root --scenario /etc/zas_scenario.cfg --redis_host ${REDIS_HOST} --redis_port ${REDIS_PORT}
|
||||||
60
devenv/zas-agent/zas_scenario.cfg
Normal file
60
devenv/zas-agent/zas_scenario.cfg
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
##
|
||||||
|
## This target will match all vfs.fs.size[*,pfree] requests
|
||||||
|
## and generate uniform random numbers in range 1 to 100
|
||||||
|
##
|
||||||
|
[filesystems.size pfree]
|
||||||
|
match=vfs.fs.size\[(.?),pfree\]
|
||||||
|
value=uniform:1,100
|
||||||
|
[application.connections]
|
||||||
|
value=uniform_int:1,100
|
||||||
|
|
||||||
|
##
|
||||||
|
## This target will match all vfs.fs.size[*,free] requests
|
||||||
|
## and request data from REDIS
|
||||||
|
##
|
||||||
|
[filesystem.size free]
|
||||||
|
match=vfs.fs.size\[(.?),free\]
|
||||||
|
value=redis:
|
||||||
|
[all net.if.in]
|
||||||
|
match=net.if.in*
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":0,"max":100000,"type":"int","variation_rnd":1,"spike_barrier":3,"spike_width":6}
|
||||||
|
[all net.if.out]
|
||||||
|
match=net.if.out*
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":0,"max":100000,"type":"int","variation_min":5,"variation_max":5,"spike_barrier":10,"spike_width":6}
|
||||||
|
##
|
||||||
|
## Scenario calculations
|
||||||
|
##
|
||||||
|
[all system.cpu.util]
|
||||||
|
match=system.cpu.util*
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":0,"max":20,"type":"float","variation_min":10,"variation_max":10}
|
||||||
|
|
||||||
|
[all system.cpu.load]
|
||||||
|
match=system.cpu.load*
|
||||||
|
value=scenario:
|
||||||
|
scenario={"min":0,"max":5,"type":"float","variation_min":20,"variation_max":20}
|
||||||
|
|
||||||
|
##
|
||||||
|
## This target will match all vfs.fs.size[*,used] requests
|
||||||
|
## and request data from REDIS lists
|
||||||
|
##
|
||||||
|
[filesystem.size used]
|
||||||
|
match=vfs.fs.size\[(.?),used\]
|
||||||
|
value=rqueue:
|
||||||
|
|
||||||
|
##
|
||||||
|
## This target will match agent.ping requests
|
||||||
|
## and return static value 1
|
||||||
|
[agent.ping]
|
||||||
|
value=static:1
|
||||||
|
|
||||||
|
[agent.version]
|
||||||
|
value=static:zas-0.1.1
|
||||||
|
|
||||||
|
[agent.hostname]
|
||||||
|
value=cmd:uname,-n
|
||||||
|
|
||||||
|
[system.uname]
|
||||||
|
value=cmd:uname,-a
|
||||||
Reference in New Issue
Block a user