ORA-00911: invalid character when using table gv$session in Check SQL Database

CMK version: 2.2.0p4
OS version: Debian 11

Error message: Error while executing SQL command: ORA-00911: Ungültiges Zeichen

Hi,
I’m new to checkmk and I wanted to try the “Check SQL Database” service. So I created a new rule ( Setup → Services → HTTP, TCP, Email,… → Check SQL Database) and entered the connection data for our Oracle database. When I use a simple select statement like

SELECT max(user_num) FROM users

it works fine and the new service shows the correct result.
But when I now try

SELECT count(1) FROM gv$session

I get the error

Error while executing SQL command: ORA-00911: Ungültiges Zeichen

The weird thing is, when I go to Host → Service discovery I can see this service on the bottom and it can actually execute this select statement. There I get the result

<134> is not a state, and no levels given

which is OK because 134 is the current number of sessions and I didn’t specify any levels/metrics.

I am assuming it has to do with the dollar sign ($) in the table_name “gv$session” but I don’t understand why it can be executed on one page and not on the other. I also don’t know how I could parenthesize or escape this statement.

(I can execute it just fine in sqlplus on the command line)

Any ideas?

I escaped the dollar sign with another dollar sign like this

SELECT count(1) FROM gv$$session

Now it shows the correct value on the page with the services list for the host.
On the service discovery page on the other hand it says “table or view does not exist”, but that shouldn’t be a problem.

Still weird that it seems to get automatically escaped on one page of the GUI but not on the other.

Or is there another way to have this select statement executed correctly?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.