If you experience data corruption, data loss, or accidentally delete files from the internal Postgres database, this guide will walk you through the steps to regenerate the internal Postgres database structure and recreate a fresh, empty EventSentry database.
Before proceeding with this guide, ensure that you back up the data14 directory. This guide will reset the database structure to a state equivalent to a fresh installation, resulting in the loss of all existing data.
List of services (your installation may not have all services):
EventSentry
EventSentry Collector
EventSentry Database v14
EventSentry Heartbeat Monitor
EventSentry Network Services
EventSentry Web Reports
EventSentry ADMonitor
Assuming EventSentry is installed in the default directory, copy/move the root files from
C:\Program Files\EventSentry\data14\
(just the root files, not subfolders) to a temporary location (e.g., a folder on your desktop). These files will be copied back later. The list of files you should have there:
Delete all contents inside the folder C:\Program Files\EventSentry\data14 but DO NOT delete the folder itself. This saves us the trouble of setting permissions again.
Despite running the command with Administrator rights, PostgreSQL will set the access rights to the currently logged-in user. Grant full access to data14 for your user: Right-click on data14, select Properties, go to the Security tab, click Edit, then Add, search for your user, click OK, select Full Control, and click OK. It should look like this (in this example, the user is "John.Doe"):
Open a command prompt as Administrator and run the following command (adjust the directories if EventSentry is installed elsewhere):
"C:\Program Files\EventSentry\postgresql14\bin\initdb.exe" --encoding=UTF-8 -D "C:\Program Files\EventSentry\data14" -U postgres -A password -W
This command will initialize the PostgreSQL database. Note that you are setting a new password for the postgres user, write it down for future reference.
Copy the root files you moved in step 2 back to the data14 folder, overwriting if prompted.
Start the EventSentry Database v14 service (only this service for now).
You may see an error about authentication failing for user "eventsentry_svc" - this is normal.
In the EventSentry management console, go to Actions > Primary Database (or the name of your primary database action if you changed it). In the right panel click on the Initialize or Update button.
The Configuration Assistant will start. Click Next, enter the postgres user password set earlier and click Next again. Create passwords for eventsentry_svc and eventsentry_web, then click Next to initialize the EventSentry database. Click Finish when done.
From the top ribbon menu, click Save, or Save and Deploy if you have staged configuration enabled.
Start all services from the Windows Service Manager or from the Services item in the EventSentry management console. Everything should now be up and running. You may also want to open Web Reports to complete the initial setup.