Ad Widget

Collapse

External Checks, and my gentle decent into madness

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jnewton
    Junior Member
    • Jul 2020
    • 2

    #1

    External Checks, and my gentle decent into madness

    So I have a network device that I need to retrieve some values from, and unfortunately I can't do it with SNMP. Instead I have decided to do it via an external script which will SSH into the box, retrieve the values, format it nicely as JSON and return this to Zabbix. As part of my proof of concept for this I've created a bash script that just echo's some test JSON values to the shell:
    {"data": [{"NAME": "port1","RX": 1,"TX": 2},{"NAME": "port2","RX": 3,"TX": 4}]}
    What I want to do is create a LLD template that will discover my two ports, them have some prototypes start recording the TX and RX values relevant to each port. Now I think I may be missing something, but I don't understand how the prototype actually addresses that data that I want it to receive? I've managed to get as far as having it return ALL the values for 'RX' for each prototype, but this isn't very helpful to me. I want it to return the value specific to the particular port. I feel this should be something really easy to do, but I'm just not getting it.

    I'm very new to Zabbix, so please feel free to call me mock my lack of knowledge, or call me names, but if someone can point me in the right direction I would be forever grateful...
  • jnewton
    Junior Member
    • Jul 2020
    • 2

    #2
    For anyone interested. I did eventually solve this problem. The whole issue was due to my own failure to grasp exactly how prototypes work in Zabbix. I was attempting to use the prototype to store the actual TX and RX values returned by my script. This is not the correct logic. Instead the Discovery rule is used to build a list of those metrics you are interested in polling. If you want to poll the TX and RX bytes on an interface, the discovery rule should return a list of interfaces (perhaps with some other values like ifindex or ifdescription that you can add to protoytypes so they make more sense).

    In my case I ended up creating two scripts, one for the discovery rule, which returns interface name and index values in JSON format for the whole device. The second script is for the prototypes. For every interface discovered in my discovery rule, the script is sent a corresponding index value from Zabbix, it also receives a static identifier that tells it which metric I am interested in learning about relative to that particular index (TX for example). The script will then return a single value. You create a new script for each prototype.

    Posted in the hope that it might help someone in future.

    Comment

    Working...