Xymon Mailing List Archive search

multiple class assignment in hosts.cfg

list David Winterstein
Mon, 22 May 2017 19:29:15 +0200
Message-Id: <user-cdef62cef2f4@xymon.invalid>

Hey again,

I thought I might specify what I'm trying to achieve since I might just
be trying the wrong way.

I would like to configure the most hosts possible by some sort of
grouping or tags - the CLASS function in combination with analysis.cfg
and hosts.cfg seemed to be the right way to do this. But since I'm
running a pretty big network infrastructure with a lot of different
hosts that run different software combinations, I need to be able to
combine some check groups, i.e. the following in analysis.cfg:

  CLASS=web
    PROC  nginx 1 -1
    PROC  php*fpm 1 -1
    PROC  cron 1 -1
  CLASS=db
    PROC  mysqld 1 -1
  CLASS=deb7
    PROC  ntpd 1 -1
  CLASS=deb8
    PROC  systemd-timesyncd 1 -1

So I can just add the PROC checks I need via CLASS assignments in
hosts.cfg and don't need to add custom configuration for every server to
analysis.cfg:

  page myservers My Servers
    group domain1
      1.2.3.1  web.dom.tld  # *CLASS:deb7,web* trace ssh
      1.2.3.2  db.dom.tld   # *CLASS:deb8,db* trace ssh
      1.2.4.1  www.dom.tld  # https://www.dom.tld
      1.2.4.2  dev.dom.tld  # https://user:user-7a8e41b226e7@xymon.invalid
    group domain2
      1.2.3.10 srv.dom2.tld # *CLASS:deb8,web,db* trace ssh
      1.2.4.10 www.dom2.tld # https://www.dom2.tld

And so on... I've got way more combinations, so manually creating
combined classes like "deb7-web", "deb7-db", "deb7-web-db", etc. is not
really an option.

I can't imagine I'm the first person trying to do this since actually
it's pretty essential to have check groups for reduction of redundant
config bloat.

Any help or hints would be really appreciated!

Kind regards and thanks in advance,
  David Winterstein


On 2017-05-19 13:11, David Winterstein wrote:
Hi everybody,

I didn't find something on this topic yet, so I thought I'd give it a
quick try at the mailing list:

Since the class assignment now works like a charm with analysis.cfg and
hosts.cfg (thanks a lot for that!) I wondered how I could possibly
assign multiple classes to a host.

Given an analysis.cfg containing something like this:

  CLASS=class1
    PROC sshd 1 1
  CLASS=class2
    PROC ntpd 1 1

A hosts.cfg like this only uses the first class provided - "class1" in
this case:

  1.2.3.4 srv.dom.tld # CLASS:class1 CLASS:class2

While a hosts.cfg like this seems to combine both class names to the
new, unhandled group "class1,class2":

  1.2.3.4 srv.dom.tld # CLASS:class1,class2

Is there a solution for this already or is it not possible to assign
multiple groups to a single host?

Thanks a lot in advance,
  David Winterstein
-- 

Compositiv GmbH
Hammer Deich 30
20537 Hamburg
Tel: XXX / XXX XXXX X
Fax: XXX / XXX XXXX XX

Geschäftsführer Matthias Krawen
Amtsgericht Hamburg - HRB 122540

USt.-IdNr: DE282432834
Es gelten ausschließlich unsere AGB.