Handle varbinds/parameters OID

Started by Stardust, May 20, 2015, 12:51:01 PM

Previous topic - Next topic

Stardust

Hi,

I don't understand how to handle parameters on EPP script, I explain:

I've created a trap,
OID: .1.3.6.1.4.1.9789.0.1500
with different parameters like $2 :.1.3.6.1.4.1.9789.1500.1.5 and so on


An event is associated to that trap.

Then, I only wanted to compare on EPP the parameter received by the trap like:

if ($2 == ".1.3.6.1.4.1.9789.1500.1.5'") return 1;

How should I do that?

Sorry if the subject was already posted.

Regards.

Victor Kirhenshtein

Hi,

basically you write it correctly (with one type):

if ($2 == ".1.3.6.1.4.1.9789.1500.1.5") return 1;

or simply

return $2 == ".1.3.6.1.4.1.9789.1500.1.5";

Best regards,
Victor

Stardust

#2
Thank you Victor but it doesn't work :(

I simplified my problem because there is something that I don't understand:

1)My trap
2)My event
3) trap received: FW01   .1.3.6.1.4.1.9789.1500   .1.3.6.1.4.1.9789.1500.2.5 == '[GRE-FW01][INFO][005]'
(That means login error)

Then on my epp I only wanted to compare the oid of the parameter/varbind received: .1.3.6.1.4.1.9789.1500.2.5 or .1.3.6.1.4.1.9789.1500.1.5

My script:

if ( index($event->parameter[3], ".1.3.6.1.4.1.9789.1500.2.5") return 1;
else return 0;


doesn't work

Victor Kirhenshtein

Now I understand. The problem is that when mapping of trap to event happens, only values are copied, not OIDs (value of $event->parameters[3] will be "[GRE-FW01][INFO][005]" in your example). But, if you have two parameter mappings on different OIDs, and only one of them can be present in actual trap, that means that other parameter will be empty. So, if you have mapped .1.3.6.1.4.1.9789.1500.1.5 to parameter #2 and .1.3.6.1.4.1.9789.1500.2.5 to parameter #3, you can simply check if parameter 2 is empty - if it is, you have .1.3.6.1.4.1.9789.1500.2.5, otherwise .1.3.6.1.4.1.9789.1500.1.5.

Best regards,
Victor

Stardust