Ad Widget

Collapse

Buling a monitor that uses a Python script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ivgenyr
    Junior Member
    • Jun 2020
    • 17

    #1

    Buling a monitor that uses a Python script

    Hi,
    after going through the documentation, it's still unclear to me..
    What i want to do it:

    I have a python script, that runs some tests and return a result with 2 metrics.
    Script is deployed on the monitored host.
    I need to define the Zabbig agent to run the script, get the metrics reported by it, and provide them to the Zabbix server.

    My Zabbix server version is 5, running on CentOS 7
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    Defining your own items and having the Zabbix agent run custom commands (including scripts) is covered in the "UserParameter" section of the items documentation: https://www.zabbix.com/documentation...userparameters

    Because you've said your script reports more than one metric, you should probably also read the section about "Dependent" items: https://www.zabbix.com/documentation...ependent_items

    Comment

    • ivgenyr
      Junior Member
      • Jun 2020
      • 17

      #3
      Thanks tim.mooney !

      Another thing i still can't figure out:

      My script is returning the following output -
      Code:
      C2 - OK - 2.15 ms
      How can i configure the Zabbix item to consider each part (there are 3 ) here as a different metric ?
      Do i need 3 items for this ? of can i do it with 1 item only ?

      Comment

      • ivgenyr
        Junior Member
        • Jun 2020
        • 17

        #4
        OK, so i found it in the meanwhile :-).
        So, for anyone who might be seeking for an answer to this:
        1. Create an item that will get the info from the agent.
        2. Create another item ("dependant item") with preprocessing rule, and use regex to extract the reuired part of the data.
        3. Now you can create a trigger for the dependant item, and set a threshold.

        Comment

        Working...