Different alarm settings for different web_log conf

Environment

Ubuntu 18.04 / Apache server

Problem/Question

Hello,
I have the following problematic I’m trying to solve with Netdata.
I have a load balancer performing health check every 30 sec to my server.
I have isolated this data using the following web_log configuration.

apache_log2:
  name: full_log
  path: "/var/log/apache2/access.log"

apache_log_lb:
  name: Log_lb
  path: "/var/log/apache2/access.log"
  filter:
    include: 10.[108|109|110|111].[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3} #Regex to match my LB IPs

The problem is that the alarm for web_log needs at least 120 requests in the last minute, which is not the case for the Log_lb.
Is there a way to modify this value (120/min) for a specific web_log config? Or maybe another way to monitor such connection ?

Thanks for your help on this :slight_smile:

Hey @DeWaRs1206,

There are a couple of things to unpack here. Let me try to help you out, but before we delve into this, I just wanted to welcome you to our community :slight_smile:

For starters, even though you are monitoring your apache server, we are not actually using the apache collector, but the web_log collector. They are 2 different collectors who can monitor apache in a different manner, the first by reading stats from apache directly, while the web_log by reading the logs produced by apache.

If you want to learn more about collectors, take a look at our FAQ about it: What are collectors and how do they work?

Now, what we need is to edit the default alarms for the web_log collector and modify it to our liking.

To modify the health file, you will need to run sudo ./edit-config health.d/web_log.conf. The script is smart enough to see that you haven’t yet edited that health file, thus it will show you the default one and then it will save any changes you make.

Now, it’s time to dive into the syntax for alarms in Netdata. Although it may seem daunting at first, it is really simple and really powerful.

I am not sure what you want to modify exactly, so I can’t help you any further. If you tell me which alarm you want to modify exactly and how, we can work on the syntax together here :slight_smile:

Hi @DeWaRs1206

web_log needs at least 120 requests in the last minute, which is not the case for the Log_lb
Is there a way to modify this value (120/min) for a specific web_log config?

I understand what you mean. Unfortunately, it is not possible to achieve it currently.

There is the list of alarms filters:

None of them allow you to filter on job name (full_log, Log_lb). The job name is part of the job charts ids (e.g: web_log_full_log.CHART_NAME). But still there is nothing that allows to filter using charts ids when using templates.

We added the charts option [PR] to the health templates.

Restrict an alarm or template to only certain charts.

It allows having different alarms for different jobs.

The algorithm is:

  • write an alarm (template) for the specific job
  • using charts filter in this alarm: include only this job and exclude everything else
  • using charts filter in the default alarm: exclude only this job and include everything else

For instance:

# exclude 'apache_log_lb', include eveyrthing else
template: web_log_requests
      on: web_log.request_processing_time
  charts: !*apache_log_lb* *

---

# include 'apache_log_lb', exclude eveyrthing else
template: web_log_requests_apache_log_lb
      on: web_log.request_processing_time
  charts: *apache_log_lb* !*
1 Like

Hello @ilyam8

Thanks a lot for the details, I will have a look asap.

Keep in mind that the feature in the master branch, if you are using stable releases you need to wait for v1.31.0.