📜 ⬆️ ⬇️

How to check database availability by external service

Many commercial sites of primary and intermediate level of advancement often face a variety of database problems. In such projects, it is unlikely that there is a database administrator, and other employees cannot or simply do not have time to really set up quality cleaning, replication, backups and other mandatory procedures. More rarely, it is possible to control all this in time and take the necessary measures. What to do? One of the solutions is offered by the HostTracker monitoring service .




What is the salt?


You enter in the form the address of your database and login / password to connect. If this is limited - only the ability to connect to the site will be checked. But you can also write a specific query, for execution at regular checks. The result can be considered, at choice, the number of affected rows (for example, the result of a SELECT COUNT (*) or DELETE query), or the result of the first cell in the first row. Thus, you can control everything that is done in the database, if desired. It is also possible to compare this value with some kind of reference, and provide for a certain logic. For example, to sound an alarm if the reference value is exceeded, differs from the set value, or has gone beyond a certain frame.


The result of such checks is obtained quite understandable and obvious statistics. For example, below are the results of monitoring the size of the database, with a limit of 25 GB. As you can see, the volume increases linearly - either cleaning is not done, or maybe such growth is the normal order of things. On a certain day, the specified volume was exceeded, and the client received a notification, but so far no visible action has been taken. Alternatively, it could be a “fuse” against sudden jumps in volume, but in this case the task should be edited and the critical value increased so that it continues to perform such a function.
')

In addition, the graph shows that the statistics save the time to determine the DNS, the connection and the actual execution of the request. If the query suddenly starts running longer than usual - this is also easy to see in HostTracker statistics.

How safe is it


The security problem really exists: we have the username and password from your database. But following simple rules can prevent potential trouble. First, we recommend configuring the firewall, allowing connections only to the two addresses indicated in the first picture. Secondly, create an account that allows access only to the database and table that is needed to execute the command. And just for reading, of course. Well, by building queries in such a way that only the number or the number of rows is returned, you can be sure that we do not receive any other data. If you really need to, you can create a separate procedure and run only it in the request - in this case, our service will not even get information about the architecture of your database and the names of the tables.

Other interesting things


I will briefly mention other useful functions that can be useful to people who are “responsible for everything” in small companies. Recently, it became possible to check whether the site is on the Roskomnadzor lists , as well as on various spam blockers - the DNSBL lists. Well, the "hit" - a problem that killed a lot of nerves and money. This is a sudden termination of a domain or certificate. And this can also be controlled additionally .

All this is tested and improved, including thanks to the feedback from customers and well-wishers. Therefore, we are always happy to cooperate and constructive criticism.

Source: https://habr.com/ru/post/322854/


All Articles