[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a
Naparuba
naparuba at gmail.com
Tue Feb 28 22:10:28 UTC 2012
The following commit has been merged in the debian/master branch:
commit aa8148401ef70e5a37804ba42bdf8c3a15c6aa62
Author: Naparuba <naparuba at gmail.com>
Date: Thu Dec 29 11:45:18 2011 +0100
Fix : (reported by : twellspring) escalations were not inherited
diff --git a/shinken/objects/config.py b/shinken/objects/config.py
index a45d5e5..d843a1e 100644
--- a/shinken/objects/config.py
+++ b/shinken/objects/config.py
@@ -865,6 +865,11 @@ class Config(Item):
#Also "Serviceextinfo"
self.servicesextinfo.apply_inheritance()
+ # Now escalations too
+ self.serviceescalations.apply_inheritance()
+ self.hostescalations.apply_inheritance()
+ self.escalations.apply_inheritance()
+
#Use to apply implicit inheritance
def apply_implicit_inheritance(self):
@@ -872,7 +877,7 @@ class Config(Item):
self.services.apply_implicit_inheritance(self.hosts)
- #will fill properties for elements so they will have all theirs properties
+ # will fill properties for elements so they will have all theirs properties
def fill_default(self):
#Fill default for config (self)
super(Config, self).fill_default()
@@ -888,6 +893,9 @@ class Config(Item):
self.hostsextinfo.fill_default()
self.servicesextinfo.fill_default()
+ # Now escalations
+ self.escalations.fill_default()
+
#Also fill default of host/servicedep objects
self.servicedependencies.fill_default()
self.hostdependencies.fill_default()
@@ -1191,6 +1199,10 @@ class Config(Item):
self.timeperiods.linkify_templates()
self.hostsextinfo.linkify_templates()
self.servicesextinfo.linkify_templates()
+ self.escalations.linkify_templates()
+ # But also old srv and host escalations
+ self.serviceescalations.linkify_templates()
+ self.hostescalations.linkify_templates()
diff --git a/shinken/objects/escalation.py b/shinken/objects/escalation.py
index 7f00518..5ea9dfe 100644
--- a/shinken/objects/escalation.py
+++ b/shinken/objects/escalation.py
@@ -42,8 +42,8 @@ class Escalation(Item):
'last_notification': IntegerProp(),
'first_notification_time': IntegerProp(),
'last_notification_time': IntegerProp(),
- 'notification_interval': IntegerProp(),
- 'escalation_period': StringProp(default=None),
+ 'notification_interval': IntegerProp('30'), #like Nagios value
+ 'escalation_period': StringProp(default=''),
'escalation_options': ListProp(default='d,u,r,w,c'),
'contacts': StringProp(),
'contact_groups': StringProp(),
diff --git a/shinken/objects/hostescalation.py b/shinken/objects/hostescalation.py
index c85533e..218b78f 100644
--- a/shinken/objects/hostescalation.py
+++ b/shinken/objects/hostescalation.py
@@ -35,7 +35,7 @@ class Hostescalation(Item):
'hostgroup_name': StringProp (),
'first_notification': IntegerProp(),
'last_notification': IntegerProp(),
- 'notification_interval': IntegerProp(),
+ 'notification_interval': IntegerProp(default='30'), # like Nagios value
'escalation_period': StringProp (default=''),
'escalation_options': ListProp (default='d,u,r,w,c'),
'contacts': StringProp (),
diff --git a/shinken/objects/serviceescalation.py b/shinken/objects/serviceescalation.py
index dd95fe1..970188d 100644
--- a/shinken/objects/serviceescalation.py
+++ b/shinken/objects/serviceescalation.py
@@ -37,7 +37,7 @@ class Serviceescalation(Item):
'service_description': StringProp (),
'first_notification': IntegerProp(),
'last_notification': IntegerProp(),
- 'notification_interval': IntegerProp(),
+ 'notification_interval': IntegerProp('30'), #like Nagios value
'escalation_period': StringProp (default=''),
'escalation_options': ListProp (default='d,u,r,w,c'),
'contacts': StringProp (),
diff --git a/test/etc/1r_1h_1s/commands.cfg b/test/etc/bad_escalation_on_groups/commands.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/commands.cfg
copy to test/etc/bad_escalation_on_groups/commands.cfg
diff --git a/test/etc/1r_1h_1s/contacts.cfg b/test/etc/bad_escalation_on_groups/contacts.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/contacts.cfg
copy to test/etc/bad_escalation_on_groups/contacts.cfg
diff --git a/test/etc/1r_1h_1s/hostgroups.cfg b/test/etc/bad_escalation_on_groups/hostgroups.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/hostgroups.cfg
copy to test/etc/bad_escalation_on_groups/hostgroups.cfg
diff --git a/test/etc/check_timeout/hosts.cfg b/test/etc/bad_escalation_on_groups/hosts.cfg
similarity index 97%
copy from test/etc/check_timeout/hosts.cfg
copy to test/etc/bad_escalation_on_groups/hosts.cfg
index eae41e8..f4ed665 100644
--- a/test/etc/check_timeout/hosts.cfg
+++ b/test/etc/bad_escalation_on_groups/hosts.cfg
@@ -42,7 +42,7 @@ define host{
event_handler eventhandler
check_period 24x7
host_name test_host_0
- hostgroups hostgroup_01,up
+ hostgroups hostgroup_01,up,gfx-apache
parents test_router_0
use generic-host
criticity 5
diff --git a/test/etc/1r_1h_1s/servicegroups.cfg b/test/etc/bad_escalation_on_groups/servicegroups.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/servicegroups.cfg
copy to test/etc/bad_escalation_on_groups/servicegroups.cfg
diff --git a/test/etc/critmodulation/services.cfg b/test/etc/bad_escalation_on_groups/services.cfg
similarity index 75%
copy from test/etc/critmodulation/services.cfg
copy to test/etc/bad_escalation_on_groups/services.cfg
index f50a137..0d01d77 100644
--- a/test/etc/critmodulation/services.cfg
+++ b/test/etc/bad_escalation_on_groups/services.cfg
@@ -40,14 +40,23 @@ define service{
notes_url /nagios/wiki/doku.php/$HOSTNAME$/$SERVICEDESC$
action_url /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
_custname custvalue
- business_impact_modulations CritMod
}
+# OUR TEST :
+define serviceescalation{
+ hostgroup_name gfx-apache
+ service_description test_ok_0
+ use gfx1
+ escalation_options w,c,u,r
+ }
-define businessimpactmodulation{
- business_impact_modulation_name CritMod
- business_impact 5
- modulation_period 24x7
+define serviceescalation{
+ name gfx1
+ register 0
+ first_notification 1
+ last_notification 1
+ contact_groups test_contact
+ escalation_options w,c,r
}
\ No newline at end of file
diff --git a/test/etc/1r_1h_1s/shinken-specific.cfg b/test/etc/bad_escalation_on_groups/shinken-specific.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/shinken-specific.cfg
copy to test/etc/bad_escalation_on_groups/shinken-specific.cfg
diff --git a/test/etc/10r_1000h_20000s/timeperiods.cfg b/test/etc/bad_escalation_on_groups/timeperiods.cfg
similarity index 100%
copy from test/etc/10r_1000h_20000s/timeperiods.cfg
copy to test/etc/bad_escalation_on_groups/timeperiods.cfg
diff --git a/test/etc/nagios_1r_1h_1s.cfg b/test/etc/nagios_bad_escalation_on_groups.cfg
similarity index 87%
copy from test/etc/nagios_1r_1h_1s.cfg
copy to test/etc/nagios_bad_escalation_on_groups.cfg
index 1566c73..1d780e7 100644
--- a/test/etc/nagios_1r_1h_1s.cfg
+++ b/test/etc/nagios_bad_escalation_on_groups.cfg
@@ -8,14 +8,14 @@ auto_rescheduling_interval=30
auto_rescheduling_window=180
cached_host_check_horizon=15
cached_service_check_horizon=15
-cfg_file=1r_1h_1s/hosts.cfg
-cfg_file=1r_1h_1s/services.cfg
-cfg_file=1r_1h_1s/contacts.cfg
-cfg_file=1r_1h_1s/commands.cfg
-cfg_file=1r_1h_1s/timeperiods.cfg
-cfg_file=1r_1h_1s/hostgroups.cfg
-cfg_file=1r_1h_1s/servicegroups.cfg
-cfg_file=1r_1h_1s/shinken-specific.cfg
+cfg_file=bad_escalation_on_groups/hosts.cfg
+cfg_file=bad_escalation_on_groups/services.cfg
+cfg_file=bad_escalation_on_groups/contacts.cfg
+cfg_file=bad_escalation_on_groups/commands.cfg
+cfg_file=bad_escalation_on_groups/timeperiods.cfg
+cfg_file=bad_escalation_on_groups/hostgroups.cfg
+cfg_file=bad_escalation_on_groups/servicegroups.cfg
+cfg_file=bad_escalation_on_groups/shinken-specific.cfg
check_external_commands=1
check_for_orphaned_hosts=1
check_for_orphaned_services=1
diff --git a/test/test_dot_virg_in_command.py b/test/test_bad_escalation_on_groups.py
similarity index 85%
copy from test/test_dot_virg_in_command.py
copy to test/test_bad_escalation_on_groups.py
index c931fc3..1158de1 100755
--- a/test/test_dot_virg_in_command.py
+++ b/test/test_bad_escalation_on_groups.py
@@ -26,15 +26,15 @@
from shinken_test import *
-class TestConfig(ShinkenTest):
+class TestBadEscaOnGroups(ShinkenTest):
#Uncomment this is you want to use a specific configuration
#for your test
def setUp(self):
- self.setup_with_file('etc/nagios_dot_virg_in_command.cfg')
+ self.setup_with_file('etc/nagios_bad_escalation_on_groups.cfg')
#Change ME :)
- def test_dummy(self):
+ def test_escalation_inheritance(self):
#
# Config is not correct because of a wrong relative path
# in the main config file
@@ -50,9 +50,12 @@ class TestConfig(ShinkenTest):
svc = self.sched.services.find_srv_by_name_and_hostname("test_host_0", "test_ok_0")
svc.checks_in_progress = []
svc.act_depend_of = [] # no hostchecks on critical checkresults
- print svc.event_handler.args
- self.assert_('sudo -s pkill toto ; cd /my/path && ./toto' in svc.event_handler.args)
+ print svc.escalations
+ self.assert_(len(svc.escalations) > 0)
+ es = svc.escalations.pop()
+ self.assert_(es.is_correct())
+
if __name__ == '__main__':
unittest.main()
--
UNNAMED PROJECT
More information about the Pkg-nagios-changes
mailing list