Script to Reset Stats on All Partitions

We are going through a migration project where we often have to reset stats on a lot of LTMs periodically to check for traffic on legacy configurations

Is there a way I can use a remote shell script I can use over a cronjob to clear all stats on all elements on all partitions?

Currently I list out all partitions and run this in each partition over tmsh:

reset-stats ltm rule

reset-stats ltm virtual

reset-stats ltm node

reset-stats ltm pool

reset-stats ltm snatpool

reset-stats ltm virtual-address

Hi mitraj93,

You can use iCall.

create sys icall script resetStats_script
sys icall script resetStats_script {
    app-service none
    definition {
        tmsh::reset-stats ltm rule
        tmsh::reset-stats ltm virtual
        tmsh::reset-stats ltm node
        tmsh::reset-stats ltm pool
        tmsh::reset-stats ltm snatpool
        tmsh::reset-stats ltm virtual-address
    }
    description none
    events none
}
create sys icall handler periodic resetStats_periodic interval 86400 script resetStats_script

The answer is - not really.

The iControl REST User Guide Version 13.1 says this:

> Using the reset-stats command

> Global commands like reset-stats do not have a direct mapping to an HTTP method, so you must use the

> POST method and specify an absolute URI, such as

> https://192.168.25.42/mgmt/tm/ltm/virtual,

> along with a JSON body that specifies the name of the command.

Here is a bash one-liner that iterates through the partitions and resets the stats:

for i in `tmsh -q -c "list auth partition" | grep auth | awk '{print $3}'`; do echo $i; tmsh -q -c "cd /$i; reset-stats ltm rule; reset-stats ltm virtual; reset-stats ltm node; reset-stats ltm pool; reset-stats ltm snatpool; reset-stats ltm virtual-address"; done

S Blakely, The issue with iControl is not all of our devices support REST.

However, the bash one-liner works from the device bash prompt - I think I can put it in a shell script and run it in crontab - Thanks!!!