Ad Widget

Collapse

Exporting list of Hostnames in Zabbix

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • agentguerry
    Member
    • Jul 2009
    • 45

    #1

    Exporting list of Hostnames in Zabbix

    Hi all,

    I am trying to find the easiest way to export a list of all the hostnames in my zabbix database, either by the gui, or possibly in the mysql database.

    Could anyone point me in the right direction for this?

    I just want to pull the hostnames/servernames, and put them into an excel or even a txt document.

    Thank you in advance,

    agentguerry
  • trikke
    Senior Member
    • Aug 2007
    • 140

    #2
    easy one:

    /opt/mysql/bin/mysql -u <user> -p <password> <db-name> "select name,dns,ip from hosts ;"

    Lists the Zabbix Name, the DNS-name of this host and the IP of this host.

    Greets
    Patrick

    Comment

    • nelsonab
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Sep 2006
      • 1233

      #3
      in zabcon:
      get host


      If you have more than 100 hosts you will need to up the limit for example
      get host limit=200


      If you want to do it from the command line

      echo "get host limit=200" | zabcon.rb --no-echo --no-header
      RHCE, author of zbxapi
      Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
      Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

      Comment

      • agentguerry
        Member
        • Jul 2009
        • 45

        #4
        Thanks Trikke!

        Worked wonderfully!

        Comment

        Working...