centreon / centreon-plugins

Collection of standard plugins to discover and gather cloud-to-edge metrics and status across your whole IT infrastructure.
https://www.centreon.com
Apache License 2.0
312 stars 275 forks source link

View used by "connected-users" mode #4856

Open Julien-Rozet opened 10 months ago

Julien-Rozet commented 10 months ago

Hi,

It's more a question than an issue. I want to check number of connected users on a RAC database and I get this error: UNKNOWN: Cannot execute query: ORA-00942: table or view does not exist (DBD ERROR: error possibly near <*> indicator at char 21 in 'SELECT COUNT(*) FROM <*>v$session WHERE type = 'USER'')

The colleagues on my DBA team says to me to use the view gv$session. This view is, apparently, compatible with RAC and non-RAC databases. Why not using this view as default?

Instead of forking the script and modify it or using the "sql" mode, there is a way to change the SQL request executed?

lucie-dubrunfaut commented 5 months ago

Hello :)

I'm not sure I understand which plugin you used, can you give us the command you used? It is possible that the SQL collection can help you meet your sql request custom needs (here is the tutorial)

Julien-Rozet commented 5 months ago

Hello,

There is an example of command line used: /usr/lib/centreon/plugins//centreon_oracle.pl --plugin=database::oracle::plugin --hostname='{hostname}' --port='{port}' --sid='{sid}' --servicename='{servicename}' --username='{username}' --password='{password}' --mode='connected-users' --warning='150' --critical='200'

I obviously obfuscate sensitive data.

lucie-dubrunfaut commented 4 months ago

Hello :)

Were you able to test the command manually with the suggestion your DBA team made? SELECT COUNT(*) FROM gv$session WHERE type = 'USER' If so, did the result correspond to what was expected?

Julien-Rozet commented 3 months ago

Hi, Sorry for the delay. I can confirm that using the request on the gv$session view is what my DBA team wants.