esx.audit.ssh.session.opened and esx.audit.ssh.session.closed eventsFollowing query can be used to check the count of events:
/opt/vmware/vpostgres/current/bin/psql -U postgres VCDBSELECT COUNT(EVENT_ID) AS NUMEVENTS, EVENT_TYPE, USERNAME FROM VPXV_EVENT_ALL GROUP BY EVENT_TYPE, USERNAME ORDER BY NUMEVENTS DESC LIMIT 10;Example output:
VCDB=# SELECT COUNT(EVENT_ID) AS NUMEVENTS, EVENT_TYPE, USERNAME FROM VPXV_EVENT_ALL GROUP BY EVENT_TYPE, USERNAME ORDER BY NUMEVENTS DESC LIMIT 10;
numevents | event_type | username-----------+-----------------------------------------+---------------------------- 3145462 | esx.audit.ssh.session.opened | 3144915 | esx.audit.ssh.session.closed |
VMware vCenter Server 7.0.x
VMware vCenter Server 6.7.x
This issue is caused by frequent API calls from third-party products, generating an excessive volume of events in the database.
This document outlines a process to regularly clear out events in the vCenter database aiming to reduce the impact on system performance.
Disclaimer: The below procedure involves interacting with vCenter database and should be performed with extreme caution. Contact Broadcom support for any assistance
Initial Cleanup:
service-control --stop --allservice-control --start vmware-vpostgressql /opt/vmware/vpostgres/current/bin/psql -U postgres VCDB <<EOF CREATE OR REPLACE FUNCTION event_full_cleanup_p () returns void as $$ DECLARE event_partition VARCHAR (200); BEGIN TRUNCATE TABLE VPX_EVENT_PARTITION_LOOKUP; -- Truncate partitions FOR part IN 1..92 LOOP event_partition = 'TRUNCATE TABLE VPX_EVENT_' || CAST(part AS TEXT) || ' CASCADE '; EXECUTE event_partition; event_partition = 'TRUNCATE TABLE VPX_EVENT_ARG_' || CAST(part AS TEXT) || ' CASCADE '; EXECUTE event_partition; event_partition = 'ANALYZE VPX_EVENT_' || CAST(part AS TEXT); EXECUTE event_partition; event_partition = 'ANALYZE VPX_EVENT_ARG_' || CAST(part AS TEXT); EXECUTE event_partition; END LOOP; TRUNCATE TABLE VPX_ENTITY_LAST_EVENT; END $$ LANGUAGE plpgsql; SELECT event_full_cleanup_p(); DROP FUNCTION event_full_cleanup_p; EOFservice-control --start --allRegular Cleanup (Scheduled Task):
remove_some_events_create.sql and run_cleanup.sh files to the /storage/updatemgr directory on the VCSA.remove_some_events_create_audit.sql script to create the necessary database procedure:bash /opt/vmware/vpostgres/current/bin/psql -U postgres -d VCDB -f remove_some_events_create_audit.sqlrun_cleanup.sh: chmod u+x /storage/updatemgr/run_cleanup.shrun_cleanup.sh at a quiet time to ensure it works correctly.crontab -e to add the following line to your crontab:0 2 * * * /storage/updatemgr/run_cleanup.shInitial Cleanup:
service-control --stop --all --vmon-profile ALLservice-control --start vmware-vpostgressql /opt/vmware/vpostgres/current/bin/psql -U postgres VCDB <<EOF CREATE OR REPLACE FUNCTION event_full_cleanup_p () returns void as $$ DECLARE event_partition VARCHAR (200); BEGIN TRUNCATE TABLE VPX_EVENT_PARTITION_LOOKUP; -- Truncate partitions FOR part IN 1..92 LOOP event_partition = 'TRUNCATE TABLE VPX_EVENT_' || CAST(part AS TEXT) || ' CASCADE '; EXECUTE event_partition; event_partition = 'TRUNCATE TABLE VPX_EVENT_ARG_' || CAST(part AS TEXT) || ' CASCADE '; EXECUTE event_partition; event_partition = 'ANALYZE VPX_EVENT_' || CAST(part AS TEXT); EXECUTE event_partition; event_partition = 'ANALYZE VPX_EVENT_ARG_' || CAST(part AS TEXT); EXECUTE event_partition; END LOOP; TRUNCATE TABLE VPX_ENTITY_LAST_EVENT; END $$ LANGUAGE plpgsql; SELECT event_full_cleanup_p(); DROP FUNCTION event_full_cleanup_p; EOFservice-control --stop --allservice-control --start –all --vmon-profile HAActiveRegular Cleanup (Scheduled Task):
remove_some_events_create.sql and run_cleanup.sh files to the /storage/updatemgr directory on the VCSA.remove_some_events_create_audit.sql script to create the necessary database procedure:bash /opt/vmware/vpostgres/current/bin/psql -U postgres -d VCDB -f remove_some_events_create_audit.sqlrun_cleanup.sh: chmod u+x /storage/updatemgr/run_cleanup.shrun_cleanup.sh at a quiet time to ensure it works correctly.crontab -e to add the following line to your crontab:0 2 * * * /storage/updatemgr/run_cleanup.shImportant Considerations:
For additional details about editing the vCenter HA configuration refer Edit the vCenter HA Cluster Configuration
Impact/Risks: The database can become full, causing the services to crash and prevent them from restarting. Prior to this, the vpxd service will experience significant slowdowns.