Re: [icinga-users] Using check_multi with Icinga2

2016-07-14 Thread Michael Friedrich

> On 14 Jul 2016, at 00:17, Michael Martinez  wrote:
>
> Hi, thanks for replying.
>
> Actually, I made a mistake typing this. I really mean "check_cluster",
> and I was able to figure it out. It basically takes an argument like
> this, which is passed back to the command:
>
> vars.cluster_data = {{
> get_host("ec2-54-198-210-49.compute-1.amazonaws.com").state
> + "," + get_host("ec2-54-162-245-143.compute-1.amazonaws.com").state }}
>
> (NOTE: "state_id" throws an error, while "state" returns a numeric
> value, so I think the documentation is outdated)
>
> **
> Now I need a way to populate the cluster_data variable with a list of
> hosts that belong to a particular hostgroup. Is there a way to
> programmatically do this in Icinga2?

Something like that - you can lookup the possible language features in the 
documentation.
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/library-reference#array-type
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/library-reference#objref-get_objects
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/language-reference#for-loops


var hg_name = “myhostgroup"
var data = []
for (h in get_objects(Host)) {
  if (hg_name in h.groups) {
data.add(h.name)
  }
}

return data.join(“,”)


>
>
> On Wed, Jul 13, 2016 at 10:18 AM, Michael Friedrich
>  wrote:
>> Am 12.07.2016 um 20:30 schrieb Michael Martinez:
>>>
>>> Can someone give an example of how to use check_multi with Icinga2?
>>>
>> I'd write a CheckCommand object based on its --help output. You'll
>> obviously need to pass additional "cmd" file configuration in its own
>> language.
>>
>>
>> AFAIK I did write some wiki articles for Icinga 1.x in early 2012 on
>> check_multi, might be a good starting point.
>>
>>
>> Kind regards,
>>
>> Michael
>>
>>
>> --
>> Michael Friedrich, DI (FH)
>> Senior Developer
>>
>> NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
>> Tel: +49 911 92885-0 | Fax: +49 911 92885-77
>> CEO: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
>> http://www.netways.de | michael.friedr...@netways.de
>>
>> ** OSBConf 2016 - September - osbconf.org **
>> ** OSMC 2016 - November - netways.de/osmc **
>> ___
>> icinga-users mailing list
>> icinga-users@lists.icinga.org
>> https://lists.icinga.org/mailman/listinfo/icinga-users
>
>
>
> --
> ---
> Michael Martinez
> http://www.michael--martinez.com
> ___
> icinga-users mailing list
> icinga-users@lists.icinga.org
> https://lists.icinga.org/mailman/listinfo/icinga-users


-- 
Michael Friedrich, DI (FH)
Senior Developer

NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
CEO: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | michael.friedr...@netways.de

** OSBConf 2016 - September - osbconf.org **
** OSMC 2016 - November - netways.de/osmc **
___
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users


Re: [icinga-users] Icinga - service dependency does not work properly

2016-07-14 Thread Szabó Gergő
Hi Michael!

Sorry, but I can't publish these config files due to company's privacy. :(
There are no any special configuration, Till I didn't expand configuration
with service dependency, we got a lot of notifications from monitored
devices, but now the problem is that we don't get if is necessary. I have
searched for this case on the internet, how it should to use, but when I
compared with existing (and previously mentioned test) configuration, there
were no differences in logic, also by Nagios books the config seems like it
should. I have been using and configuring Icinga for many years, so I
think, that it may be a bug or something else, which is occuring only at
large networks (there are ~1000 hosts, ~3000 services and ~1
host/service dependencies).

Perhaps... any idea, that what can cause this abnormal behaviour?

Thanks for reply!


Gergo

2016-07-13 19:17 GMT+02:00 Michael Friedrich :

> Am 13.07.2016 um 17:37 schrieb Szabó Gergő:
>
>> Hi all!
>>
>> I have previously configured some service dependencies as it seems
>> below (for example):
>>
>> define servicedependency{
>> host_name   myHost
>> service_description pingv4
>> dependent_host_name myHost
>> dependent_service_description   service1, service2
>> notification_failure_criteria   w,u,c
>> }
>>
>> The problem is that today the myHost went down for some minutes and
>> didn't come any notification related to myHost reachability. If I
>> searched for notifications in Icinga, there were all of related
>> notifications in the Alert history.
>> So, the main problem is, that if myHost fails on pingv4 service too,
>> doesn't come any notification about it (of course neither of dependent
>> services).
>>
>> Last month I tested similar configuration in Icinga and it worked. I
>> don't know, where is the configuration wrong (if it is anywhere).
>>
>> Did anybody hear about similar Icinga bug?
>>
>
> Can you provide some more configuration items and logs to allow the
> reader reproduce the problem more easily? :)
>
> Kind regards,
> Michael
>
>
> --
> Michael Friedrich, DI (FH)
> Senior Developer
>
> NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
> Tel: +49 911 92885-0 | Fax: +49 911 92885-77
> CEO: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
> http://www.netways.de | michael.friedr...@netways.de
>
> ** OSBConf 2016 - September - osbconf.org **
> ** OSMC 2016 - November - netways.de/osmc **
> ___
> icinga-users mailing list
> icinga-users@lists.icinga.org
> https://lists.icinga.org/mailman/listinfo/icinga-users
>
___
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users


