Using the reporting functions in WAPT WAPT Enterprise feature only

Working principle

WAPT Enterprise offers advanced reporting capabilities.

Indeed, you are best to know what you want in your reports.

With WAPT you can write your own SQL queries in the WAPT Console, or you can download ready-to-run queries from Internet.

The database structure diagram is available here wapt_db_data_structure.svg.

WAPT Query Designer

The query designer allows to edit and run SQL queries on the WAPT Server PostgreSQL database.


The PostgreSQL database is set to Read-Only mode, so queries run from the Report Designer that attempt to update, delete or insert data will fail.

To create a new report, click on Reporting ‣ Design Mode ‣ New query.

Designing a SQL query report in the WAPT Console

Designing a SQL query report in the WAPT Console


  • To rename a query, press the F2 key.

  • In the top banner, you can write your SQL query.

To edit / modify / save your reports:

  • The Reload queries button is used to reload queries saved on the WAPT Server, for example, if a colleague has just edited a new query.

  • The New query button will add a new blank query to the list.

  • The Delete query button will delete the selected query from the WAPT Server.

  • The Export to Excel button will export the result of your query to a spreadsheet.

  • The Save queries button will save your query to the WAPT Server.

  • The Duplicate button will duplicate an existing query to avoid writing a SQL query from scratch.

  • The Execute button executes the selected query.


  • SQL queries are saved in the PostgreSQL WAPT database.

  • Using CTRL+space allows to build queries more effectively as it will auto-complete some fields.

Query examples

Computers query

select count(*) as "number_of_hosts" from hosts
host_info->'windows_version' as windows_version,
os_name as operating_system,
count(os_name) as nb_hosts
from hosts
group by 1,2
select case
when 'Portable' then '01-Laptop'
when 'Notebook' then '01-Laptop'
when 'Laptop' then '01-Laptop'
when 'Desktop' then '02-Desktop'
when 'Tower' then '02-Desktop'
when 'Mini Tower' then '02-Desktop'
else '99-'||(dmi->'Chassis_Information'->>'Type')
end as type_chassis,
string_agg(distinct coalesce(manufacturer,'?') ||' '|| coalesce(productname,''),', '),
count(*) as "number_of_hosts" from hosts
group by 1

WAPT query

from packages
group by 1,2,3,4,5,6

Packages query

from hostpackagesstatus s
where section not in ('host','unit','group')
group by 1,2,3,4,5,6

Software query

from hostsoftwares s
left join hosts h on h.uuid=s.host_id
and (name ilike 'WAPT%%Discovery%%' or name ilike 'WAPT %%')

You can also find several more examples of queries on Tranquil IT’s Forum.

Feel free to post your own queries on the forum with an explanation of what your query does, ideally with a screen capture or a table showing a sample of your query result.

Normalizing software names

Sometimes, the version of the software or its architecture are an integral part of the software name. When the software titles register with the WAPT Server inventory, they appear as different software titles whereas they are just one software for us humans.

To solve this problem, we can standardize the name of some software titles in WAPT.

Normalizing the name of software titles in the WAPT Console

Normalizing the name of software titles in the WAPT Console

  • Click Normalize Software Names in the Tools menu.

  • Select the software titles whose names to standardize, for example, all different versions of Adobe Flash Player.

  • On the column normalized, press F2 to assign a standardized name to the selected software titles. Then press Enter.


  • To select several software titles, select them with the shift-up/down key combination.

  • You can also indicate a software like windows update or banned (press spacebar in the corresponding column).

  • Press on Import to upload your changes onto the WAPT Server.

  • Press on Write to save your changes.

You can now run your queries using this standardized name.

Connecting to the WAPT database using a PostgreSQL client

You can connect a PostgreSQL client to the WAPT database if you prefer to use a PostgreSQL client.

To do so, you will have to change some configuration files on your WAPT Server.

  • First, find the version of your PostgreSQL database.

ps -ef | grep -i sql
postgres   512     1  0 Jan05 ?        00:00:24 /usr/lib/postgresql/12/bin/postgres -D /var/lib/postgresql/12/main -c config_file=/etc/postgresql/12/main/postgresql.conf
  • Modify pg_hba.conf of the PostgreSQL version in use. In /etc/postgresql/12/main/pg_hba.conf for Debian and /var/lib/pgsql/12/data/pg_hba.conf for RedHat and derivatives, add the IP address of the PostgreSQL client under # IPv4 local connections section.

host    wapt             all                 md5

where is your IP address that is authorized
to connect to the WAPT database.
  • Allow PostgreSQL to listen on every interface in /etc/postgresql/12/main/postgresql.conf for Debian and /var/lib/pgsql/12/data/postgresql.conf for RedHat and derivatives, section Connection Settings.

listen_addresses = '*'
  • Restart the service for your PostgreSQL version.

systemctl restart postgresql@12-main.service
  • Connect to PostgreSQL on the WAPT Server.

sudo -u postgres psql template1
  • Then give a password to the wapt user.