Ad Widget

Collapse

Discovery Counters, php endpoint using json

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Neil.CrispT
    Junior Member
    • Apr 2017
    • 1

    #1

    Discovery Counters, php endpoint using json

    Hi,

    Im using Zabbix for the first time, and have the server installed fine, along with a few other machines with the agent running collecting cpu/mem data etc. However i am wanting to create discovery counters which im currently struggling with.

    in the zabbix_agentd.conf file following two lines setup
    UserParameter=FailedCounters,php /var/www/html/stats-json.php
    UserParameter=FailedCounterNames,php /var/www/html/counter.php $1

    excuse the names at the moment, as ive not put much effort in them for now. the first one 'FailedCounters' when used outputs a list of all my failed counters in json format, as example below

    {
    "data": [
    {
    "{#COUNTERNAME}": "curlrequest.failed"
    },
    {
    "{#COUNTERNAME}": "gearmanjob.failed"
    },
    {
    "{#COUNTERNAME}": "RequiredXPath.failed"
    }
    ]
    }
    then the second one, uses the counter name as the argument which is passed in, to return a numeric value eg

    893
    In the zabbix dashboard under "Discovery", i created the following:
    Name: FailedCountersDiscovery
    Type: Zabbix agent
    Key: FailedCounters

    my understanding is that key is used to call the counter in the config file for the agent, UserParameter=FailedCounters.

    This appears to be working as i can see under latest data / others a list of counter names for each one that is in the json document example.


    I then have an Item Prototypes setup, with the following.

    Name: FailedCounterNames $1
    Type: Zabbix agent
    Key: FailedCounterNames[{#COUNTERNAME}]

    after doing some reading i beleive i should be using something more along the lines of.. FailedCounterNames[{#COUNTERNAME}]
Working...