Ad Widget

Collapse

Version control of templates with github

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brambo
    Senior Member
    • Jul 2023
    • 245

    #1

    Version control of templates with github

    I'm wondering if anyone use Github for version controll of templates and by this tracking changes.
    I know I can export a template and the push this toward Git only I hope that this could be done a bit easier and also more fool proof where a 'wrong template' is push toward a certain project folder.
    And a 'export all templates' isn't really good practice in my opinion.
    So I'm open for ideas / best practice to approach this 'issue'
  • Answer selected by Brambo at 28-02-2024, 16:02.
    Brambo
    Senior Member
    • Jul 2023
    • 245


    Well as I'm started to build my own solution with use of the zabbix API I run into 1 strange problem
    First I use
    Code:
    {"jsonrpc": "2.0","method": "template.get","params": {"output": "extend"},"id":1}
    With in the headers a token which i created.
    The code return 22 items in my situation which are the 22 templates I want to backup.
    next I use this
    Code:
    {"jsonrpc": "2.0","method": "configuration.export","params": { "options": { "templates": ["' +$id + '"]},"format": "xml"},"id": 1}'
    Where the +$id+ is replaced with the ID's of the first api-call
    This work perfectly fine for 21 templates. And 1 is failing on:
    {
    "jsonrpc": "2.0",
    "error": {
    "code": -32500,
    "message": "Application error.",
    "data": "No permissions to referred object or it does not exist!"
    },
    "id": 1
    }
    Using postman I received the same error.
    I made a full-clone of this template to check if something was stuck there. After deleting the 'old' template the problem moved the new cloned template.
    Could it be that there is something in the security setting which you can't see in a normal way?
    ^^ fixt this. The rule contained a host prototype in the discovery rule. And when you have this it appears that you need host group read rights in the User group role to be able to make an export by API.
    Why this is made this way, I don't know, but I'm glad I found the reason why.
    Last edited by Brambo; 27-02-2024, 15:47.

    Comment

    • Brambo
      Senior Member
      • Jul 2023
      • 245

      #2

      Well as I'm started to build my own solution with use of the zabbix API I run into 1 strange problem
      First I use
      Code:
      {"jsonrpc": "2.0","method": "template.get","params": {"output": "extend"},"id":1}
      With in the headers a token which i created.
      The code return 22 items in my situation which are the 22 templates I want to backup.
      next I use this
      Code:
      {"jsonrpc": "2.0","method": "configuration.export","params": { "options": { "templates": ["' +$id + '"]},"format": "xml"},"id": 1}'
      Where the +$id+ is replaced with the ID's of the first api-call
      This work perfectly fine for 21 templates. And 1 is failing on:
      {
      "jsonrpc": "2.0",
      "error": {
      "code": -32500,
      "message": "Application error.",
      "data": "No permissions to referred object or it does not exist!"
      },
      "id": 1
      }
      Using postman I received the same error.
      I made a full-clone of this template to check if something was stuck there. After deleting the 'old' template the problem moved the new cloned template.
      Could it be that there is something in the security setting which you can't see in a normal way?
      ^^ fixt this. The rule contained a host prototype in the discovery rule. And when you have this it appears that you need host group read rights in the User group role to be able to make an export by API.
      Why this is made this way, I don't know, but I'm glad I found the reason why.
      Last edited by Brambo; 27-02-2024, 15:47.

      Comment

      Working...