Monitoring Oracle Servers With Checkmk
Databases are essential for many IT processes. Their performance and reliability depends on many factors and it makes sense to use a dedicated tool that helps you to stay on top of things. Monitoring your database with an external tool helps you identify performance issues proactively, but there are many factors to consider. With the wrong approach, you run the risk of missing valuable information and also can waste a lot of time configuring your database monitoring.
In this tutorial, I will give a quick guide on how to monitor Oracle Database with Checkmk, a universal monitoring tool for all kinds of IT assets. Oracle Database is one of the most common database management systems (DBMS) for relational databases and Checkmk comes with a great preconfigured Oracle monitoring, so it will only take you a few minutes to get started. This will not only ensure the best performance of your databases, but also give you the option to find optimization opportunities.
Preconditions
You need a Checkmk site up and running. For this article, I am using the Checkmk Free Edition version 2.1.0p19, which I installed on Ubuntu server (version 20.04). Checkmk runs on Linux, including RHEL, CentOS, Debian, and others, as well as in a container, or as a virtual appliance. You can download the latest Checkmk version for all platforms from the official Checkmk website and follow this video tutorial to take your first steps.
In this tutorial, I will use a simple Oracle server as an example. In my case, my Oracle database version 19.0 runs on a hardware server, and I use Rocky Linux version 9.0 as my operating system. I will show you how to configure and install the Checkmk agent. However, Checkmk can also monitor remote databases without the need to install an agent.
You don’t need any previous experience with Oracle monitoring, as Checkmk takes over the collection of the most important monitoring services and also sets threshold values for warnings and critical states. However, you need access rights to create user accounts for the database you want to monitor, you will do this in the first step.
Step 1: Creating an Oracle user account for the monitoring
First, you need to create a user account that Checkmk will use to query the monitoring data from your database. In my case, I am using SQL Plus
and create the user through the terminal. The procedure differs depending on which Oracle environment and tool you are using. You can read more details about this in the Oracle documentation.
- In my example, I switch to the Oracle user for this and log in as sysdba.
su - oracle sqlplus / as sysdba
- Now, I create a user account for the monitoring. In my case, I have called it ‘checkmk’.
create user checkmk identified by MySecurePassword
- After creating the user account, assign access rights and the rights to start a session to this user account.
grant select_catalog_role to checkmk grant create session to checkmk
- You can now test the connection with
connect
:
connect checkmk/MySecurePassword
‘MySecurePassword’ is only a placeholder, of course. Please use a strong password with sufficient length and a mixture of upper and lower case letters, numbers and special characters. Once you have created a user, you can switch to your Checkmk site for the next step.
Step 2: Using the Oracle monitoring rule in Checkmk
You will now use the Oracle database agent rule to create a Checkmk agent that you later will install on your Oracle server. To do so, you will use the Checkmk Agent Bakery, which is not part of the Checkmk Raw Edition. If you are using the Checkmk Raw Edition, you would instead need to configure the plug-in via the command line. To do this, follow the instructions in the article on monitoring Oracle databases in the Checkmk documentation.
- Open Checkmk.
- Go to Setup and search for ‘oracle database’. Click on ‘ORACLE databases (Linux, Solaris, AIX, Windows)’.
Under ‘ORACLE databases (Linux, Solaris, AIX, Windows)’, you see a lot of options to configure your Oracle monitoring. However, Checkmk provides you with good default values. For most uses cases, you just need to activate a few boxes:
- Tick the first box in front of Activation and leave the default setting as ‘Deploy ORACLE database plugin’.
- Because my Oracle database server runs on a Linux distribution using a systemd as super server daemon, I need to activate Host uses xinetd or systemd (Linux/AIX/Solaris only), and select the option ‘systemd’. I leave Interval at one minute.
- At Login Defaults, you need to add your user account credentials. Activate the box and then choose Authentication method to log in with your user account.
- In my case, I keep the option ‘Login with the following credentials’ and my user account ‘checkmk’ and my password from before.
- Click on Save.
Step 3: Baking and installing of the Checkmk agent
After the configuration, you need to use the Agent Bakery to bake an agent package.
Click on Setup and go to Windows, Linux, Solaris, AIX.
Now, click on Bake agents.
You need to wait until the Agent Bakery is done, then you should see a new available agent configuration.
Click on the format that suits your Oracle database server. In my case the RPM package will do the trick.
After the download, install the package. I am using dnf
on the terminal
sudo dnf install check-mk-agent-2.1.0p19-0a8bd97002c9f415.noarch.rpm
Step 4: Adding an Oracle server to the monitoring in Checkmk
Now you can add your Oracle server to the monitoring in Checkmk, so you need to go back to your Checkmk site.
Go to Setup and click on Host.
Click on Add host.
Under Hostname, you add the name of your Oracle server. In my case ‘oracle-rocky-01.demo.tribe29.com’.
Click on Save & go to service configuration.
The name of my Oracle server is resolvable by DNS. If that is not the case for you, you must activate the IPv4 address option and enter the server’s IP address.
You have to wait for the automatic service detection. After that, click on Accept all to add all the detected services.
Confirm the changes you made by clicking on the yellow icon with the exclamation mark in the top right corner. You should see the number of ‘changes’ there.
Click Activate on selected sites.
And that was it, your database server is now monitored. Go to Monitor and you find your database server host under All Hosts. With a click on the host, you get to the host view:
Summary
This basic tutorial provides you with an introduction on how to monitor Oracle Database. You build yourself a good foundation, but there is more to do. You should monitor your server hardware, as well, and you probably also want to know more about all the configuration options within Checkmk. Also, I mentioned monitoring remote databases. Thus, I recommend reading this blog about Oracle monitoring, because it provides answers to these points and also shows you how to monitor Oracle Cloud Infrastructure. For more general information on monitoring databases, you should check out this article on SQL Server Monitoring.