monitoring the available licensed space through grafana
maks
Community Edition User ✭
Hello. Could you help me? I want to monitor the available licensed space through grafana, for this I use the SELECT GET_COMPLIANCE_STATUS()
function.
But I don't understand how I can use this function to get only the value in the Raw Data Size field, without displaying the rest of the fields. Is it possible?
-5
This discussion has been closed.
Answers
Try this - and then pick the column that you think fits your bill. Note there are "External", "Flex", and "Regular" audited_data, hence the last 3 rows:
Hi,
If you use the query below and set your grafana dash to Table panel and format as table it should give you the raw data size and the +/- size and last audit date. You can of course strip off any of these columns you don't want.
Notes:
the last audited col is valuable as the raw and adjust sizes are based on the last time the audit ran.
the audited_data can be changed to Flex or External or any combination or all
select (database_size_bytes/1000000)::INTEGER as data_size_raw_mb,
((database_size_bytes/1000000)::INTEGER*(error_tolerance_percent/100)) as data_size_estimation_error_mb,
audit_end_timestamp as latest_audit
from license_audits
where audited_data='Regular'
order by audit_end_timestamp desc limit 1;
I hope it helps
@s_crossman thanks a lot, but with your query I get a very different value than with the query
SELECT GET_COMPLIANCE_STATUS();
Why is this and what is the correct value then?
Hi,
I'll take another look at it. I ran on a similar 1TB license db we have and it seemed to be reasonably close (GET_COMPLIANCE_STATUS() reported .75TB raw size and license_audits reported .82TB). It may be related to different samplings but I think the background audit that runs is supposed to use the same parameters each time, and your last audit date timestamps matched.
Regards,
Hi,
Sorry, this got stuck in draft.
I ran a couple different tests. The docs imply that get_compliance_status sums up types regular and flex where as license_audits breaks them out. As shown below I ran audit, and it came back with 828GB. I ran a slightly different license_audit query and it shows that the entire 828gb is for regular. I also ran a sum of size for all types and got the 828gb.
My guess is in your database you may have some external and/or flex tables which impact the get_compliance_status raw result, and only if you ask for a sum in the license_audit would you see the same results.
PartPub80DB=> select audit('');
audit
842924596413
(1 row)
PartPub80DB=> select database_Size_bytes,audited_data,audit_end_timestamp from license_audits order by audit_start_timestamp desc limit 3;
database_Size_bytes | audited_data | audit_end_timestamp
---------------------+--------------+-------------------------------
0 | External | 2023-03-10 01:55:34.81215-05
0 | Flex | 2023-03-10 00:10:15.373464-05
828608126801 | Regular | 2023-03-10 00:10:15.35928-05
(3 rows)
PartPub80DB=> select sum(database_size_bytes),audit_end_timestamp from license_audits group by audit_end_timestamp order by audit_end_timestamp desc limit 1;
sum | audit_end_timestamp
--------------+------------------------------
828608126801 | 2023-03-10 01:55:34.81215-05
(1 row)