Ad Widget

Collapse

Unable to get data on Zabbix agent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zabbixenthu
    Junior Member
    • Jan 2025
    • 3

    #1

    Unable to get data on Zabbix agent

    Sorry for my rant below. I am helpless

    Apologies for my Long post but honestly I am quite frustrated with Zabbix.
    It does not perform well. Documentation is pure hopeless and hoping that if the Zabbix Product owner reads my post, he or she will be enlightened to make some necessary corrections

    Here is my shell script to "install" Agent on Ubuntu 24.04. Their documentation just says download tgz, wtf after that???

    Code:
    root@zabbix-agent-1:~# cat /home/azureuser/install-agent.sh
    #!/bin/bash
    
    LOG_FILE="/var/log/zabbix_installation.log"
    exec > >(tee -a "$LOG_FILE") 2>&1
    
    echo "Starting Zabbix Agent Installation: $(date)"
    # Update to correct time-zone
    timedatectl set-timezone "Australia/Melbourne"
    
    # Update and Upgrade the System
    echo "Updating and upgrading the system..."
    apt-get update && apt-get upgrade -y
    
    # Add Zabbix user and group
    echo "Creating Zabbix user and group..."
    groupadd zabbix
    useradd -r -M -g zabbix -d /usr/local/zabbix -s /usr/sbin/nologin zabbix
    
    # Verify user creation
    echo "Verifying Zabbix user..."
    id zabbix
    
    # Set permissions and create directories
    echo "Setting permissions and creating necessary directories..."
    chown -R zabbix:zabbix /usr/local/zabbix/
    chmod -R 755 /usr/local/zabbix/
    mkdir -p /var/log/zabbix
    touch /var/log/zabbix/zabbix_agentd.log
    chown -R zabbix:zabbix /var/log/zabbix
    chmod -R 755 /var/log/zabbix
    
    # Download and Extract Zabbix Agent binaries
    echo "Downloading Zabbix Agent binaries..."
    wget https://cdn.zabbix.com/zabbix/binaries/stable/7.2/7.2.3/zabbix_agent-7.2.3-linux-3.0-amd64-static.tar.gz
    
    echo "Extracting Zabbix Agent binaries..."
    tar -xzvf zabbix_agent-7.2.3-linux-*.tar.gz
    mkdir -p /usr/local/zabbix
    mv bin sbin conf /usr/local/zabbix/
    chown -R zabbix:zabbix /usr/local/zabbix/
    chmod -R 755 /usr/local/zabbix/
    
    # Create Zabbix Agent SystemD File
    echo "Creating Zabbix Agent SystemD service file..."
    cat <<EOF > /etc/systemd/system/zabbix-agent.service
    [Unit]
    Description=Zabbix Agent
    After=network.target
    
    [Service]
    Type=simple
    ExecStart=/usr/local/zabbix/sbin/zabbix_agentd -c /usr/local/zabbix/conf/zabbix_agentd.conf
    Restart=on-failure
    User=zabbix
    Group=zabbix
    
    [Install]
    WantedBy=multi-user.target
    EOF
    
    # Create Zabbix Config File
    echo "Creating Zabbix Agent configuration file..."
    mkdir -p /usr/local/zabbix/conf
    tee /usr/local/zabbix/conf/zabbix_agentd.conf > /dev/null <<EOF
    LogFile=/var/log/zabbix/zabbix_agentd.log
    Server=52.146.18.60
    ServerActive=52.146.18.60
    Hostname=zabbix-agent-1
    ### Set Debug Logging Level
    DebugLevel=4
    
    ### Ensure log file is correctly set
    LogFile=/var/log/zabbix/zabbix_agentd.log
    EOF
    
    # Reload systemd and enable Zabbix Agent
    echo "Reloading systemd and enabling Zabbix Agent service..."
    systemctl daemon-reload
    systemctl enable zabbix-agent
    
    # Start Zabbix Agent
    echo "Starting Zabbix Agent service..."
    systemctl start zabbix-agent
    
    # Check Zabbix Agent status
    echo "Checking Zabbix Agent status..."
    systemctl status zabbix-agent
    
    echo "Zabbix Agent Installation Completed: $(date)"
    My Zabbix configuration file is below

    Code:
    root@zabbix-agent-1:~# cat /usr/local/zabbix/conf/zabbix_agentd.conf
    LogFile=/var/log/zabbix/zabbix_agentd.log
    Server=52.146.18.60
    ServerActive=52.146.18.60
    Hostname=zabbix-agent-1
    ### Set Debug Logging Level
    DebugLevel=4
    ### Ensure log file is correctly set
    LogFile=/var/log/zabbix/zabbix_agentd.log
    WHat is frustrating is zabbix agent never comes up. I fail to understand why agent has to come up only if the same host is defined in UI else it does not? Complete flaws in the design. It should come up and send data, UI should not need to be even used to add host. WHy it cannot be done via command or configuration file from server?

    The Zabbix Server Config file is
    Code:
    root@zabbix-server:~# sudo cat /etc/zabbix/zabbix_server.conf | grep -v '^#'
    LogFile=/var/log/zabbix/zabbix_server.log
    LogFileSize=0
    PidFile=/run/zabbix/zabbix_server.pid
    SocketDir=/run/zabbix
    DBName=zabbix
    DBUser=zabbix
    DBPassword=password
    SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
    Timeout=4
    LogSlowQueries=3000
    Include=/etc/zabbix/zabbix_server.d/*.conf
    StatsAllowedIP=0.0.0.0
    EnableGlobalScripts=0

    I get below information from Agent Logs
    Code:
    11148:20250202:213617.003 zbx_comms_exchange_with_redirect() sending: {"request":"active checks","host":"zabbix-agent-1","config_revision":0,"session":"1ffa3bc2e0798 2a7 911dcaf9af9cc278","version":"7.2.3","variant":1}
    11148:20250202:213617.003 zbx_comms_exchange_with_redirect() received: {"response":"success","config_revision":1,"data ":[]}
    11148:20250202:213617.003 End of zbx_comms_exchange_with_redirect():SUCCEED
    11148:20250202:213617.004 In parse_list_of_checks()
    11148:20250202:213617.004 End of parse_list_of_checks():SUCCEED
    11148:20250202:213617.004 In parse_list_of_commands()
    11148:20250202:213617.004 End of parse_list_of_commands():SUCCEED
    11148:20250202:213617.004 End of refresh_active_checks():SUCCEED
    11148:20250202:213617.004 zbx_setproctitle() title:'active checks #1 [processing active checks]'
    11148:20250202:213617.004 In process_active_checks() server:'52.146.18.60' port:10051
    11148:20250202:213617.004 End of process_active_checks()
    11148:20250202:213617.004 In get_min_nextcheck()
    11148:20250202:213617.004 End of get_min_nextcheck():-1
    11148:20250202:213617.004 In send_buffer() host:'52.146.18.60' port:10051 entries:0/100
    11148:20250202:213617.004 In format_metric_results()
    11148:20250202:213617.004 format_metric_results() now:1738492577 lastsent:1738492576 now-lastsent:1 BufferSend:5; will not send now
    11148:20250202:213617.004 End of format_metric_results():FAIL
    11148:20250202:213617.004 End of send_buffer():SUCCEED
    11148:20250202:213617.004 zbx_setproctitle() title:'active checks #1 [idle 1 sec]'
    11136:20250202:213617.094 Got signal [signal:15(SIGTERM),sender_pid:1,sender_uid:0,reaso n:0]. Exiting ...
    11136:20250202:213617.095 zbx_on_exit() called with ret:0
    11148:20250202:213617.096 zbx_setproctitle() title:'active checks #1 [idle 1 sec]'
    11136:20250202:213617.096 In zbx_dshm_destroy() shmid:-1
    11136:20250202:213617.097 End of zbx_dshm_destroy():SUCCEED
    11136:20250202:213617.097 In zbx_unload_modules()
    11136:20250202:213617.097 End of zbx_unload_modules()
    11136:20250202:213617.097 Zabbix Agent stopped. Zabbix 7.2.3 (revision ff99a1b26ba).
    Any guidance would be much appreciated.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4806

    #2
    arr... why tgz? Packages are there.. https://www.zabbix.com/download?zabb...ysql&ws=apache (change DB and frontend to your liking)
    apt install zabbix_agent ... (or zabbix_agent2)

    Comment

    • Blevar
      Member
      • Jan 2025
      • 68

      #3
      I dont get with what you have problems with. Installing agent on ubuntu is pretty straightforward. Everything is explaned at: https://www.zabbix.com/download?zabb...gent_2&db=&ws=


      Click image for larger version

Name:	obraz.png
Views:	293
Size:	122.1 KB
ID:	498365

      You dont need to configure zabbix_server.conf on the host you want to monitor. Well if you actually have a file on such host - that you did something wrong. You should edit the hostname in zabbix_agent2.conf and reset the Zabbix agent. Thats it.

      Comment

      • kyus
        Senior Member
        • Feb 2024
        • 171

        #4
        Since the two posts above this one already clear most of your needs, I'll try to address this:
        WHat is frustrating is zabbix agent never comes up. I fail to understand why agent has to come up only if the same host is defined in UI else it does not? Complete flaws in the design. It should come up and send data, UI should not need to be even used to add host. WHy it cannot be done via command or configuration file from server?
        To get your agents to come up in the frontend without manual action, you can create an autoregistration action to add those hosts after the installation is completed.

        Comment

        Working...