Skip to main content
Question

centreon_postgresql.pl probe in tablespace mode — displayed in %

  • September 24, 2025
  • 3 replies
  • 18 views

snoulot
Forum|alt.badge.img+2

Hi

I would like to have percentages instead of bytes in the output of the PostgreSQL probe in tablespace mode.

Is there an option to convert bytes to percentages?

3 replies

vcoum
Centreon Lord Commander
Forum|alt.badge.img+13
  • Centreon Lord Commander
  • 137 replies
  • September 25, 2025

Hi ​@snoulot
You can add the extra options --change-perfdata=traffic_in,,percent()
It will convert the named metric to percent

Just, replace traffic_in by the metric name
 

Test the command in a CLI if you have the possibility, it will be easier for testing
Then, you can add your option in the EXTRAOPTIONS macro of your service (or service template)
 

Hope it helps


snoulot
Forum|alt.badge.img+2
  • Author
  • Steward *
  • 1 reply
  • September 25, 2025

Hi

If I add

--change-perfdata='tablespace.space.usage.bytes,,percent(),%'

 

/usr/lib/centreon/plugins/centreon_postgresql.pl --plugin=database::postgres::plugin --mode=tablespace --host=xxx.xxx.xxx.xxx --username='*******' --password='*******' --port='xxxx' --filter-sql-name='pg_default' --filter-name='' --warning-space-usage='80' --critical-space-usage='90' --filter-name='' --change-perfdata='tablespace.space.usage.bytes,,percent(),%'

I have this information:

 

CRITICAL: Tablespace 'pg_default' space used: 50.97 MB | 'pg_default#tablespace.space.usage.bytes'=53440706%;80:0;90:0;0;

But I would like to have the information in the following format:

 

CRITICAL: Tablespace 'pg_default' space used: 50% | 'pg_default#tablespace.space.usage.percent'=50%;80;90

The first change only changes B to %, but does not calculate %.

 


vcoum
Centreon Lord Commander
Forum|alt.badge.img+13
  • Centreon Lord Commander
  • 137 replies
  • September 25, 2025

Ah yes i think there is a limitation in the postgre plugin for Tablespaces

To get a % of usage, we need the total size of the disk to compare it to the usage of the tablespace

In the plugin code, it seems it only get the Tablespace size, not the disk size

Maybe someone from Centreon can confirm this