by Kuba
Posted on Wed Jan 10 13:40:00 GMT 2018
Let’s get real… monitoring is what? Fundamental. Read our entry to find out about its benefits.
This tutorial will show you how to configure CULA and the bash script to allow CULA to monitor your server.
What you need:
Think about the parameters that are of interest to you. Here, we’re going to use basic paratemters such as the CPU and memory (CPU and MEM) usage and the disk usage (DISK_USAGE) on your server. While adding a new server, CPU and MEM are generated automatically. They can be easily deleted if you do not find them necessary.
After adding a server, go to its settings. The screenshot below presents the initial view.
Each parameter has the following options:
Example settings for a server:
Now the script needs to be generated so that you can run it on your server.
How do I use the generated script?
The script is as easy as it can be to make sure you will understand how to use it. It’ll send the monitored parameters to CULA. It’ll happen every 120 seconds. More frequent tries will be rejected by the server. Take a look at representative server parameters. The generated script should look like this:
Each generated function in the script should return the value of the parameter. In each generated function you need to implement (in #TO_IMPLEMENT) the code responsible for getting the value of the parameter. You can use the examples attached to the script. The name of the function should not be changed. For our parameter under the id = ’cpu’ in CULA’s server settings, the name of the function will follow this pattern: function collect_cpu()
, identically for the id = ’disk_usage’: function collect_disk_usage()
. The value must be above zero. The floating-point values are allowed. It’s important for the returning of the values to be included in the last line with the echo command, for example echo 0. The representative implementation of the function that returns the value of the memory available on the server:function collect_mem_total() {
total_mem=$(free -m | grep ^Mem | tr -s ’ ’ | cut -d ’ ’ -f 2)
echo $total_mem
}
An example of a correctly configured script:
PAY ATTENTION
The script needs to be activated at the starting of a server. It’ll allow the monitoring to start immediately.
If you have configured everything according to this tutorial, after logging into CULA and selecting your server (the right-hand panel) you’ll see a dashboard with the selected parameters.
Don’t hesitate to get in touch with us with comments, questions or feedback via our chat or contact@cula.io