Ad Widget

Collapse

Multiple UserParameters with only one script execution

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Matthieu
    Member
    • Mar 2011
    • 41

    #1

    Multiple UserParameters with only one script execution

    Hi,

    I've a script who return a list of integer(187;97;28816867;58772952;67;97).
    To extract each value as a zabbix parameter I've add multiple UserParameter in my zabbix-agentd.conf.

    Code:
    UserParameter=mscpt.minsize,/usr/bin/python /home/mscr.py zabbix cut -f1 -d";"
    UserParameter=mscpt.maxsize,/usr/bin/python /home/mscr.py zabbix cut -f1 -d";"
    ....
    But with this, my script is called for each Userparameter. In this example he's called, twice.

    Is it possible to execute only one time my script and after, cut for each Userparameter without use a temporaire file?

    I ask this question because my script take 5 - 10 seconds to execute all his internal commands.


    Thanks

    Matthieu
    Last edited by Matthieu; 06-06-2012, 12:04.
  • elemarmb
    Member
    • Mar 2009
    • 53

    #2
    Within your script create a data file in text format, with integers and keys, then use zabbix_sender to send all data in one time.

    For example, put in the file /tmp/ZabbixMscptStats.Sender :

    hostxxx mscpt.minsize "625659"
    hostxxx mscpt.maxsize "53017"

    Then use in your Python script the line :

    os.system( "/usr/local/sbin/zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -i /tmp/ZabbixMscptStats.Sender" )

    Comment

    • elemarmb
      Member
      • Mar 2009
      • 53

      #3
      ooops, I forgot the need to change the type of your itens to Zabbix Trapper !!!!

      Comment

      • Matthieu
        Member
        • Mar 2011
        • 41

        #4
        Thanks a lot elemarmb for these tips. I'm going to test your solution

        Matthieu

        Comment

        Working...