Monitoring Nextcloud from Centreon

And how could we not miss a post on how to monitor Nextcloud with Centreon, with all the rattle I'm giving you of these two great products! In this post we will see how to monitor a Nextcloud environment but with very, very interesting metrics! Not just the Linux machine, but also Nextcloud services! Attack@!

 

Apart from monitoring as we already know the Nextcloud machine, that is, the basic components of the operating system, CPU, RAM, Disks, etc.. that you can use This post to support you and create what you need, This post is more oriented to what has been said, the services it offers and interesting metrics. Of course, in the next post we are also going to freak out with cool things that we get on Nextcloud…

 

Come, to the point! First things, We will use in this document a wonderful script of Kozliatko called check_nextcloud.py, With it we will be able to get metrics such as the users we have enabled, the total number of files we have, Data Warehouses, The Database, the data of what they share, Number of items they share, and being able to see the type, If they have a link, contraseña, etc… as well as see the active users at all times.

 

Begin with, on the Centreon machine, We download the script that we will use and put it in the plugins folder:

[SourceCode]wget https://raw.githubusercontent.com/BornToBeRoot/check_nextcloud/master/check/check_nextcloud.py
chmod +x check_nextcloud.py
MV check_nextcloud.py /usr/lib/centreon/plugins/[/SourceCode]

 

Remember that like almost any script, If we pass it a /h we can see all the help and all the possibilities it will give us. Oh by the way, If you have a certificate and are interested in monitoring it, You can review This post, or if you want to see if it has any specific ports raised go over This other one

By the way, in this post I omit the creation of the Host in Centreon, which is the Nextcloud machine to use, You know that and if you don't, Remember that you have it in the post of How to Monitor a Linux Computer.

 

Once the script is ready, we have to register the Command (since “Configuration” > “Commands” > “Add…”), creating a single Command to monitor all the Services will be enough, We will have to indicate a user with administrator privileges in Nextcloud and their password, followed by the URL of our Nextcloud site and at the end we will pass an argument indicating the type of check we will do:

  • Command Name: check_nextcloud.py
  • Command Type: $CENTREONPLUGINS$/check_nextcloud.py -u USERNAME -p PASSWORD -H datos.openservices.eus -c $ARG 1$
  • Arguments: By putting 1 argument is valid for us and it will be to use it in the type of check that will be done.

 

In this example we're going to generate 5 Services with the Command we just created, we will associate them with the Nextcloud Host that we will have already created, since “Configuration” > “Services” > “Add…”. Here are the 5 Services, I tell you the Argument that each one would have associated and what we can see with them:

  • Storage with the argument 'storage’ will tell us the users who are registered in Nextcloud, the number of files, The number of warehouses, of folders, etc…
  • Database with the argument 'database’ it will tell us the MySQL version and the size of the database.
  • Shared with the argument 'shares’ it will tell us all the items that our users have shared, If they are folders, Files, with him he is born, No password, with expiration…
  • System with the argument 'System’ it will tell us if Nextcloud is running and its version.
  • Active users with the argument 'activeUsers’ it will tell us the active user sessions we have had in the last few years. 5 minutes, in the last hour or in the last 24 hours.

 

As usual, after saving and exporting our Centreon settings, we will now be able to see the monitoring status on our Nextcloud server! A marvel! We know some of the 5 Services created, because CPU consumption, RAM, Swap Memory, Certificate, DB, Disks, net… How big! Well, in a next post we will hallucinate with other cute things that we can get out of it… So tod@s watchful eye!

 

Recommended Posts

Author

nheobug@bujarra.com
Autor del blog Bujarra.com Cualquier necesidad que tengas, Do not hesitate to contact me, I will try to help you whenever I can, Sharing is living ;) . Enjoy documents!!!