Question

Aide sur plugin PostgreSQL

  • 11 October 2022
  • 2 replies
  • 39 views

Badge +1

Bonjour,

J’essai d’effectué une requête SQL avec le plugin sql-statement PostgreSQL mais à chaque execution j’ai une erreur que je n’ai pas via l’editeur PostgreSQL.

 

Voila la requete:

centreon_postgresql.pl --plugin=database::postgres::plugin --host=192.168.100.179 
--username='username' --password='password' --port='4432'  
--mode='sql' --sql-statement='select case when "Status" = 7 then 1 else 0 end as Execution FROM public."ExecutionResults" where "TaskID" = '75c49284-8b61-442c-bec5-7567027602f2'  order by "StartTime" DESC limit' 
--warning='' --critical=''

Voici l’erreur que me remonte la requete:

UNKNOWN: Cannot execute query: ERREUR:  erreur de syntaxe sur ou pr▒s de ▒ c49284 ▒
LIGNE 1 : ...FROM public."ExecutionResults" where "TaskID" = 75c49284-8b6…
 

POuvez vous m’aider sur cette erreur car je ne trouve pas.

Merci

Sebastien

 


2 replies

Userlevel 6
Badge +16

Hi, 


Could you try with:

./centreon_postgresql.pl --plugin=database::postgres::plugin --host=192.168.100.179 
--username='username' --password='password' --port='4432'  
--mode='sql' --sql-statement=”select case when Status = ‘7’ then 1 else 0 end as Execution FROM public.’ExecutionResults’ where TaskID = ‘75c49284-8b61-442c-bec5-7567027602f2'  order by ‘StartTime’ DESC limit”

 

Does the query correctly run directly in the psql prompt?

 

Best,

Badge +1

hanks for your help 
The query that works on PGAdmin is this one 
select case when "Status" = 7 then 1 else 0 end as Execution FROM public. "ExecutionResults" where "TaskID" = '75c49284-8b61-442c-bec5-7567027602f2' order by "StartTime" DESC limit 1

When I pass this request to Centreon I get the following error:

NKNOWN: Cannot execute query: ERROR: syntax error on or near ▒s of ▒ c49284 ▒
ROW 1: ...FROM public. "ExecutionResults" where "TaskID" = 75c49284-8b6...

Best,

Reply