shinken-solutions / shinken

Flexible and scalable monitoring framework
http://www.shinken-monitoring.org
GNU Affero General Public License v3.0
1.13k stars 336 forks source link

Business Rules Regexp not showing all services associated to a host #1820

Open fullmetalucard opened 8 years ago

fullmetalucard commented 8 years ago

Hi

I don't know if it's a bug or if i'm not aware of all we can do with bp_rule. I use them with regular expression, which is very very usefull to get directly all the services associated to a host. Actually i have this kind of bp_rule:

define host {
             use                        gen-host-non-reachable
             host_name                  BR_TEST
             notifications_enabled      0
        }

define service {
             use                        gen-service
             notifications_enabled      0
             host_name                  BR_TEST
             service_description        TEST
             check_command              bp_rule!(MyHost,r:.* & MyHost2,r:.* )
        }

As far as I know, all the services associated to MyHost and MyHost2 are all shown when using bp_rule on navgis map (calling them with the bp_rule as a host) or seen in thruk interface; excepted for one service: the disks

My guess is that it might be because the disks, come from a macro expansion (via duplicate_foreach)

Here is the sample configuration of my hosts:

define host{
        use                     Linux
        host_name               MyHost
        address                 X.X.X.X
  __TBS_WARN            85
  __TBS_CRIT            90
  __DISK                /,/tmp,/var/log,/data
  __TBS_DB              tablespace
  __TBS                 tablespace_number
  __PORT_TOMCAT         6666
  __IP_TOMCAT           X.X.X.X
}

The result is that all oracle or tomcat services, cpu/load/mem (inherited from linux template) appear in Nagvis/thruk but no disks at all.

So I tried something like

MyHost,r:.* & MyHost,/data

But it doesn't work either. What's weird there is that if i launch a "shinken check", arbiter tells me it's ok but if i reload it, disk will be never shown. So I tried to voluntary put a wrong service in my bp_rule like

MyHost,r:.* & MyHost,/dataTEST

Then arbiter tells me i'm wrong and that no services called "/dataTEST" exists. So there is something strange about that. Shinken sees it well, but it doesn't appear with the bp_rule. Maybe this problem deals with expansion.

I was also wondering if it was due to the fact that only the $KEY$ of the duplicated_foreach was used as service_description, but it is not the case. I added "Disk : $KEY$" in it and the service didn't appear in my rule.

I don't know what to do to get those hidden disks. If somebody has an idea on the subject, it would be helpfull

Thx

geektophe commented 8 years ago

No, it doesn't come from expansion. It's done before the business rules are processed.

I'd more suspect a problem the Business view in Thruk.

Just to be sure, could you set up a web UI interface (if you don't have it installed), and see if the /data service appears in the Dependency tree ?

fullmetalucard commented 8 years ago

Hello,

Yes, I didn't mentioned it, but I did try with webui2, and the service didn't appear either.