DEV Community

aylinsdogan for Açıklab

Posted on

3

Zabbix admin yetkisi

Yetki Verme

Servis varsayılanda zabbix servis kullanıcısı ile çalışmaktadır, yetkisi olmayan dosyaları okuma gibi işlemlerde "[13] Permission denied." hatası ile karşılaşılabilir. Hatayı çözebilmek için servisi kullanıcı ile çalıştırmamız gerekmektedir. Aşağıdaki adımlar bunun nasıl yapılacağını göstermektedir.

Step-1

set_zabbix.sh dosyası makine üzerinde yaratılır.

set_zabbix.sh dosyasının içeriği aşağıdaki gibi olmalıdır.

while getopts h:i: flag
do
    case "${flag}" in
        h) zbx_hostname=${OPTARG};;
        i) zbx_ip=${OPTARG};;
    esac
done
if test -z "$zbx_hostname" 
then
    zbx_hostname=$(hostname --short)
fi
if test -z "$zbx_ip" 
then
   echo "ip input olarak verilmek zorundadır!"
   exit
fi
sudo apt install zabbix-agent -y
version=$(dpkg -s zabbix-agent  | grep -i version | cut -d : -f 3 | cut -d . -f 1)
if [ $version -gt 5 ] ; 
then
    echo "Version: $version, yeni yapılandırma uygulanıyor"
    mkdir /etc/systemd/system/zabbix-agent.service.d 2>/dev/null
    echo """
    [Service] 
    User=root 
    Group=root
    """ > /etc/systemd/system/zabbix-agent.service.d/override.conf
    sed -i "/ServerActive=/d" /etc/zabbix/zabbix_agentd.conf; echo  "ServerActive=$zbx_ip" >> /etc/zabbix/zabbix_agentd.conf
    sed -i "/Hostname=/d" /etc/zabbix/zabbix_agentd.conf; echo  "Hostname=$zbx_hostname" >> /etc/zabbix/zabbix_agentd.conf
    sed -i "/Server=/d" /etc/zabbix/zabbix_agentd.conf; echo  "Server=$zbx_ip" >> /etc/zabbix/zabbix_agentd.conf
    systemctl daemon-reload
    systemctl restart zabbix-agent
else
    echo "Version: $version, eski yapılandırma uygulanıyor"

    mkdir /etc/systemd/system/zabbix-agent.service.d 2>/dev/null
    echo """
    [Service] 
    User=root 
    Group=root
    """ > /etc/systemd/system/zabbix-agent.service.d/override.conf

    sed -i "/ServerActive=/d" /etc/zabbix/zabbix_agentd.conf; echo  "ServerActive=$zbx_ip" >> /etc/zabbix/zabbix_agentd.conf
    sed -i "/Server=/d" /etc/zabbix/zabbix_agentd.conf; echo  "Server=$zbx_ip" >> /etc/zabbix/zabbix_agentd.conf
    sed -i "/AllowRoot=/d" /etc/zabbix/zabbix_agentd.conf; echo  "AllowRoot=1" >> /etc/zabbix/zabbix_agentd.conf
    sed -i "/Hostname=/d" /etc/zabbix/zabbix_agentd.conf; echo  "Hostname=$zbx_hostname" >> /etc/zabbix/zabbix_agentd.conf
    sed -i "/User=/d" /etc/zabbix/zabbix_agentd.conf; echo  "User=root" >> /etc/zabbix/zabbix_agentd.conf
    systemctl daemon-reload
    systemctl restart zabbix-agent
fi 

Enter fullscreen mode Exit fullscreen mode

Step-2

Zabbix arayüzündeki Makine adı ve zabbix ip'si scripte input olarak aşağıdaki gibi verilmelidir.
NOT: hostname verisinin zabbix arayüzündeki gibi olması önemlidir.

sudo bash set_zabbix.sh -h "DNS DTL" -i "zabbix_ip"
Enter fullscreen mode Exit fullscreen mode

Bu sayede Zabbix ve Liman üzerinde auth logları görüntülenebilir

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more