Hello everyone.
Basically I need to use the previous to last index of an OID in a discovery rule, on OIDs that use two indices to identify an object. This is used by various devices, where the last index identifies the device or object to be monitored and the previous index identifies a board, blade, line card, module, etc. where this object is connected.
.x.x.x.x.x.[board].[object]
I have a device that has multiple interfaces and multiple devices connected to each interface, I need to do LLD with all of them.
To discover the interfaces, I make a discovery rule to find them and identify them by name (ifName), with:
discovery[{#IFDESCR},1.3.6.1.2.1.31.1.1.1.1]
...and it works perfectly as in snmpwalk.
iso.3.6.1.2.1.31.1.1.1.1.4194312192 = STRING: "IF 0/1/0"
iso.3.6.1.2.1.31.1.1.1.1.4194312448 = STRING: "IF 0/1/1"
iso.3.6.1.2.1.31.1.1.1.1.4194312704 = STRING: "IF 0/1/2"
iso.3.6.1.2.1.31.1.1.1.1.4194312960 = STRING: "IF 0/1/3"
iso.3.6.1.2.1.31.1.1.1.1.4194313216 = STRING: "IF 0/1/4"
iso.3.6.1.2.1.31.1.1.1.1.4194313472 = STRING: "IF 0/1/5"
iso.3.6.1.2.1.31.1.1.1.1.4194313728 = STRING: "IF 0/1/6"
iso.3.6.1.2.1.31.1.1.1.1.4194313984 = STRING: "IF 0/1/7"
iso.3.6.1.2.1.31.1.1.1.1.4194314240 = STRING: "IF 0/1/8"
iso.3.6.1.2.1.31.1.1.1.1.4194314496 = STRING: "IF 0/1/9"
iso.3.6.1.2.1.31.1.1.1.1.4194314752 = STRING: "IF 0/1/10"
iso.3.6.1.2.1.31.1.1.1.1.4194315008 = STRING: "IF 0/1/11"
iso.3.6.1.2.1.31.1.1.1.1.4194315264 = STRING: "IF 0/1/12"
...
...
For the devices connected on the interfaces, I create another discovery rule, the OIDs of the devices have the format:
1.3.6.1.4.1.2011.6.128.1.1.2.43.1.3.interface.devi ce
So I use:
discovery[{#SERIALNUMBER},1.3.6.1.4.1.2011.6.128.1.1.2.43.1. 3]
...and it works perfectly as in swnmpwalk:
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.0 = Hex-STRING: 48 57 54 43 79 02 C9 30
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.1 = Hex-STRING: 48 57 54 43 79 02 A4 C0
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.2 = Hex-STRING: 48 57 54 43 79 02 61 90
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.3 = Hex-STRING: 48 57 54 43 85 71 F2 9B
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.4 = Hex-STRING: 48 57 54 43 79 02 A7 D0
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.5 = Hex-STRING: 48 57 54 43 EF 29 1A 9C
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.6 = Hex-STRING: 48 57 54 43 85 4F 65 9B
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.7 = Hex-STRING: 48 57 54 43 79 02 5D E0
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.11 = Hex-STRING: 48 57 54 43 79 02 47 C0
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312448.0 = Hex-STRING: 48 57 54 43 2A 77 0F 9B
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312448.1 = Hex-STRING: 48 57 54 43 BA 01 AF 9C
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312448.2 = Hex-STRING: 48 57 54 43 FA F4 8C 9A
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312448.3 = Hex-STRING: 48 57 54 43 79 02 8B 40
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312704.0 = Hex-STRING: 48 57 54 43 79 02 9A F0
...
...
This discovers for me all devices on all interfaces perfectly and identifies them by their physical address.
Then I make an item prototype like:
{#HWADDRESS}: RX
And I get items like:
"485754437902C930:RX"
On the other hand, you can see that each device is related to its interface in the OID, the last index is the device ID [0, 1, 2, 3...] and the previous one is the interface ID [4194312192 , 4194312448, 4194312704...], like this:
4194312192.0
4194312192.1
4194312192.2
4194312192.3
4194312192.4
4194312192.5
4194312192.6
4194312192.7
4194312192.1
4194312448.0
4194312448.1
4194312448.2
4194312448.3
Now I need to improve the device discovery rule, identifying which interface each device is connected to. That is, in addition to the physical address, I want to have the record of the interface to which it is connected.
For the first device in the list, that is, [0], its interface is [4194312192]:
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.0
...and the name for "4194312192" is "IF 0/1/0"
So I want to create items that add the description of the interface to which they are connected, and are named for example as:
{#INTERFACE - #HWADDRESS}: RX
I mean:
"IF 0/1/0 - 485754437902C930:RX"
Or to be added as a value in a new item prototype.
In this case I don't know how to build the "SNMP OID" in the discovery rule.
I was looking in the documentation, but I didn't find anything similar. Basically it is about "reading" the index before the last one (4194312192 in this case) and checking its name against "ifName" to add it to the item. I was looking if it could be done with macros, but without luck.
If this cannot be done, you could see some other alternative, like automatically adding all devices to a group with the name of the interface, created automatically.
Or add another property to the device, like "interface" in the same way that an ethernet interface has the item "type", here it would be "interface".
But in short I will need to use the index before the last (for example 4194312192) in a discovery rule, to use it in an item prototype.
What do you think? Can be done?
Basically I need to use the previous to last index of an OID in a discovery rule, on OIDs that use two indices to identify an object. This is used by various devices, where the last index identifies the device or object to be monitored and the previous index identifies a board, blade, line card, module, etc. where this object is connected.
.x.x.x.x.x.[board].[object]
I have a device that has multiple interfaces and multiple devices connected to each interface, I need to do LLD with all of them.
To discover the interfaces, I make a discovery rule to find them and identify them by name (ifName), with:
discovery[{#IFDESCR},1.3.6.1.2.1.31.1.1.1.1]
...and it works perfectly as in snmpwalk.
iso.3.6.1.2.1.31.1.1.1.1.4194312192 = STRING: "IF 0/1/0"
iso.3.6.1.2.1.31.1.1.1.1.4194312448 = STRING: "IF 0/1/1"
iso.3.6.1.2.1.31.1.1.1.1.4194312704 = STRING: "IF 0/1/2"
iso.3.6.1.2.1.31.1.1.1.1.4194312960 = STRING: "IF 0/1/3"
iso.3.6.1.2.1.31.1.1.1.1.4194313216 = STRING: "IF 0/1/4"
iso.3.6.1.2.1.31.1.1.1.1.4194313472 = STRING: "IF 0/1/5"
iso.3.6.1.2.1.31.1.1.1.1.4194313728 = STRING: "IF 0/1/6"
iso.3.6.1.2.1.31.1.1.1.1.4194313984 = STRING: "IF 0/1/7"
iso.3.6.1.2.1.31.1.1.1.1.4194314240 = STRING: "IF 0/1/8"
iso.3.6.1.2.1.31.1.1.1.1.4194314496 = STRING: "IF 0/1/9"
iso.3.6.1.2.1.31.1.1.1.1.4194314752 = STRING: "IF 0/1/10"
iso.3.6.1.2.1.31.1.1.1.1.4194315008 = STRING: "IF 0/1/11"
iso.3.6.1.2.1.31.1.1.1.1.4194315264 = STRING: "IF 0/1/12"
...
...
For the devices connected on the interfaces, I create another discovery rule, the OIDs of the devices have the format:
1.3.6.1.4.1.2011.6.128.1.1.2.43.1.3.interface.devi ce
So I use:
discovery[{#SERIALNUMBER},1.3.6.1.4.1.2011.6.128.1.1.2.43.1. 3]
...and it works perfectly as in swnmpwalk:
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.0 = Hex-STRING: 48 57 54 43 79 02 C9 30
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.1 = Hex-STRING: 48 57 54 43 79 02 A4 C0
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.2 = Hex-STRING: 48 57 54 43 79 02 61 90
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.3 = Hex-STRING: 48 57 54 43 85 71 F2 9B
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.4 = Hex-STRING: 48 57 54 43 79 02 A7 D0
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.5 = Hex-STRING: 48 57 54 43 EF 29 1A 9C
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.6 = Hex-STRING: 48 57 54 43 85 4F 65 9B
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.7 = Hex-STRING: 48 57 54 43 79 02 5D E0
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.11 = Hex-STRING: 48 57 54 43 79 02 47 C0
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312448.0 = Hex-STRING: 48 57 54 43 2A 77 0F 9B
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312448.1 = Hex-STRING: 48 57 54 43 BA 01 AF 9C
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312448.2 = Hex-STRING: 48 57 54 43 FA F4 8C 9A
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312448.3 = Hex-STRING: 48 57 54 43 79 02 8B 40
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312704.0 = Hex-STRING: 48 57 54 43 79 02 9A F0
...
...
This discovers for me all devices on all interfaces perfectly and identifies them by their physical address.
Then I make an item prototype like:
{#HWADDRESS}: RX
And I get items like:
"485754437902C930:RX"
On the other hand, you can see that each device is related to its interface in the OID, the last index is the device ID [0, 1, 2, 3...] and the previous one is the interface ID [4194312192 , 4194312448, 4194312704...], like this:
4194312192.0
4194312192.1
4194312192.2
4194312192.3
4194312192.4
4194312192.5
4194312192.6
4194312192.7
4194312192.1
4194312448.0
4194312448.1
4194312448.2
4194312448.3
Now I need to improve the device discovery rule, identifying which interface each device is connected to. That is, in addition to the physical address, I want to have the record of the interface to which it is connected.
For the first device in the list, that is, [0], its interface is [4194312192]:
.1.3.6.1.4.1.578.6.128.1.1.2.43.1.3.4194312192.0
...and the name for "4194312192" is "IF 0/1/0"
So I want to create items that add the description of the interface to which they are connected, and are named for example as:
{#INTERFACE - #HWADDRESS}: RX
I mean:
"IF 0/1/0 - 485754437902C930:RX"
Or to be added as a value in a new item prototype.
In this case I don't know how to build the "SNMP OID" in the discovery rule.
I was looking in the documentation, but I didn't find anything similar. Basically it is about "reading" the index before the last one (4194312192 in this case) and checking its name against "ifName" to add it to the item. I was looking if it could be done with macros, but without luck.
If this cannot be done, you could see some other alternative, like automatically adding all devices to a group with the name of the interface, created automatically.
Or add another property to the device, like "interface" in the same way that an ethernet interface has the item "type", here it would be "interface".
But in short I will need to use the index before the last (for example 4194312192) in a discovery rule, to use it in an item prototype.
What do you think? Can be done?
Comment