Ad Widget

Collapse

Template where it stores

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zabb_neil
    Junior Member
    • Dec 2010
    • 3

    #1

    Template where it stores

    Hi
    Can anybody tell me where the new templates actually gets stored. Does it stored in mysql database? I am trying to export the template through template.php but what i get is blank file. Is anybody facing the same problem....?

    Regards,
    NM
  • nelsonab
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2006
    • 1233

    #2
    Templates are a special form of host, and are thus stored in the MySQL database.

    It also appears that template export is broken in 1.8.4rc4.
    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

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

      #3
      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

      • db100
        Member
        • Feb 2023
        • 61

        #4
        is it possible to import templates programmatically, or perhaps even with an INSERT sql query in zabbix ? or is the only way going through the GUI ?

        Comment

        • cyber
          Senior Member
          Zabbix Certified SpecialistZabbix Certified Professional
          • Dec 2006
          • 4807

          #5
          Originally posted by db100
          is it possible to import templates programmatically, or perhaps even with an INSERT sql query in zabbix ? or is the only way going through the GUI ?
          Theres also an API... https://www.zabbix.com/documentation...rence/template
          I would avoid any direct interaction with DB as much as possible... Selects would be ok, but inserts... no, do not go there...

          Comment

          • db100
            Member
            • Feb 2023
            • 61

            #6
            thanks for the answer ... yes i know the API, i forgot to mention it indeed ..

            thing is, i have the need to cretae a startup procedure for zabbix pods in kubernetes, that should load a set of k8s resources (such as config maps, etc.) as templates in zabbix ... so the easiest approach would have been loading those from files, since it is farily easy to mount configMaps as volumes inside the pod.

            i am guessing here that the only 2 options i have are to interact to the API via a initContainer or having to create my custom k8s operator.. i guess there is no official one in the zabbix community right ?

            in general, i prefer interacting with the DB just because i can skip authentication, but yes i see the point.

            any suggestion as of which way would be best ? (btw the same would need to be done for actions, mediaitems, etc. ...)

            Comment

            • cyber
              Senior Member
              Zabbix Certified SpecialistZabbix Certified Professional
              • Dec 2006
              • 4807

              #7
              Config export/import... https://www.zabbix.com/documentation...uration/export
              Still seems easiest way... export to file, import from file.. For actions you probably need extra steps, those are not covered in config in some reason..

              Comment

              • db100
                Member
                • Feb 2023
                • 61

                #8
                well ok, i just wanted a confirmation from a PRO that this was the only way to achieve this. thanks you!

                then i now maybe understand why this guys decided to embed ansible inside a k8s operator https://www.youtube.com/watch?v=WYIHstLZIvg

                ... although maybe the idea never took off ...

                Comment

                Working...