Ad Widget

Collapse

Item Prototype based on external LLD check not populating

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gurp
    Junior Member
    • Aug 2014
    • 3

    #1

    Item Prototype based on external LLD check not populating

    5269:20140801:161033.196 Starting Zabbix Server. Zabbix 2.2.4 (revision 46772).
    5269:20140801:161033.197 ****** Enabled features ******
    5269:20140801:161033.197 SNMP monitoring: YES
    5269:20140801:161033.197 IPMI monitoring: YES
    5269:20140801:161033.197 WEB monitoring: YES
    5269:20140801:161033.197 VMware monitoring: YES
    5269:20140801:161033.197 Jabber notifications: YES
    5269:20140801:161033.197 Ez Texting notifications: YES
    5269:20140801:161033.197 ODBC: YES
    5269:20140801:161033.197 SSH2 support: YES
    5269:20140801:161033.197 IPv6 support: YES
    5269:20140801:161033.197 ******************************
    5269:20140801:161033.197 using configuration file: /etc/zabbix/zabbix_server.conf
    5269:20140801:161033.659 current database version (mandatory/optional): 02020000/02020001
    5269:20140801:161033.659 required mandatory version: 02020000


    [root@zabbix-server zabbix]# mysql -u zabbix_user
    Welcome to the MariaDB monitor. Commands end with ; or \g.
    Your MariaDB connection id is 1272
    Server version: 10.0.11-MariaDB MariaDB Server

    Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    MariaDB [(none)]> \s
    --------------
    mysql Ver 15.1 Distrib 10.0.11-MariaDB, for Linux (x86_64) using readline 5.1

    Connection id: 1272
    Current database:
    Current user: zabbix_user@localhost
    SSL: Not in use
    Current pager: stdout
    Using outfile: ''
    Using delimiter: ;
    Server: MariaDB
    Server version: 10.0.11-MariaDB MariaDB Server
    Protocol version: 10
    Connection: Localhost via UNIX socket
    Server characterset: latin1
    Db characterset: latin1
    Client characterset: utf8
    Conn. characterset: utf8
    UNIX socket: /var/lib/mysql/mysql.sock
    Uptime: 80 days 23 hours 58 min 11 sec

    Threads: 1 Questions: 5186 Slow queries: 0 Opens: 109 Flush tables: 1 Open tables: 117 Queries per second avg: 0.000
    --------------

    MariaDB [(none)]>



    [root@zabbix-server zabbix]# uname -a
    Linux zabbix-server.xxxxxxxx.com 2.6.32-431.17.1.el6.x86_64 #1 SMP Wed May 7 23:32:49 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

    The Discovery Rule looks like this:

    Name: Interfaces
    Type: External check
    Key: ifDiscover.rb[{$SNMP_COMMUNITY},{HOST.CONN}]

    The ifDiscover.rb script looks like this:

    #!/usr/bin/ruby
    require 'rubygems'
    require 'snmp'

    File.open("/usr/lib/zabbix/externalscripts/ifDiscover.log", mode="a") do |f| f.puts ARGV end

    unless ARGV.length == 2
    $stderr.puts "ex: #{$PROGRAM_NAME} <community> <ipaddress>"
    exit
    end

    community = ARGV[0]
    ip = ARGV[1]

    puts "{"
    puts %("data":[)


    ifTable_columns = ["ifIndex", "ifDescr", "ifAlias"]
    SNMP::Manager.open(:Host => ip, :Community => community) do |manager|
    manager.walk(ifTable_columns) do |row|
    if row[2].value.is_a?(String)
    ifAlias = row[2].value.gsub('"','')
    else
    ifAlias = ''
    end
    puts %({ "{#SNMPINDEX}":"#{row[0].value}", "{#IFDESCR}":"#{row[1].value}", "{#IFALIAS}":"#{ifAlias}" },)
    end
    end

    puts "]"
    puts "}"

    It generates output that looks like this:

    {
    "data":[
    { "{#SNMPINDEX}":"1", "{#IFDESCR}":"GigabitEthernet1/1", "{#IFALIAS}":"26135AccessData VRF->Base" },
    { "{#SNMPINDEX}":"2", "{#IFDESCR}":"GigabitEthernet1/2", "{#IFALIAS}":"26135AccessData Base->VRF" },
    { "{#SNMPINDEX}":"3", "{#IFDESCR}":"GigabitEthernet1/3", "{#IFALIAS}":"12255/42190 - Standard Plumbing VRF->Base" },
    { "{#SNMPINDEX}":"4", "{#IFDESCR}":"GigabitEthernet1/4", "{#IFALIAS}":"12255/42190 - Standard Plumbing Base->VRF" },
    { "{#SNMPINDEX}":"5", "{#IFDESCR}":"GigabitEthernet1/5", "{#IFALIAS}":"30242LarkinMort VRF->Base" },
    { "{#SNMPINDEX}":"6", "{#IFDESCR}":"GigabitEthernet1/6", "{#IFALIAS}":"30242LarkinMort Base->VRF" },
    { "{#SNMPINDEX}":"7", "{#IFDESCR}":"GigabitEthernet1/7", "{#IFALIAS}":"53085 - Ingram Medical VRF->Base" },
    { "{#SNMPINDEX}":"8", "{#IFDESCR}":"GigabitEthernet1/8", "{#IFALIAS}":"53085 - Ingram Medical Base->VRF" },
    { "{#SNMPINDEX}":"9", "{#IFDESCR}":"GigabitEthernet1/9", "{#IFALIAS}":"53085 - Ingram Medical Pharmacies VRF->Base" },
    { "{#SNMPINDEX}":"10", "{#IFDESCR}":"GigabitEthernet1/10", "{#IFALIAS}":"53085 - Ingram Medical Pharmacies Base->VRF" },
    ]
    }

    My Item Prototype(s) look like this:

    Name: Incoming traffic on $1:$2
    Type: SNMPv2 agent
    Key: ifInOctets[{#IFDESCR},{#IFALIAS}]
    SNMP OID: IF-MIB::ifHCInOctets.{#SNMPINDEX}
    SNMP community: {$SNMP_COMMUNITY}
    Port: <left blank>
    Type of information: Numeric (unsigned)
    Data type: Decimal
    Units: bps
    Use customer multiplier: <checked> 8
    Store value: Delta (speed per second)
    Enabled: <checked>

    But the Items never populate. I've had this exact same LLD rule/script/item-prototype running on FreeBSD 9.x/zabbix 2.2.2/Postgres 9.x and it runs just fine. In fact, this was mostly just copy-n-pasted from that setup.

    I've verified that the external script is in fact getting ran with the correct parameters.

    Can anyone see any problem with this configuration? This is driving me NUTS!

    Any help would be appreciated.

    Thanks in advance.
  • evertonco
    Member
    • Aug 2014
    • 75

    #2
    Go to "Latest Data" page. Select a host that has this LLD and marks "show items without data" to can view the possible errors.

    Comment

    • Gurp
      Junior Member
      • Aug 2014
      • 3

      #3
      @evertonco, I appreciate your reply. I've done what you suggested and I don't get any items showing up with errors... That's the problem. The Items don't show up.

      I've investigated this further and I think we've found a bug. I have verified that the external script runs and runs correctly. I went back to a Zabbix 2.2.2 server that I had a backup of and I revived it. I found that I had some hosts connected to this template that the items would populate and others that don't. Then I exported the template and imported into my 2.2.5 server and attached the SAME hosts to the template and none of them would populate.

      I spun up an old 2.0.6 server and all the hosts/items would populate. I exported that template and imported into my 2.2.5 and none would populate... all while verifying that external script is running and producing correct results.

      Comment

      • danrog
        Senior Member
        • Sep 2009
        • 164

        #4
        Based on the output, you have 'invalid' JSON because of the very last comma on the last row. Zabbix is very picky when it comes to JSON formatting:

        {
        "data":[
        { "{#SNMPINDEX}":"1", "{#IFDESCR}":"GigabitEthernet1/1", "{#IFALIAS}":"26135AccessData VRF->Base" },
        { "{#SNMPINDEX}":"2", "{#IFDESCR}":"GigabitEthernet1/2", "{#IFALIAS}":"26135AccessData Base->VRF" },
        { "{#SNMPINDEX}":"3", "{#IFDESCR}":"GigabitEthernet1/3", "{#IFALIAS}":"12255/42190 - Standard Plumbing VRF->Base" },
        { "{#SNMPINDEX}":"4", "{#IFDESCR}":"GigabitEthernet1/4", "{#IFALIAS}":"12255/42190 - Standard Plumbing Base->VRF" },
        { "{#SNMPINDEX}":"5", "{#IFDESCR}":"GigabitEthernet1/5", "{#IFALIAS}":"30242LarkinMort VRF->Base" },
        { "{#SNMPINDEX}":"6", "{#IFDESCR}":"GigabitEthernet1/6", "{#IFALIAS}":"30242LarkinMort Base->VRF" },
        { "{#SNMPINDEX}":"7", "{#IFDESCR}":"GigabitEthernet1/7", "{#IFALIAS}":"53085 - Ingram Medical VRF->Base" },
        { "{#SNMPINDEX}":"8", "{#IFDESCR}":"GigabitEthernet1/8", "{#IFALIAS}":"53085 - Ingram Medical Base->VRF" },
        { "{#SNMPINDEX}":"9", "{#IFDESCR}":"GigabitEthernet1/9", "{#IFALIAS}":"53085 - Ingram Medical Pharmacies VRF->Base" },
        { "{#SNMPINDEX}":"10", "{#IFDESCR}":"GigabitEthernet1/10", "{#IFALIAS}":"53085 - Ingram Medical Pharmacies Base->VRF" },
        ]
        }

        Should look like

        {
        "data":[
        { "{#SNMPINDEX}":"1", "{#IFDESCR}":"GigabitEthernet1/1", "{#IFALIAS}":"26135AccessData VRF->Base" },
        { "{#SNMPINDEX}":"2", "{#IFDESCR}":"GigabitEthernet1/2", "{#IFALIAS}":"26135AccessData Base->VRF" },
        { "{#SNMPINDEX}":"3", "{#IFDESCR}":"GigabitEthernet1/3", "{#IFALIAS}":"12255/42190 - Standard Plumbing VRF->Base" },
        { "{#SNMPINDEX}":"4", "{#IFDESCR}":"GigabitEthernet1/4", "{#IFALIAS}":"12255/42190 - Standard Plumbing Base->VRF" },
        { "{#SNMPINDEX}":"5", "{#IFDESCR}":"GigabitEthernet1/5", "{#IFALIAS}":"30242LarkinMort VRF->Base" },
        { "{#SNMPINDEX}":"6", "{#IFDESCR}":"GigabitEthernet1/6", "{#IFALIAS}":"30242LarkinMort Base->VRF" },
        { "{#SNMPINDEX}":"7", "{#IFDESCR}":"GigabitEthernet1/7", "{#IFALIAS}":"53085 - Ingram Medical VRF->Base" },
        { "{#SNMPINDEX}":"8", "{#IFDESCR}":"GigabitEthernet1/8", "{#IFALIAS}":"53085 - Ingram Medical Base->VRF" },
        { "{#SNMPINDEX}":"9", "{#IFDESCR}":"GigabitEthernet1/9", "{#IFALIAS}":"53085 - Ingram Medical Pharmacies VRF->Base" },
        { "{#SNMPINDEX}":"10", "{#IFDESCR}":"GigabitEthernet1/10", "{#IFALIAS}":"53085 - Ingram Medical Pharmacies Base->VRF" }
        ]
        }

        Comment

        • Gurp
          Junior Member
          • Aug 2014
          • 3

          #5
          Solved

          @danrog - THANK YOU! That was it.

          Comment

          Working...