Re: [icinga-users] Icinga - service dependency does not work properly

2016-07-14 Thread Brian O'Neill
You say the host went down...do you have a host check as well? If the 
host check fails, a service check won't notify, at least in the default 
configuration I believe. You should get a host down notification (if 
configured) and that's it.



On 7/14/2016 8:27 AM, Szabó Gergő wrote:

Hi Michael!

Sorry, but I can't publish these config files due to company's privacy. :(
There are no any special configuration, Till I didn't expand
configuration with service dependency, we got a lot of notifications
from monitored devices, but now the problem is that we don't get if is
necessary. I have searched for this case on the internet, how it should
to use, but when I compared with existing (and previously mentioned
test) configuration, there were no differences in logic, also by Nagios
books the config seems like it should. I have been using and configuring
Icinga for many years, so I think, that it may be a bug or something
else, which is occuring only at large networks (there are ~1000 hosts,
~3000 services and ~1 host/service dependencies).

Perhaps... any idea, that what can cause this abnormal behaviour?

Thanks for reply!


Gergo

2016-07-13 19:17 GMT+02:00 Michael Friedrich
mailto:michael.friedr...@netways.de>>:

Am 13.07.2016 um 17:37 schrieb Szabó Gergő:

Hi all!

I have previously configured some service dependencies as it seems
below (for example):

define servicedependency{
host_name   myHost
service_description pingv4
dependent_host_name myHost
dependent_service_description   service1, service2
notification_failure_criteria   w,u,c
}

The problem is that today the myHost went down for some minutes and
didn't come any notification related to myHost reachability. If I
searched for notifications in Icinga, there were all of related
notifications in the Alert history.
So, the main problem is, that if myHost fails on pingv4 service too,
doesn't come any notification about it (of course neither of
dependent
services).

Last month I tested similar configuration in Icinga and it worked. I
don't know, where is the configuration wrong (if it is anywhere).

Did anybody hear about similar Icinga bug?


Can you provide some more configuration items and logs to allow the
reader reproduce the problem more easily? :)

Kind regards,
Michael


-- 
Michael Friedrich, DI (FH)
Senior Developer

NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0  | Fax: +49 911
92885-77 
CEO: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | michael.friedr...@netways.de


** OSBConf 2016 - September - osbconf.org  **
** OSMC 2016 - November - netways.de/osmc  **
___
icinga-users mailing list
icinga-users@lists.icinga.org 
https://lists.icinga.org/mailman/listinfo/icinga-users




___
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users


___
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users


Re: [icinga-users] Icinga - service dependency does not work properly

2016-07-14 Thread Szabó Gergő
Yes, of course, I configured host check for each device too. By the way,
since I have configured dependencies, don't come any host alert
notification (up or down), but host dependencies doesn't include parts,
that can cause this behaviour. For example, there is myHost, and two
related dependencies (the full configuration is based on this pattern):

define servicedependency{
host_name   myHost
service_description pingv4
dependent_host_name myHost
dependent_service_description   ospf_neighbor_count,
bgp_neighbor_count
notification_failure_criteria   w,u,c
}

define hostdependency{
host_name   myHost
dependent_host_name l2vpn-myHost, l3vpn-myHost
notification_failure_criteria   d,u
}

The goal of service dependency is to repress all of service notifications
for device when it is down - I thought, if I will check pingv4 service and
it fails, none of other services will notify.
On the other hand, host dependency is only for repress hosts alerts for
related l2vpn and l3vpn hosts - it is working.


Thanks in advance!


Gergo



2016-07-14 14:32 GMT+02:00 Brian O'Neill :

