Forum Discussion

bmarlow_10657's avatar
bmarlow_10657
Icon for Nimbostratus rankNimbostratus
Feb 16, 2009

SNMP query in iRule/SNMP monitor variable for iRule?

Okay, so I've been looking all over and there seems to be relatively little information regarding using SNMP or SNMP parameters in iRules. Mind you I am an iRule Rookie.

 

 

My question has two parts:

 

1. Is it possible to do an SNMP query within an iRule, and if so what is the command?

 

2. Is there a way to call the values of an SNMP monitor in an iRule?

 

 

My scenario is this:

 

 

We have several web proxies that sit behind an LTM. To make maximum use of our proxies caching mechanism we want to use a spill-over method triggered by CPU thresholds of the proxies.

 

 

I imagine that the iRule will look something similar to this (note the IP's have been replaced with *'s), but what would I used for variable?

 

 

when HTTP_REQUEST {

 

if{ [ usage 1sec] <= 75} {

 

LB::reselect node *.*.*.* 8080

 

} else {

 

if{ [ usage 1sec] <= 75} {

 

LB::reselect node *.*.*.* 8080

 

} else {

 

if{ [ usage 1sec] <= 75} {

 

LB::reselect node *.*.*.* 8080

 

} else {

 

if{ [ usage 1sec] <= 75} {

 

LB::reselect node *.*.*.* 8080

 

} else {

 

 

}

 

}

 

 

 

Any help would be greatly appreciated!

 

 

Thanks!

5 Replies

  • I don't think you can you do snmp query directly from an iRule. CMIIW ...

     

     

    Another approach, create another cron job to do snmp query and send it to a data group. Your iRule would be able to get the cpu usage information from data group instead of doing snmp query.
  • The plan wasn't to do an SNMP query for each connection, but rather every couple of seconds, and once the CPU utilization hit a certain threshold it would bleed new/non persisted sessions over to the other proxy.

     

     

    SNMP DCA will look at the stats, but it will only do for a dynamic ratio. It won't mark the node unavailable unless it doesn't respond in a timely manner to the SNMP request. I don't want a dynamic ratio load balance, only new connections to bleed over once the CPU gets to a certain point.
  • Can you tell me the example command that is send the snmp query data to the data group. please

     

  • There is no command for sending SNMP, from an iRule.

     

     

    You can from the BigIP, from Linux space, using regular net-snmp commands.

     

     

    Or, from an iRule, you could send commands to some HTTP app, which would then do SNMP for you...