Ad Widget

Collapse

Creating/deleting/linking to template without UI

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hichhiker
    Member
    • Nov 2004
    • 45

    #1

    Creating/deleting/linking to template without UI

    I need to automatically add, remove and modify hosts and their linked templates in Zabbix 1.6.5.

    As I understand, there is no API at the moment to do so, so I need to either cannibalize the existing PHP frontend UI to do this, or just write directly to DB. Can't say I am thrilled with either solution - so am I missing anything here, and are there any pitfalls to watch out for? Anyone done this already?

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

    #2
    Unfortunately you'll need to massage the DB directly. It's not quite for the faint of heart though.
    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

    • Hichhiker
      Member
      • Nov 2004
      • 45

      #3
      Thanks. That is unfortunate.

      After glancing at the frontend code, it seems that the only thing stopping us from being able to just hit the frontend using something like curl is authentication. I switched the auth on frontend to HTTP (Basic auth), but it seems that auth code forces a redirect to index.php on login regardless. I would imagine it should be simple to fix that by including the login code on every page, but I will need to check to see if that is feasible (at first glance login logic seemed a bit confusing).

      Comment

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

        #4
        There is hope at hand!!!



        This was a small script I posted for someone who wanted to pull a graph which required authentication. You can use this as a basis for creating a set of wget and curl statements to get the job done. :-)
        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

        Working...