> You say the host went down...do you have a host check as well? If the host
> check fails, a service check won't notify, at least in the default
> configuration I believe. You should get a host down notification (if
> configured) and that's it.
>
>
> On 7/14/2016 8:27 AM, Szabó Gergő wrote:
>
>> Hi Michael!
>>
>> Sorry, but I can't publish these config files due to company's privacy. :(
>> There are no any special configuration, Till I didn't expand
>> configuration with service dependency, we got a lot of notifications
>> from monitored devices, but now the problem is that we don't get if is
>> necessary. I have searched for this case on the internet, how it should
>> to use, but when I compared with existing (and previously mentioned
>> test) configuration, there were no differences in logic, also by Nagios
>> books the config seems like it should. I have been using and configuring
>> Icinga for many years, so I think, that it may be a bug or something
>> else, which is occuring only at large networks (there are ~1000 hosts,
>> ~3000 services and ~1 host/service dependencies).
>>
>> Perhaps... any idea, that what can cause this abnormal behaviour?
>>
>> Thanks for reply!
>>
>>
>> Gergo
>>
>> 2016-07-13 19:17 GMT+02:00 Michael Friedrich
>> mailto:michael.friedr...@netways.de>>:
>>
>>
>> Am 13.07.2016 um 17:37 schrieb Szabó Gergő:
>>
>> Hi all!
>>
>> I have previously configured some service dependencies as it seems
>> below (for example):
>>
>> define servicedependency{
>> host_name   myHost
>> service_description pingv4
>> dependent_host_name myHost
>> dependent_service_description   service1, service2
>> notification_failure_criteria   w,u,c
>> }
>>
>> The problem is that today the myHost went down for some minutes
>> and
>> didn't come any notification related to myHost reachability. If I
>> searched for notifications in Icinga, there were all of related
>> notifications in the Alert history.
>> So, the main problem is, that if myHost fails on pingv4 service
>> too,
>> doesn't come any notification about it (of course neither of
>> dependent
>> services).
>>
>> Last month I tested similar configuration in Icinga and it
>> worked. I
>> don't know, where is the configuration wrong (if it is anywhere).
>>
>> Did anybody hear about similar Icinga bug?
>>
>>
>> Can you provide some more configuration items and logs to allow the
>> reader reproduce the problem more easily? :)
>>
>> Kind regards,
>> Michael
>>
>>
>> --
>> Michael Friedrich, DI (FH)
>> Senior Developer
>>
>> NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
>> Tel: +49 911 92885-0  | Fax: +49 911
>> 92885-77 
>> CEO: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
>> http://www.netways.de | michael.friedr...@netways.de
>> 
>>
>> ** OSBConf 2016 - September - osbconf.org  **
>> ** OSMC 2016 - November - netways.de/osmc  **
>> ___
>> icinga-users mailing list
>> icinga-users@lists.icinga.org 
>> https://lists.icinga.org/mailman/listinfo/icinga-users
>>
>>
>>
>>
>> ___
>> icinga-users mailing list
>> icinga-users@lists.icinga.org
>> https://lists.icinga.org/mailman/listinfo/icinga-users
>>
>> ___
> icinga-users mailing list
> icinga-users@lists.icinga.org
> https://

Re: [icinga-users] Icinga - service dependency does not work properly

2016-07-14 Thread Brian O'Neill

I'm not talking about the host dependency, but the host check itself.

Did you receive a host down notification? Are you configured to receive 
one if the host is down?


Did the logs show that the host is down?

Did the pingv4 check reach a HARD state?

How it is working on my systems is that if the host is DOWN (or 
UNREACHABLE) and HARD, all the services stop getting checked, and will 
not reach HARD state. Thus no notifications for the services will go 
out, so long as the check interval of the host isn't longer than the 
check/recheck interval of the services.


I don't use a ping service for service dependencies in that way, since 
if the host is down the service checks are suppressed. I do have a ping 
service check for statistical purposes (my host checks only do a couple 
pings, while the service check does more to better measure loss and RTA)



On 7/14/2016 9:05 AM, Szabó Gergő wrote:

Yes, of course, I configured host check for each device too. By the way,
since I have configured dependencies, don't come any host alert
notification (up or down), but host dependencies doesn't include parts,
that can cause this behaviour. For example, there is myHost, and two
related dependencies (the full configuration is based on this pattern):

define servicedependency{
host_name   myHost
service_description pingv4
dependent_host_name myHost
dependent_service_description   ospf_neighbor_count,
bgp_neighbor_count
notification_failure_criteria   w,u,c
}

define hostdependency{
host_name   myHost
dependent_host_name l2vpn-myHost, l3vpn-myHost
notification_failure_criteria   d,u
}

The goal of service dependency is to repress all of service
notifications for device when it is down - I thought, if I will check
pingv4 service and it fails, none of other services will notify.
On the other hand, host dependency is only for repress hosts alerts for
related l2vpn and l3vpn hosts - it is working.


Thanks in advance!


