Ad Widget

Collapse

Items, scripts and arguments

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nicolasfo
    Member
    • Jul 2015
    • 56

    #1

    Items, scripts and arguments

    Hello,

    I have to parse a file (let's say results.txt) like this :
    Code:
    element1 10000
    element2 2403900
    element3 698400
    element1, element2 and element3 are already knwown by Zabbix by a Discovery.

    I've made a shell script (parse.sh) like this :
    Code:
    #!/bin/sh
    
    cat result.txt | grep $1 | awk '{print $2}'
    If I call this script like this :
    sh parse.sh element1
    The result is 10000 etc... and this is what I want to do with Zabbix.

    I want Zabbix get the values contained in the txt file by using the script and to be able to pass arguments(Discovers elements) to this script to get the correct value.

    I really don't know in wich direction to go.

    Could someone help ?

    Thanks in advance

    Nicolas
  • Colttt
    Senior Member
    Zabbix Certified Specialist
    • Mar 2009
    • 878

    #2
    you can do this by a discovery rule!

    first create a LLD (low-level-discovery) rule to get element1/2/3..
    second create an item based on the lld that runs you script and the given parameter (element1).. thats it
    Debian-User

    Sorry for my bad english

    Comment

    Working...