Zabbix 7 Monitoring Eğitimi (16+ Saat)

Zabbix 7 Eğitime indirimli olarak ulaşmak için buradaki link.

Tüm eğitimlerimde geçerli Güncel İndirim Kupon Kodu = “EVENT-2024

Zabbix 6 Eğitime indirimli olarak ulaşmak için buradaki link.

#Ubuntu Update and Upgrade Commands

sudo su
apt update && apt upgrade -y

#Oracle Linux Update and Upgrade Commands

sudo -i
yum update -y
yum upgrade -y
dnf update -y
dnf upgrade -y

#Mysql Installation Commands on Ubuntu

sudo apt install mysql-server -y
systemctl enable mysql --now
mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'MysqlYeniParola';
mysql_secure_installation
mysql -uroot -p

#Edit Zabbix Apache Time Zone on Ubuntu

nano /etc/zabbix/apache.conf
php_value date.timezone Europe/Istanbul

#Commands for adding TCP or UDP ports / services on Oracle Linux Firewall

firewall-cmd --state
firewall-cmd --list-ports
firewall-cmd --list-services

firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --permanent --zone=public --add-port=161/udp
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

#Commands for removing TCP or UDP ports / services on Oracle Linux Firewall

firewall-cmd --permanent --zone=public --remove-port=80/tcp
firewall-cmd --permanent --zone=public --remove-port=161/udp
firewall-cmd --permanent --zone=public --remove-service=http
firewall-cmd --reload

#Commands for adding TCP or UDP ports on Ubuntu Firewall

sudo ufw disable
sudo ufw enable

sudo ufw status
sudo ufw allow 10050/tcp
sudo ufw status numbered

#Zabbix Agent or Agent2 installation commands with services on Windows

Server=192.168.1.100
ServerActive=192.168.1.100
#Hostname=Windows host
HostMetadataItem=system.uname

Agent
zabbix_agentd.exe -c zabbix_agentd.conf -i => install
zabbix_agentd.exe -c zabbix_agentd.conf -s => start
zabbix_agentd.exe -c zabbix_agentd.conf -x => stop
zabbix_agentd.exe -c zabbix_agentd.conf -d => uninstall

Agent2
zabbix_agent2.exe -c zabbix_agent2.conf -i => install
zabbix_agent2.exe -c zabbix_agent2.conf -s => start
zabbix_agent2.exe -c zabbix_agent2.conf -x => stop
zabbix_agent2.exe -c zabbix_agent2.conf -d => uninstall

#Zabbix Agent uninstall commands on Ubuntu

sudo apt-get remove zabbix-agent
rm -rf /etc/zabbix*
sudo apt-get remove --auto-remove zabbix-agent
sudo apt-get purge zabbix-agent
sudo apt-get purge --auto-remove zabbix-agent

#Postgresql list database commands

sudo -u postgres psql
\l
\c zabbix;
\dt

#Postgresql remote connection configurations

nano /var/lib/pgsql/16/data/postgresql.conf
listen_addresses = '*'

nano /var/lib/pgsql/16/data/pg_hba.conf
# IPv4 local connections:
host    all             all             192.168.110.41/0            md5

dnf install postgresql-contrib -y
psql -U zabbix -h 192.168.1.43 -p 5432 zabbix

#Ncat installation

yum install nc -y

TCP => nc -z -v 192.168.1.10 22
UDP => nc -z -v -u 192.168.1.10 161

#SNMP Walk installation

yum install net-snmp-utils -y

SNMPv2 Test;
snmpwalk -v2c -c dontUsePublic 192.168.1.225

.1.3.6.1.2.1.1.1.0 => SystemDesc
.1.3.6.1.2.1.1.5.0 => Hostname

SNMPv3 Test;
snmpwalk -v3 -l authPriv -u v3User -a MD5 -A "dontUsePublic" -x AES -X "dontUsePublic" 192.168.1.77 .1.3.6.1.2.1.1.1.0

#SNMP installation on Ubuntu

sudo apt install snmpd snmp libsnmp-dev -y

#SNMP installation on Oracle Linux

dnf install net-snmp net-snmp-utils -y

net-snmp-create-v3-user -ro -A dontUsePublic -a SHA -X dontUsePublic -x AES v3User

snmpwalk -v3 -l authPriv -u v3User -a SHA -A "dontUsePublic" -x AES -X "dontUsePublic" 192.168.1.23

#Domain Expiration Control with Zabbix External Checks

Kullanılan orjinal kaynak doküman ve web sitesi.

dnf install whois -y
#!/bin/bash
DOMAIN="$1"
exdate=`whois $DOMAIN | grep -E 'paid|Expire|Expiry' | grep -o -E '[0-9]{4}.[0-9]{2}.[0-9]{2}|[0-9]{2}/[0-9]{2}/[0-9]{4}'`
expire=$((`date -d "$exdate" '+%s'`))
today=$((`date '+%s'`))
leftsec=$(($expire - $today))
leftdays=$(($leftsec/86400))
echo $leftdays

#Zabbix Sender installation

Make sure add zabbix repositories to your server before

dnf install zabbix-sender -y

#Random Number Send Script with Zabbix Sender

#!/bin/bash

# Infinite loop to generate random numbers every 5 seconds
while true
do
    # Generate a random number between 1 and 100
    random_number=$((1 + RANDOM % 100))

    # Print the random number
    # echo "Random number: $random_number"
    zabbix_sender -z 192.168.1.41,192.168.1.42 -s "LNX-SRV-DEVOPS-1" -k sender.trap-1 -o "$random_number"

    # Wait for 5 seconds
    sleep 5
done

#Windows Service Monitoring and Scripts

^(Spooler|Zabbix Agent 2)$

net start {EVENT.TAGS.<tag name>}

net start {EVENT.TAGS.service}

#Linux Service Monitoring and Scripts

{$SYSTEMD.NAME.SERVICE.MATCHES} = (httpd.service|postgresql-16.service).*

sudo visudo

zabbix ALL=NOPASSWD: /sbin/service httpd restart
zabbix ALL=NOPASSWD: /sbin/service postgresql-16 restart

#User Parameters Windows

(Search-ADAccount -Lockedout | select-object SamAccountName).Count

UserParameter=users.locked,powershell -Command "(Search-ADAccount -LockedOut | Select-Object | foreach { $_.SamAccountName }).Count"

#User Parameters Linux

who -u

UserParameter=ssh.connection,who -u

#Event ID Monitoring on Windows with Zabbix

eventlog[name,<regexp>,<severity>,<source>,<eventid>,<maxlines>,<mode>]

eventlog[Security,,,,4624,,skip]

length(last(/MSVM-AD/eventlog[Security,,,,4625,,skip]))>0
or
logeventid(/MSVM-AD/eventlog[Security,,,,4625,,skip])=1

#Log File Monitoring on Linux with Zabbix

log[file,<regexp>,<encoding>,<maxlines>,<mode>,<output>,<maxdelay>,<options>,<persistent_dir>]

log[/var/log/secure,"Accepted.*",,,skip,,,,]

length(last(/lnx-srv-oracle-2/log[/var/log/secure,"Accepted.*",,,skip,,,,]))>0

#Grafana Postgresql integration

SELECT hostid,name,maintenance_status FROM hosts WHERE name='Zabbix Server APP-01';