Gergo



2016-07-14 14:32 GMT+02:00 Brian O'Neill mailto:one...@oinc.net>>:

You say the host went down...do you have a host check as well? If
the host check fails, a service check won't notify, at least in the
default configuration I believe. You should get a host down
notification (if configured) and that's it.


On 7/14/2016 8:27 AM, Szabó Gergő wrote:

Hi Michael!

Sorry, but I can't publish these config files due to company's
privacy. :(
There are no any special configuration, Till I didn't expand
configuration with service dependency, we got a lot of notifications
from monitored devices, but now the problem is that we don't get
if is
necessary. I have searched for this case on the internet, how it
should
to use, but when I compared with existing (and previously mentioned
test) configuration, there were no differences in logic, also by
Nagios
books the config seems like it should. I have been using and
configuring
Icinga for many years, so I think, that it may be a bug or something
else, which is occuring only at large networks (there are ~1000
hosts,
~3000 services and ~1 host/service dependencies).

Perhaps... any idea, that what can cause this abnormal behaviour?

Thanks for reply!


Gergo

2016-07-13 19:17 GMT+02:00 Michael Friedrich
mailto:michael.friedr...@netways.de>
>>:


Am 13.07.2016 um 17:37 schrieb Szabó Gergő:

Hi all!

I have previously configured some service dependencies
as it seems
below (for example):

define servicedependency{
host_name   myHost
service_description pingv4
dependent_host_name myHost
dependent_service_description   service1, service2
notification_failure_criteria   w,u,c
}

The problem is that today the myHost went down for some
minutes and
didn't come any notification related to myHost
reachability. If I
searched for notifications in Icinga, there were all of
related
notifications in the Alert history.
So, the main problem is, that if myHost fails on pingv4
service too,
doesn't come any notification about it (of course neither of
dependent
services).

Last month I tested similar configuration in Icinga and
it worked. I
don't know, where is the configuration wrong (if it is

Re: [icinga-users] Icinga - service dependency does not work properly

2016-07-14 Thread Szabó Gergő
Hi Brian!

2016-07-14 15:14 GMT+02:00 Brian O'Neill :

> I'm not talking about the host dependency, but the host check itself.
>

I know. :)


> Did you receive a host down notification? Are you configured to receive
> one if the host is down?
>

Yes, previously I have no problem with it.


> Did the logs show that the host is down?
>

Yes, but it seems, that it reached only the second SOFT check:
[2016-07-14 10:36:55] HOST ALERT: myHost;DOWN;SOFT;2;(Host Check Timed Out)

A host down notification should came due to device reload, but it can be
possible, that check_interval is too high to perceive if a device is
unreachable (is in host down state) - check_interval = 5min, retry_interval
= 2min.


> Did the pingv4 check reach a HARD state?
>

Yes.
[2016-07-14 10:34:15] SERVICE ALERT: myHost;PING_IPv4;CRITICAL;HARD;1;PING
CRITICAL - Packet loss = 100%


>
> How it is working on my systems is that if the host is DOWN (or
> UNREACHABLE) and HARD, all the services stop getting checked, and will not
> reach HARD state. Thus no notifications for the services will go out, so
> long as the check interval of the host isn't longer than the check/recheck
> interval of the services.
>
I don't use a ping service for service dependencies in that way, since if
> the host is down the service checks are suppressed. I do have a ping
> service check for statistical purposes (my host checks only do a couple
> pings, while the service check does more to better measure loss and RTA).


Till I didn't configure dependencies, when a device went down, all of
related services notified too, this was the main problem. :( Unfortunately,
I inherited the whole Icinga configuration from my ex-colleague, so now I'm
on the way to fix some problems and configure new Icinga2 from the
beginning. :)



Gergo
___
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users


[icinga-users] Exclude notifying contacts for specific hostgroups

2016-07-14 Thread Matt Shields
Is there a way to send notifications to all contacts in two groups, but for
some host groups exclude one of the groups?

I have around 1000 hosts divided up into a number of hostgroups (db, app,
web, etc), I also have two hostgroups for if they are development or
production.  For the production servers I want all service notifications to
go to the admins contact group, and for development I want it to go to the
admins and developers contact groups. I'd rather not setup two separate
services (one for prod and one for dev servers).

Matt
___
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users


Re: [icinga-users] Icinga - service dependency does not work properly

2016-07-14 Thread Szabó Gergő
So, it seems that I found the answer. :)

As you have written: "if the host is down the service checks are
suppressed". This would be the correct working situation, if is everything
OK with the configuration. But, there is an excellent topic about this case:

http://sites.box293.com/nagios/guides/configurations-and-definitions/host-and-service-check-intervals

