Ad Widget

Collapse

API Zabbix 6.4 - Item.get return item value with preprocessing and value map

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gnascimento
    Junior Member
    • Mar 2024
    • 1

    #1

    API Zabbix 6.4 - Item.get return item value with preprocessing and value map

    Hi everyone, I'ved some difficulties with zabbix API when i get item objects.
    Exist a someway to get item last value, using the API, with the preprocessing aplicate ? Or the unique form is aplicate the preproccesment with a programming language after get the data?

    Exemple:
    {
    "jsonrpc": "2.0",
    "method": "item.get",
    "params": {
    "output": "extend",
    "hostids": "10603",
    "with_triggers": true,
    "selectValueMap": ["mappings"],
    "selectPreprocessing": "extend",
    "search": {
    "key_": ""
    },
    "sortfield": "name"
    },
    "id": 1,
    "auth": "*********************"
    }

    Response:
    {
    "itemid": "54714",
    "type": "20",
    "snmp_oid": "1.3.6.1.2.1.31.1.1.1.15.37",
    "hostid": "10603",
    "name": "Interface XGigabitEthernet0/0/31(): Speed",
    "key_": "net.if.speed[ifHighSpeed.37]",
    "delay": "5m",
    "value_type": "3",
    "preprocessing": [
    {
    "type": "1",
    "params": "1000000",
    "error_handler": "0",
    "error_handler_params": ""
    },
    {
    "type": "20",
    "params": "1h",
    "error_handler": "0",
    "error_handler_params": ""
    }
    ],
    "valuemap": [],
    "parameters": [],
    "lastclock": "1709602313",
    "lastns": "444924369",
    "lastvalue": "10000000000", -> How to apply preprocessing on this value in every API call and, if possible, apply value map
    "prevvalue": "10000000000"
    },

    Thank you very much in advance
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    I think saved value is already gone through all the preprocessing. Nothing to apply there any more.
    API returns config of things, if you need to apply value map here, you need to do it in your script, first find out what is the value map (different call) and then apply it.

    Comment

    Working...