mirror of
https://github.com/newnius/Dockerfiles.git
synced 2025-06-06 08:11:54 +00:00
add zabbix-agent
This commit is contained in:
parent
b2ae876d5c
commit
9815c2a75c
12
zabbix-agent/normal/Dockerfile
Normal file
12
zabbix-agent/normal/Dockerfile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
FROM ubuntu:18.04
|
||||||
|
|
||||||
|
MAINTAINER Newnius <newnius.cn@gmail.com>
|
||||||
|
|
||||||
|
# Prerequisites
|
||||||
|
RUN apt update && \
|
||||||
|
apt install -y lm-sensors zabbix-agent && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
ADD bootstrap.sh /etc/bootstrap.sh
|
||||||
|
|
||||||
|
CMD ["/etc/bootstrap.sh"]
|
27
zabbix-agent/normal/README.md
Normal file
27
zabbix-agent/normal/README.md
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker service create \
|
||||||
|
--name zabbix-agent-custom \
|
||||||
|
--hostname="{{.Node.Hostname}}" \
|
||||||
|
--network swarm-net \
|
||||||
|
--detach=true \
|
||||||
|
--env ZBX_HOSTNAME="{{.Node.Hostname}}" \
|
||||||
|
--mode global\
|
||||||
|
--env ZBX_SERVER_HOST=zabbix-server \
|
||||||
|
--mount type=bind,source=/etc/localtime,target=/etc/localtime \
|
||||||
|
newnius/zabbix-agent:normal
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Boil CPU
|
||||||
|
|
||||||
|
```bash
|
||||||
|
for i in `seq 1 $(cat /proc/cpuinfo |grep "physical id" |wc -l)`; do dd if=/dev/zero of=/dev/null & done
|
||||||
|
```
|
||||||
|
|
||||||
|
Calm it down
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pkill dd
|
||||||
|
```
|
22
zabbix-agent/normal/bootstrap.sh
Executable file
22
zabbix-agent/normal/bootstrap.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SERVER="localhost"
|
||||||
|
HOSTNAME=$(hostname)
|
||||||
|
|
||||||
|
if ! [[ -z "${ZBX_SERVER_HOST}" ]]; then
|
||||||
|
SERVER=${ZBX_SERVER_HOST}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [[ -z "${ZBX_HOSTNAME}" ]]; then
|
||||||
|
HOSTNAME=${ZBX_HOSTNAME}
|
||||||
|
fi
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
|
||||||
|
temp=$(sensors | awk '{print $3}' | grep '+' | sed -r 's/\+([0-9]*)\..*/\1/g' | sort | tail -n 1)
|
||||||
|
|
||||||
|
zabbix_sender -s $HOSTNAME -z $SERVER -k "temp" -o $temp
|
||||||
|
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user