Ad Widget

Collapse

external scripts for discovery

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yuusou
    Junior Member
    • Feb 2014
    • 24

    #1

    external scripts for discovery

    Situation:
    I have created an external script which outputs the following:
    Code:
    {
    	"data":[
    		{"{#INDEX}":"1.1","{#VALUE}":"GigabitEthernet0/0: unknown"},
    		{"{#INDEX}":"1.2","{#VALUE}":"GigabitEthernet0/0: ftp"},
    		{"{#INDEX}":"1.3","{#VALUE}":"GigabitEthernet0/0: http"},
    	]
    }
    I can get this output manually using:
    Code:
    sudo /etc/zabbix/externalscripts/nbarInterface -l pub 172.17.71.172
    I've set it up as a Discovery. The string to call it is:
    Code:
    nbarInterface["-l",{$SNMP_COMMUNITY},{HOST.CONN}]
    I've got in this Discovery various items which output something similar to:
    Code:
    {
    	"data":[
    		{"{#DATA}":"392729904"},
    	]
    }
    I can get this output manually using:
    Code:
    sudo /etc/zabbix/externalscripts/nbarInterface -o pub 172.17.71.172 7 1.3
    The string in Zabbix to call it is:
    Code:
    nbarInterface["-o",{$SNMP_COMMUNITY},{HOST.CONN},"7",{#INDEX}]


    Issue:
    It doesn't work, unfortunately.
    At first I thought the script was timing out, but manually running the script with | pv, the worst case took 14 seconds (668 items) and my external check timeout for zabbix-server is 30 seconds.

    Any suggestions on how I can get this to work?
    I'm running 2.2.2 on CentOS 6 and a Percona XtraDB Cluster 5.6 (MySQL) database server.
  • aib
    Senior Member
    • Jan 2014
    • 1615

    #2
    I cannot give you any advice.
    But I have only small note - in Zabbix 2.2.2 the XML parser doesn't allow the last comma before "]}".
    In previous version the XML parser was more favorable to small errors.

    Please, be careful with syntax of XML output which your script provide.
    Sincerely yours,
    Aleksey

    Comment

    • yuusou
      Junior Member
      • Feb 2014
      • 24

      #3
      Thanks for the heads up. I left the comma in there because it was present in most examples I read. Perhaps that will make it tick. I've edited my script but will only have GUI access tomorrow.

      EDIT: That was enough to get the script populating the device with the items. The script wasn't fetching the items but that was over-complicating it anyway. I ended up using actual SNMP items and that was enough to make it work.
      Last edited by yuusou; 27-02-2014, 14:42.

      Comment

      Working...