SQL Reporting Example

Share your SQL query ideas for reporting in the WAPT Enterprise console here
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
User avatar
Mathieu
Messages: 91
Registration: August 18, 2016 - 10:24

February 28, 2019 - 3:34 PM

Hello,

after seeing your presentation of version 1.7, is it possible to get some examples of your queries? We saw some that might interest us (I don't know SQL at all).

I hope this is possible.

Thank you.
- WAPT 2.2.3.12463 Enterprise
- Debian 9.9
- Windows 10 21H2 & Windows 11 22h2
User avatar
kguerineau
Messages: 26
Registration: March 6, 2018 - 4:28 PM

February 28, 2019 - 6:21 PM

Hello Mathieu,

Here are some SQL queries we have internally.

Sincerely,

Kevin



Number of machines:

Code: Select all

select count(*) as "Nb_Machines" from hosts


Status of WAPT installations

Code: Select all

SELECT h.uuid,h.computer_fqdn,install_date::date,version,h.listening_timestamp::timestamp from hostsoftwares s
left join hosts h on h.uuid=s.host_id
where
 s.key='WAPT_is1'
and
 h.listening_timestamp>='20190118'
List of machines with Windows OS and key

Code: Select all

select computer_name,os_name,os_version,host_info->'windows_product_infos'->'product_key' as windows_product_key from hosts order by 3,1
List of packages present in the local WAPT repository

Code: Select all

select package,version,architecture,description,section,package_uuid,count(*)
from packages
group by 1,2,3,4,5,6   
Machines awaiting update

Code: Select all

select
  computer_fqdn, host_status, last_seen_on::date,h.wapt_status,string_agg(distinct lower(s.package),' ')
from hosts h
left join hostpackagesstatus s on s.host_id=h.uuid and s.install_status != 'OK'
where (last_seen_on::date > (current_timestamp - interval '1 week')::date and host_status!='OK')
group by 1,2,3,4
Locked