On Monday 20 May 2002 08:46 pm, you wrote:
> Im just starting out with mon, and find it very cool, but also some things
> are a pain. I have various hostgroups, which all need a core set of
> services checked, then some other services which are unique to the
> hostgroup. Example:
>
> The DNS hostgroup will check ssh, disk, ping, ... dns
> The WWW hostgroup will check ssh, disk, ping, ... http
>
> etc..So, is there a way for me to do an include where we have something
> like:
>
> watch www
> Inlcude core-checks
If you use m4 for your configuration, includes are a breeze with the
'include' command. Actually what most mon+m4 users end up doing is defining
macros for their commonly monitored service parameters which make the end
config file relatively small.
Something like this, for each hostgroup:
SIMPLE_WATCH(`www', `_BOFH_EMAIL_', `http', `https')
where the m4 macros are defined as follows:
define(_BOFH_EMAIL_, `[EMAIL PROTECTED]')dnl
define(_GRAVE_HOURS_, ``wd {Sun-Sat} hr {11pm-6am}'')dnl
define(_NON_GRAVE_HOURS_, ``wd {Sun-Sat} hr {6am-11pm}'')dnl
define(`_SIMPLE_WATCH', `dnl
ifelse(1, $#, ,2, $#, ,3, $#, `SIMPLE_SERVICE($1,`$2',$3)', `dnl
SIMPLE_SERVICE($1,`$2',$3)' `_SIMPLE_WATCH($1, `$2',
shift(shift(shift($@))))')')dnl
dnl ')dnl
dnl #
define(`SIMPLE_WATCH', `dnl
watch $1
service ping
description test service $3 in hostgroup $1
interval 30s
monitor fping.monitor
description ping servers in hostgroup $1
period DAY: _NON_GRAVE_HOURS_
alertafter 3 2m
alert netpage.alert $2
alertevery 15m
alert _FILE_ALERT_
period GRAVE: _GRAVE_HOURS_
alertafter 3 2m
alertevery 15m
alert netpage.alert $2 _GRAVE_PAGER_
alert _FILE_ALERT_
_SIMPLE_WATCH($1,`$2',shift(shift($@)))')dnl
dnl _SIMPLE_WATCH($1,$`2',shift(shift($@)))')dnl
dnl ')dnl
> Is anything like this currently implemented? Also, anyway to also include
> a hostlist from a mysql database or at least from a file list or dbm
> file? I have one hostgroup which has approx. 500 hosts!
>
> So, something like:
>
> hostgroup www "Include /path/to/www.hostlist"
>
> or:
>
> hostgroup www "mysql -u view -h mysql ...."
>
> This doable? Something like this in place?
Again, with m4, you can either use file-based includes or even the 'esyscmd'
(assuming GNU m4, which you definitely should be using), which allows you to
insert the output of arbitrary shell commands directly in your m4 output file.
> It's a bit hard to
> find some more in-depth faqs online regarding mon, so if anyone can supply
> me with some links, and also any mail archive that is a bit more thorough
> than the 'mail-archive.com' one, I will greatly appreciate it.
The mailing lists do have some good nuggets, but most are buried. The mailing
list is your best source of info.
andrew