Add docker test environment for Zabbix 6.0
This commit is contained in:
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