Ad Widget

Collapse

Usnig a script to obtain an index and then make a query based on that index

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NeoFireRaziel
    Junior Member
    • Sep 2013
    • 16

    #1

    Usnig a script to obtain an index and then make a query based on that index

    Hello to all again. Please I need your help to do the following:

    I need to make a template in Zabbix to do several SNMP queries to a specific device based on his MAC address. I have the OIDs that I need, but
    the problem is that I need to specify an index that represents the particular device that I want to query: For example (I use an imaginary OID, as an example):

    1.2.3.4.100.device_index
    1.2.3.4.101.device_index
    1.2.3.4.102.device_index
    1.2.3.4.103.device_index
    1.2.3.4.104.device_index
    1.2.3.4.105.device_index
    1.2.3.4.106.device_index
    1.2.3.4.107.device_index

    There are several devices and obiously one index per device. Note if that i do a "snmpwalk" to the OID (1.2.3.4 in this case) I obtain the value for all the devices, but I need it only for one specific device.

    I have a PHP script that obtains the index of the particular device that I need based on his MAC. Then I need that Zabbix invokes this script using the MAC as a parameter, obtain the index and then execute the query. Is this possible?

    Thanks a lot and best regards,

    Mauro.
  • NeoFireRaziel
    Junior Member
    • Sep 2013
    • 16

    #2
    I was able to make an external script (in PHP) to obtain the desired index based on the host IP (using the macro {HOST.IP} as a parameter for the script). This external script is used in an item (called "Host index"), so now I can get the index for every desired host. The following is the configuration for that item:

    Name: Device index
    Type: External check
    Key: device_index.php["{HOST.IP}"]
    Type of information: Numeric (unsigned)
    Data type: Decimal

    That's work perfectly, but now I'm trying to use this item as a part of the SNMP OID for other item, but I can't figure out how to do this. The following is the configuration for this new item (the first part of the OID is simply an example):

    Name: Device parameter
    Type: SNMPv2 agent
    SNMP OID: 1.2.3.4.100.{device_index.php["{HOST.IP}"]}

    And it doesn't work. This is the error message that I get: "Invalid SNMP OID at position 62".

    So, can anyone help me to make this work? Basically I need to use a return value of an item (an unsigned integer) as a part of an SNMP OID.

    Thanks a lot and best regards!

    Mauro.

    Comment

    Working...