It is unnecessary to define any dependency configuration, just normalize
the checking intervals, because in ordinary case, if the Icinga knows, that
a host is down, either of associated service checks will perform. The
problem is when service check reaches earlier the hard state than host
check and implies a notification, before Icinga can be aware of host's
unreachability (down state).
I have mentioned, that the whole configurations is not my creature, I have
just inherited it from my ex-colleague. It seems, the check intervals were
incorrect and I have to think about it and fix them. :)

Thank you for previous answers!


Kind regards:
Gergo

2016-07-14 15:42 GMT+02:00 Szabó Gergő :

> Hi Brian!
>
> 2016-07-14 15:14 GMT+02:00 Brian O'Neill :
>
>> I'm not talking about the host dependency, but the host check itself.
>>
>
> I know. :)
>
>
>> Did you receive a host down notification? Are you configured to receive
>> one if the host is down?
>>
>
> Yes, previously I have no problem with it.
>
>
>> Did the logs show that the host is down?
>>
>
> Yes, but it seems, that it reached only the second SOFT check:
> [2016-07-14 10:36:55] HOST ALERT: myHost;DOWN;SOFT;2;(Host Check Timed Out)
>
> A host down notification should came due to device reload, but it can be
> possible, that check_interval is too high to perceive if a device is
> unreachable (is in host down state) - check_interval = 5min, retry_interval
> = 2min.
>
>
>> Did the pingv4 check reach a HARD state?
>>
>
> Yes.
> [2016-07-14 10:34:15] SERVICE ALERT: myHost;PING_IPv4;CRITICAL;HARD;1;PING
> CRITICAL - Packet loss = 100%
>
>
>>
>> How it is working on my systems is that if the host is DOWN (or
>> UNREACHABLE) and HARD, all the services stop getting checked, and will not
>> reach HARD state. Thus no notifications for the services will go out, so
>> long as the check interval of the host isn't longer than the check/recheck
>> interval of the services.
>>
> I don't use a ping service for service dependencies in that way, since if
>> the host is down the service checks are suppressed. I do have a ping
>> service check for statistical purposes (my host checks only do a couple
>> pings, while the service check does more to better measure loss and RTA).
>
>
> Till I didn't configure dependencies, when a device went down, all of
> related services notified too, this was the main problem. :( Unfortunately,
> I inherited the whole Icinga configuration from my ex-colleague, so now I'm
> on the way to fix some problems and configure new Icinga2 from the
> beginning. :)
>
>
>
> Gergo
>
>
___
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users


Re: [icinga-users] Exclude notifying contacts for specific hostgroups

2016-07-14 Thread Antony Stone
On Thursday 14 July 2016 at 17:07:38, Matt Shields wrote:

> Is there a way to send notifications to all contacts in two groups, but for
> some host groups exclude one of the groups?

I do not believe this is possible.

I think you need to think about inclusion rather than exclusion.

> I have around 1000 hosts divided up into a number of hostgroups (db, app,
> web, etc), I also have two hostgroups for if they are development or
> production.

So, you have two hostgroups - one contains 'production' machines, the other 
contains 'development' machines...

> For the production servers I want all service notifications to go to the
> admins contact group,

So, create a notification definition where notifications go to the admins 
contact 
group, and the criterion for sending them is "membership of the production 
servers group".

assign where "Production" in host.groups

> and for development I want it to go to the admins and developers contact
> groups.

Then create a notification definition where notifications go to everybody (both 
admins and developers) and the criterion for sending them is "membership of 
the development servers group".

assign where "Development" in host.groups

See 4.2.3.4 of 
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/configuring-
icinga2-first-steps and also 3.5.1 of 
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/monitoring-
basics

> I'd rather not setup two separate services (one for prod and one for dev
> servers).

Not sure what you mean by this - are the different machines in two groups 
already or not?


Does that help?


Antony.

-- 
"640 kilobytes (of RAM) should be enough for anybody."

 - Bill Gates

   Please reply to the list;
 please *don't* CC me.
___
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users


Re: [icinga-users] Using check_multi with Icinga2

2016-07-14 Thread Michael Martinez
On Thu, Jul 14, 2016 at 12:48 AM, Michael Friedrich
 wrote:
> var hg_name = “myhostgroup"
> var data = []
> for (h in get_objects(Host)) {
>   if (hg_name in h.groups) {
> data.add(h.name)
>   }
> }

Ok, thanks for the tip.

Now another question: let's say I have an array or dictionary that
contains a list of arbitrary names. I want to create a HostGroup
Object for each name and then assign to hosts. Can Icinga do this at
startup?
___
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users