6.4 Processing Monitoring Tools
There are also several monitoring tools to make your daily life easier.
One of the most popular monitoring tools is Nagios. It is widely used and also supports a variety of software components.
To use Nagios to monitor your PostgreSQL cluster, you need to install a plugin that runs replication-related tests. This plugin for PostgreSQL is free to download from Http://bucardo.org/wiki/Check_postgres. A plug-in for Nagios Burcardo not only for testing replication, but also as a standard software component for monitoring PostgreSQL.
6.4.1 Installation Check_postgres
Once you have downloaded the plugin from Bucardo's website, it is easy to install the software. The first step is to extract the. Tar archive:
Tar Xvfz check_postgres.tar.gz
Now you can go to the newly created directory and run Perl Makefile:
Perl makefile.pl
Finally you can compile and install the code:
Make
Make install
The final step must be performed using the root user, because if not, you may not have sufficient permissions to deploy code on your system.
In our example, the binaries are installed in the/usr/local/bin directory. We can easily check if it has been successfully installed by running the following command:
/usr/local/bin/check_postgres.pl--help
Starting check_postgres.pl directly is also a way to downgrade these plugins at the command-line prompt and check the results for meaning.
We want you to focus on the Custom_query function. If the check is missing, the missing thing is needed, but not used, Custom_query will help you.
6.4.2 Decision monitoring strategy
People often ask what checks in the countless checks that can be nagios, and they can be used to configure its database system. For us, the answer to the question can only be: it depends on the situation. If you happen to run a large database analysis, the database will only be used by a few people, and it may be useless to check the number of open database connections. If you happen to run a high-performance OLTP system that serves tens of thousands of users, checking for open connections can be a good note.
It really depends on the type of app you're running, so you have to think for yourself and come up with a reasonable check-up and thresholds. Logically, this also applies to any other monitoring software that you can potentially think of. The rules are the same: think about what your application is doing and think about things that might go wrong. Based on this information, you can select the appropriate check. All available checklists can be found in http://bucardo.org/check_postgres/check_postgres.pl.html.
6.5 Summary
In this chapter, you learned a lot about monitoring. We saw what was checked in the archive and we've seen how to interpret the PostgreSQL internal system view. Finally, we see which processes are checked at the operating system level.
In general, it is recommended to use professional monitoring software such as Zabbix,nagios and other software that automatically runs tests and automatically notifies.
All of these checks will provide a fairly good safety net for your database setup.
The next chapter is dedicated to high availability. We'll walk you through the basics of high-availability-related concepts that are important to you.
The sixth chapter of PostgreSQL Replication Monitoring your settings (4)