This article helps in creating custom alarms when users download files from the datastore, and administrator would like to track these downloads with the user details.
Step 1: Create an alarm
DatastoreFileDownloadEvent" enter twice and the condition will be added. Step 2: defining the alarm on vpx extensions to list on the vCenter events tab:
/etc/vmware-vpx/extensions/VirtualCenter extension.xml file
cp extension.xml extension.xml_backupextension.xml file. </event><event id="DatastoreFileDownloadEvent"><EventType><eventTypeID>DatastoreFileDownloadEvent</eventTypeID><description>Datastore file download</description><arguments><argument><name>sourceOfOperation</name><type>string</type></argument><argument><name>targetPath</name><type>string</type></argument><argument><name>succeeded</name><type>boolean</type></argument></arguments></EventType></event><event id="DatastoreFileUploadEvent"><EventType><eventTypeID>DatastoreFileUploadEvent</eventTypeID><description>Datastore file upload</description><arguments><argument><name>sourceOfOperation</name><type>string</type></argument><argument><name>targetPath</name><type>string</type></argument><argument><name>succeeded</name><type>boolean</type></argument></arguments></EventType></event>
<!-- Please ensure that all new events are added above this comment (to avoid accidentally adding them outside the closing events tag) -->
Step 3: Add the username options to display and understand who downloaded the file
cp extension.xml extension.xml_backupDatastoreFileDownloadEvent here and the section below this will look like the following: DatastoreFileDownloadEvent.category = "info"
DatastoreFileDownloadEvent.description = "File downloaded to datastore"
DatastoreFileDownloadEvent.formatOnComputeResource = ""
DatastoreFileDownloadEvent.formatOnDatacenter = "File download from path '{targetPath}' was initiated from '{sourceOfOperation}' and completed with status '{[email protected]}'"
DatastoreFileDownloadEvent.formatOnHost = ""
DatastoreFileDownloadEvent.formatOnVm = ""
DatastoreFileDownloadEvent.fullFormat = "File download from path '{targetPath}' was initiated from '{sourceOfOperation}' and completed with status '{[email protected]}'
Edit the last line, and add user name = {userName}" as shown below:
DatastoreFileDownloadEvent.category = "info"
DatastoreFileDownloadEvent.description = "File downloaded to datastore"
DatastoreFileDownloadEvent.formatOnComputeResource = ""
DatastoreFileDownloadEvent.formatOnDatacenter = "File download from path '{targetPath}' was initiated from '{sourceOfOperation}' and completed with status '{[email protected]}'"
DatastoreFileDownloadEvent.formatOnHost = ""
DatastoreFileDownloadEvent.formatOnVm = ""
DatastoreFileDownloadEvent.fullFormat = "File download from path '{targetPath}' was initiated from '{sourceOfOperation}' and completed with status '{[email protected]}' user name = {userName}"
Step 4: Restart the vSphere UI and vpxd service.