Skip to main content

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?

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


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 %.

 


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