# -----------------------------------------------------------------------------
# ZABBIX NOTLARI
# -----------------------------------------------------------------------------
Debian Jessie ile test edilmiştir.
# -----------------------------------------------------------------------------
# KURULUM
# -----------------------------------------------------------------------------
# Paketler
apt-get install postgresql postgresql-contrib --install-recommends
apt-get install zabbix-server-pgsql zabbix-frontend-php --install-recommends
# Veritabanı ayarları
POSTGRESQL_PASSWORD=`echo $RANDOM | sha256sum | cut -d" " -f1`
ZABBIX_WEB_PASSWORD=`echo $POSTGRESQL_PASSWORD | cut -c1-8`
su -l postgres -c \
"createdb zabbix"
su -l postgres -c \
"psql <<< \"CREATE USER zabbix PASSWORD '$POSTGRESQL_PASSWORD';\""
su -l postgres -c \
"export PGPASSWORD=\"$POSTGRESQL_PASSWORD\"; \
zcat /usr/share/zabbix-server-pgsql/{schema,images,data}.sql.gz | \
psql -U zabbix -h localhost -d zabbix"
su -l postgres -c \
"psql zabbix << EOF
UPDATE users
SET passwd = md5('$ZABBIX_WEB_PASSWORD')
WHERE alias = 'Admin';
EOF
# /etc/default/zabbix-server
START=yes
# /etc/zabbix/zabbix.conf.php
# /etc/zabbix/zabbix_server.conf
DBPassword=#POSTGRESQL_PASSWORD#
# Postgresql zabbix kullanıcısının parolası
sed -i "s/#POSTGRESQL_PASSWORD#/${POSTGRESQL_PASSWORD}/" \
/etc/zabbix/zabbix.conf.php
sed -i "s/#POSTGRESQL_PASSWORD#/${POSTGRESQL_PASSWORD}/" \
/etc/zabbix/zabbix_server.conf
# /etc/zabbix/zabbix_agentd.conf.d/host.conf
Hostname=admin-mon
# /etc/php5/apache2/php.ini
max_execution_time = 300
max_input_time = 600
post_max_size = 32M
upload_max_filesize = 8M
date.timezone = "#TIMEZONE#"
# timezone değerinin set edilmesi
TIMEZONE="`cat /etc/timezone || echo UTC`"
sed -i "s~#TIMEZONE#~${TIMEZONE}~" /etc/php5/apache2/php.ini
# index.html
echo > /var/www/html/index.html
# /etc/apache2/conf-available/security.conf
ServerTokens Prod
ServerSignature Off
# /etc/apache2/conf-available/servername.conf
ServerName localhost
# /etc/apache2/conf-available/zabbix-server.conf
Alias /zabbix /usr/share/zabbix
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# mod, conf, site
a2ensite default-ssl.conf
a2enconf servername
a2enconf zabbix-server
a2enmod ssl
# -----------------------------------------------------------------------------
# ZABBIX SENDER
# -----------------------------------------------------------------------------
zabbix_sender, Zabbix sunucuya veri göndermek için kullanılır. Uzun süren
scriptler içinde kullanılabilir.
# zabbix_sender
zabbix_sender -z zabbixserver.gno.loc -s "myhostname" -k db.connections -o 43
# -input-file
Bir text dosyaya birden fazla değer kaydedilip tek seferde gönderilebilir.
# -----------------------------------------------------------------------------
# ZABBIX GET
# -----------------------------------------------------------------------------
Zabbix Agent makinelerden veri almak için kullanılır.
zabbix_get -s 127.0.0.1 -p 10050 -k "system.cpu.load[all,avg1]"
# -----------------------------------------------------------------------------
# ZABBIX API
# -----------------------------------------------------------------------------
# Paketler
apt-get install curl jq
# api init
API_HOST="http://localhost/zabbix/api_jsonrpc.php"
HEADER=`cat <>> "ee156f93682b14c02117739f53e0bb94"
# hostgroup.create
JSON=`cat <