I will start by saying I am a Zabbix noob. Getting things monitored with Zabbix agents was so easy I thought I'd try and be clever...
I have a system with a bunch of data that is accessible via a REST API. I have created 2 scripts that call the API and get data. The first returns a list of items that I have counters for:
key:get-items.sh
The second script uses the {#NAME} as a parameter to the REST API to get the counters for that specific item. So the data for TEST1 is:
key: get-counters.sh[{#NAME}]
What I was initially hoping to do was create a bunch of "hosts" and add each of the counters to those hosts as items, then create triggers, graphs, etc.
From what I've read that didn't seem possible so I created a host and added a discovery rule to it which called the first script and as a filter used {#NAME}. Then added an item that passed the {#NAME} to the second script which I collected the data as text. This works, in so much as it does show the data was collected, i.e. there are 2 discovered items and the content of those items is the JSON from the second script but this is little help as I can't work out how to get from there to TEST1.SHUTDOWN_FAIL.COUNTER_CURRENT=3.
What I am getting to is this is not the right approach and I am missing something, but I don't what.
I did find this but it wasn't enough help for me: https://www.zabbix.com/forum/showthr...evel+discovery
Incidentally I am not attached to anything I have done with Zabbix or the scripts I have written. If the answer is throw it away and do it like this, I'll be happy because at least I'll know what this is!
I have a system with a bunch of data that is accessible via a REST API. I have created 2 scripts that call the API and get data. The first returns a list of items that I have counters for:
key:get-items.sh
Code:
{
"data": [
{
"{#NAME}": "TEST1"
},
{
"{#NAME}": "TEST2"
}]
}
key: get-counters.sh[{#NAME}]
Code:
{
"data": [
{
"{#COUNTER_TYPE}": "STARTUP_FAIL",
"{#COUNTER_CURRENT}": 1,
"{#COUNTER_MAX}": 3
},
{
"{#COUNTER_TYPE}": "SHUTDOWN_FAIL",
"{#COUNTER_CURRENT}": 3,
"{#COUNTER_MAX}": 10
}]
}
From what I've read that didn't seem possible so I created a host and added a discovery rule to it which called the first script and as a filter used {#NAME}. Then added an item that passed the {#NAME} to the second script which I collected the data as text. This works, in so much as it does show the data was collected, i.e. there are 2 discovered items and the content of those items is the JSON from the second script but this is little help as I can't work out how to get from there to TEST1.SHUTDOWN_FAIL.COUNTER_CURRENT=3.
What I am getting to is this is not the right approach and I am missing something, but I don't what.
I did find this but it wasn't enough help for me: https://www.zabbix.com/forum/showthr...evel+discovery
Incidentally I am not attached to anything I have done with Zabbix or the scripts I have written. If the answer is throw it away and do it like this, I'll be happy because at least I'll know what this is!