VMware Cloud Community

Making changes to cron across large sampling of hosts

Good afternoon all,

We have a request from one of the app teams to collect data using esxtop across a large sampling (4,000+) ESXi hosts.

We have done this for a very small subset of hosts by modifying the /var/spool/cron/crontabs/root file to add a scheduled task kicking off a shell script, and then restarting the crond service.

The script is pretty basic:

cd /tmp/esxtop
esxtop -b -d 5 -n 900 > /tmp/esxtop/st2562_stvt01_esxtop.csv
gzip -c st2562_stvt01_esxtop.csv > st2562_stvt01_esxtop_"$(date +%F_%T)".gz

Once the crond is restarted, it runs the script every 15 minutes. Since it won't be practical to make this change manually across such a large environment, if anyone has a better way to approach this type of task, ideally using PowerCLI, it would be appreciated.

The most difficult part appears to be restarting crond since we have to kill the running one first after getting the pid.




Labels (1)
Tags (1)
0 Kudos
0 Replies