ndelitski / rancher-alarms

Will kick your ass if found unhealthy service in Rancher environment
85 stars 20 forks source link

Feature request - ignore list #31

Open VAdamec opened 7 years ago

VAdamec commented 7 years ago

Add possibility to ignore some services (for example I have special Jenkins job which will remove and create testing service every minute to measure Rancher responses and catch possible bottlenecks). Right now no idea how to do it properly (without some superstupid condition and regexp in monitor.es6) but I'll try to sent some PR.

VAdamec commented 7 years ago

Hm, already here :-) ALARM_FILTER

VAdamec commented 7 years ago

Hm, but seems that's only positive filter (match only ALARM_FILTER), what's probably better is negative (filter out given regexp)

VAdamec commented 7 years ago

Easiest is negate actual filter (server.es6)

diff --git a/eventer/src/server.es6 b/eventer/src/server.es6
index 5f83781..fe521b4 100644
--- a/eventer/src/server.es6
+++ b/eventer/src/server.es6
@@ -133,12 +133,12 @@ import assert from 'assert';
       const matched = some(config.filter, (f) => fullName.match(new RegExp(f)));

       if (matched) {
-        return true;
-      } else {
         trace(`${fullName} ignored due to global filter setup('filter' config option)`)
+      } else {
+        return true;
       }
     } else {
-      return true;
+      return false;
     }
   }

I will try to introduce negative filter option later.

qiuwei commented 6 years ago

This feature is definitely needed. Although the same thing could be done using looking head feature of RegExp, it's over complicated.