VMware Cloud Community
Wmerlin
Contributor
Contributor

Script to remove log files from hosts

Hi all, I recently ran into a problem with HP AMS that is filling the logs folder in the ESXis and not allowing the host to connect to vcenter once the logs partition is full. This problem should be solved after upgrading the HP offline bundle bud since i have quite a few hosts to upgrade and in some cases cannot evacuate them so easily I was looking for a script that can remove the AMS log files on a weekly bases for all hosts until we get the HP upgrade in place.

0 Kudos
3 Replies
NathanosBlightc
Commander
Commander

you can mix the following powerCLI and shell command to remove all log files:

connect-viserver -Server a.b.c.d -User root -Password Pass

rm /var/log/*

But I think it's better to find-out what is really going on your server and solve the problem, instead of removing consecutive log files
Please mark my comment as the Correct Answer if this solution resolved your problem
0 Kudos
Wmerlin
Contributor
Contributor

Thanks Amin, we already know that this is a bug with the HP AMS version but we can't apply the new version in all ESXi for the moment (quite a big environment with lots of vms that can't be migrated with DRS).

is there a way to some sort of fastpass on powerCLI like we had with vMA?

0 Kudos
NathanosBlightc
Commander
Commander

I think the following link can help you to disable HP AMS service for all of the ESXi hosts:

power cli script to find the status of the hp-ams.sh on esxi hosts and to turn off the service

Please mark my comment as the Correct Answer if this solution resolved your problem
0 Kudos