Forum Discussion

Ethereum7's avatar
Ethereum7
Icon for Nimbostratus rankNimbostratus
Jan 22, 2021

Need to remove health monitor on 1000's of pools and add a new health monitor

Hi,   Any idea how I can bulk remove TCP health monitor and add in a new custom health monitor?    
  • Daniel_Wolf's avatar
    Jan 23, 2021

    Everything jaikumar_f5 said about CPU utilization - absolutely true.

    However, I see three ways of doing this.

    One-liner, replaces the monitor on any pool.

    tmsh list ltm pool one-line | awk '{ print $3 }' | xargs -I pl_name tmsh modify ltm pool pl_name monitor <NEWMONITOR>

    Two-liner, first it filters for any pool that has "HTTP" in its name and then writes the pool name to a txt file.

    tmsh list ltm pool one-line | grep -E 'HTTP' | awk '{ print $3 }' >> /shared/tmp/<FILENAME>.scf
    for pl in `cat /shared/tmp/<FILENAME>.scf`; do tmsh modify ltm pool $pl monitor <NEWMONITOR> ; echo "$pl done" ; done

    And last example, a two liner with manual intervention. It will write all pools to a txt file. You have to modify the text file manually and cut&replace the monitors manually, with vi or nano or else.

    Afterwards you load the config from tmsh.

    tmsh list ltm pool one-line >> /shared/tmp/<FILENAME>.scf
    # nano or vi /shared/tmp/<FILENAME>.scf
    load sys config file /shared/tmp/<FILENAME>.scf merge