Forum Discussion

xzjleo_133138's avatar
xzjleo_133138
Icon for Nimbostratus rankNimbostratus
Oct 16, 2013

iRule data group

Hi

 

We have some iRule data groups need to be updated regularly and the iRule will forward the traffic to different servers base on them. In order to minimize the work load, are there any ways we can update the data group quickly, say we have a excel/xml IP list file which exported from monitoring system, can we import it to F5 data group configuration? Any other ideas?

 

Thanks.

 

5 Replies

  • Updating a data group is relatively straight forward. The hard part I think is going to be the conversion process. There's no tool that I'm aware of to convert from Excel spreadsheet or flat XML file to data group format. Is it simply a single list of IP addresses, different lists of IP addresses, or is it a list of key-value pairs?

     

  • I don't think SNMP is the way to go. In lieu of iControl (probably the best way), you could partially automate the process by first uploading the flat list of IP addresses. Example:

    10.70.0.1/32
    10.70.0.2/32
    10.70.0.3/32
    10.70.0.4/32
    10.70.0.5/32
    10.70.0.6/32
    10.70.0.7/32
    10.70.0.8/32
    10.70.0.9/32
    

    And then processing this file with a simple Bash script:

    !/bin/bash
    
    data_group=dgimport_ip_list
    import_file=iplist
    
     import the first line and replace everything in the data group
    line=`head -1 $import_file`
    tmsh modify ltm data-group internal $data_group records replace-all-with { $line }
    
     parse the rest of the file and add the data to the data group
    sed 1d $import_file |while read line
    do
        tmsh modify ltm data-group internal $data_group records add { $line }
    done
    

    Make sure the address-based data group has been created first.