Ad Widget

Collapse

OS X agent.hostname returns localhost

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mmu
    Junior Member
    • Sep 2019
    • 3

    #1

    OS X agent.hostname returns localhost

    Absolutely loving Zabbix so far but I've run into a little bit of a snag. My intention was to streamline Zabbix agent deployment to the mix of OS X and Linux machines I manage by executing a script to install the zabbix agent and generate the PSK via xCAT and then distribute zabbix_agentd.conf via Puppet. So far, it's worked perfectly except for one stubborn OS X machine. Here is the problem:

    sh-3.2# scutil --get ComputerName
    mac02
    sh-3.2# scutil --get LocalHostName
    mac02
    sh-3.2# scutil --get HostName
    mac02.example.com
    sh-3.2# zabbix_get -s 127.0.0.1 -k "agent.hostname" --tls-connect=psk --tls-psk-identity="$(hostname -s)-PSK" --tls-psk-file=/Users/zabbix/zabbix_agentd.psk
    localhost

    My understanding is that, if there is no Hostname set in zabbix_agentd.conf, that the agent will present the system hostname to the Zabbix server when asking for active checks. This has been the case for every other machine except for mac02. As I'm mostly using active checks, this is a bit of a problem because the Zabbix server has no active checks defined for 'localhost'. It is easily solved by setting 'Hostname=mac02.example.com' but then I have to exclude the machine from my zabbix_agent puppet module.

    Here is the output from one of the other OS X workstations.

    sh-3.2# scutil --get HostName
    mac01.example
    sh-3.2# scutil --get LocalHostName
    mac01
    sh-3.2# scutil --get ComputerName
    mac01
    sh-3.2# zabbix_get -s 127.0.0.1 -k "agent.hostname" --tls-connect=psk --tls-psk-identity="$(hostname -s)-PSK" --tls-psk-file=/Users/zabbix/zabbix_agentd.psk
    mac01.example.com

    Both machines have exactly the same zabbix_agentd.conf file. Out of 20 OS X workstations and hundreds of Linux servers, this is the only one not behaving as expected. Does anyone have ideas?

    Thanks,

    Matt
    Last edited by mmu; 04-10-2019, 17:21.
  • mmu
    Junior Member
    • Sep 2019
    • 3

    #2
    I've reinstalled the client, set the hostname with 'scutil --set HostName mac02.example.com; scutil --set ComputerName mac02; scutil --set LocalComputerName mac02', and rebooted several times now as SIP doesn't allow me to restart the daemon but agent.hostname is still 'localhost'. I also neglected to mention the agent version, which is 4.2.6 and was installed with one of the binaries available on the download page. zabbix_agent-4.2.6-macos-amd64-openssl.pkg

    Comment

    • mmu
      Junior Member
      • Sep 2019
      • 3

      #3
      Oh well. I never got to the bottom of this but I removed the agent completely and ran my install script again. That fixed the problem.

      Comment

      Working...