Skip to main content
Question

Aide sur plugin PostgreSQL

  • October 11, 2022
  • 2 replies
  • 386 views

Forum|alt.badge.img+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

sims24
Forum|alt.badge.img+19
  • Ranger ***
  • October 12, 2022

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,


Forum|alt.badge.img+1
  • Author
  • Steward *
  • October 17, 2022

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,