Page 1 of 1

[RESOLVED] Reporting script

Published: Dec 21, 2023 - 11:05 AM
by Geoffroy
Hello everyone,

Server: WAPT Enterprise 2.4.0.14080 on Debian
Consoles: Windows 10 & 11
Park: Windows

I have a script that allows for free space per computer.
I wanted to know if it was possible to have a result in % in this function and especially with the ranking of machines by OR.

Code: Select all

select
round(((host_metrics->'local_drives'->'C'->'FreeSpace')::float / 1073741824)::numeric,2)::float as Free_Gb,
host_metrics->'last_logged_on_user' as User,
os_name,
os_version ,
host_info->'computer_fqdn' as fqdn
from hosts
order by computer_name
Thank you

Re: Reporting script

Published: Dec 21, 2023 - 2:51 PM
by dcardon
Hi Geoffroy,

You can try this:

Code: Select all

select
round(((host_metrics->'local_drives'->'C'->'FreeSpace')::float  / 1073741824)::numeric,2) as free_space_en_go ,
round(((host_metrics->'local_drives'->'C'->'Size')::float  / 1073741824)::numeric,2) as total_space_en_go,
round(
 (((host_metrics->'local_drives'->'C'->'FreeSpace')::float  / 1073741824) / ((host_metrics->'local_drives'->'C'->'Size')::float  / 1073741824) * 100)::numeric ,2) as free_space,
host_info->'computer_fqdn'  as fqdn,
host_metrics->'last_logged_on_user' as User
from hosts
order by free_space asc
Denis

Re: Reporting script

Published: Dec 21, 2023 - 5:17 PM
by Geoffroy
Perfect... Thank you very much, Denis.

Happy holidays to the whole team!

Re: Reporting script

Published: Dec 22, 2023 - 3:08 PM
by dcardon
Thanks Geoffroy for the feedback, Merry Christmas and Happy New Year 2024 from the whole team!
Denis