Solution
To pause database logging using REST API, run the following command:
curl -u username:password -X POST -s --data '{ "command" : "/DATABASELOGGING:connection:pause", "target":" /geneos/gateway/directory[(rparam(\"DBConnectionPaused\")=\"false\")]"}' http://gatewayHost:gatewayPort/rest/runCommand
If the REST API command is successful, the gateway's database logging icon will appear red and crossed out like below indicating the gateway is not connected to the database.
If you are using the Gateway-databaseLogging plug-in, you will notice the Summary dataview shows connectionPaused set to "true."
The gateway log will also show the following lines which mention the command has been executed and the database connection has been paused.
2022-03-23 15:43:50.903-0400 INFO: CommandManager Executing command [/DATABASELOGGING:connection:pause] with id [116] for request id [26]
2022-03-23 15:43:50.904-0400 INFO: CommandManager Executing command '/DATABASELOGGING:connection:pause' on DataItem '/geneos/gateway[(@name="testing_gateway")]/directory', issued by user 'username' on '192.168.x.xx' using REST service
2022-03-23 15:43:50.904-0400 INFO: CommandManager Received 0 arguments for command
2022-03-23 15:43:50.906-0400 INFO: DatabaseLogging Database connection is paused [./database/database.connectionpaused.dat]
2022-03-23 15:43:51.053-0400 WARN: Event:DatabaseLogging 1648064631.053173 DatabaseLogging /geneos/gateway[@name="testing_gateway"] Connection Dropped [server01 geneos_db 3306 username:geneos_db_user]
To resume database logging, you can run the following command:
curl -u username:password -X POST -s --data '{ "command" : "/DATABASELOGGING:connection:resume", "target":" /geneos/gateway/directory[(rparam(\"DBConnectionPaused\")=\"true\")]"}' http://gatewayHost:gatewayPort/rest/runCommand
The gateway log will show the following lines saying the command has been executed and the database connection is resumed.
2022-03-23 15:58:28.682-0400 INFO: CommandManager Executing command [/DATABASELOGGING:connection:resume] with id [117] for request id [27]
2022-03-23 15:58:28.683-0400 INFO: CommandManager Executing command '/DATABASELOGGING:connection:resume' on DataItem '/geneos/gateway[(@name="testing_gateway")]/directory', issued by user 'username' on '192.168.x.xx' using REST service
2022-03-23 15:58:28.684-0400 INFO: CommandManager Received 0 arguments for command
2022-03-23 15:58:28.685-0400 INFO: DatabaseLogging Database connection is resumed
If you still see the database icon appearing red and crossed out in the gateways dockable, and the connectionStatus row in the Summary view of the Gateway-databaseLogging plug-in still shows "Not Connected;" this is because the database is not logging anything new upon the database connection being resumed. As soon as a new item is logged to the database, the database icon will no longer appear crossed out and the connectionStatus will say "Connected."
The gateway log will then show the following entry stating the database connection has been established.
2022-03-23 16:00:40.098-0400 INFO: Event:DatabaseLogging 1648065640.098452 DatabaseLogging /geneos/gateway[@name="testing_gateway"] Connection Established [server01 geneos_db 3306 username:geneos_db_user, serverVersion 5.1.44]
Related Articles
Gateway-databaseLogging Plug-in Documentation
Rest Service/REST API Documentation
If you have further questions:
- Please contact with our Client Services team via the chat service box available in any of our websites or via email to support@itrsgroup.com
- Make sure you provide to us:
- The command you executed
- The time you ran the command
- Gateway log
- Any accompanying screenshot you think might be useful to present the issue
-
Tags:
- commands
- rest api
- command
- databaselogging
Comments
0 comments
Please sign in to leave a comment.