[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a
Naparuba
naparuba at gmail.com
Tue Feb 28 22:12:03 UTC 2012
The following commit has been merged in the debian/master branch:
commit 0e3ae3705eab6d18e05641aa7f8bbc0c728e5617
Author: Naparuba <naparuba at gmail.com>
Date: Thu Jan 5 14:28:11 2012 +0100
Add : do not have a template is no more a critical error, jsut a warning. So the user can just 'tag' hosts without fearing to manage conf first. this can be done after.
diff --git a/etc/discovery_rules.cfg b/etc/discovery_rules.cfg
index 9633890..42c06e7 100644
--- a/etc/discovery_rules.cfg
+++ b/etc/discovery_rules.cfg
@@ -1,5 +1,6 @@
##### Here are some rules for tagging hosts with classic templates
+# Classic Network services
define discoveryrule {
discoveryrule_name Http
creation_type host
@@ -99,7 +100,7 @@ define discoveryrule {
}
-
+######### Os part
### Look for a VMWare Host
define discoveryrule {
@@ -120,7 +121,59 @@ define discoveryrule {
+#os is returned by the nmap discovery script
+define discoveryrule {
+ discoveryrule_name Linux
+ creation_type host
+ os linux
+ +use linux
+}
+
+# Now the windows part
+define discoveryrule {
+ discoveryrule_name Windows
+ creation_type host
+ os windows
+ +use windows
+}
+
+# windows 2003 tag
+define discoveryrule {
+ discoveryrule_name Windows
+ creation_type host
+ os windows
+ osversion 2003
+ +use windows2003
+}
+#windows 2008 is return as 7 by nmap...
+define discoveryrule {
+ discoveryrule_name Windows
+ creation_type host
+ os windows
+ osversion 7
+ +use windows2008
+}
+
+
+# HPUX part
+define discoveryrule {
+ discoveryrule_name Windows
+ creation_type host
+ os hpux
+ +use hpux
+}
+
+
+
+
+# EMC clariion device open the 6389 ports by default
+define discoveryrule {
+ discoveryrule_name EMC-Clariion
+ creation_type host
+ openports ^6389$
+ +use emc,emc-clariion
+}
diff --git a/shinken/objects/host.py b/shinken/objects/host.py
index 4baa626..5727c2e 100644
--- a/shinken/objects/host.py
+++ b/shinken/objects/host.py
@@ -376,6 +376,11 @@ class Host(SchedulingItem):
logger.log("%s : I do not have %s" % (self.get_name(), prop))
state = False #Bad boy...
+ # Then look if we have some errors in the conf
+ # Juts print warnings, but raise errors
+ for err in self.configuration_warnings:
+ print err
+
# Raised all previously saw errors like unknown contacts and co
if self.configuration_errors != []:
state = False
diff --git a/shinken/objects/item.py b/shinken/objects/item.py
index f90dd2e..69643cd 100644
--- a/shinken/objects/item.py
+++ b/shinken/objects/item.py
@@ -681,8 +681,8 @@ class Items(object):
# add the template object to us
new_tpls.append(t)
else: # not find? not good!
- err = "ERROR: the template '%s' defined for '%s' is unknown" % (tpl, i.get_name())
- i.configuration_errors.append(err)
+ err = "WARNING: the template '%s' defined for '%s' is unknown" % (tpl, i.get_name())
+ i.configuration_warnings.append(err)
i.templates = new_tpls
# Now we will create the template graph, so
diff --git a/shinken/objects/service.py b/shinken/objects/service.py
index 1bb70b7..8562c1a 100644
--- a/shinken/objects/service.py
+++ b/shinken/objects/service.py
@@ -363,6 +363,11 @@ class Service(SchedulingItem):
logger.log("Error : the service %s on host '%s' do not have %s" % (desc, hname, prop))
state = False # Bad boy...
+ # Then look if we have some errors in the conf
+ # Juts print warnings, but raise errors
+ for err in self.configuration_warnings:
+ print err
+
# Raised all previously saw errors like unknown contacts and co
if self.configuration_errors != []:
state = False
diff --git a/test/etc/nagios_1r_1h_1s.cfg b/test/etc/nagios_no_host_template.cfg
similarity index 89%
copy from test/etc/nagios_1r_1h_1s.cfg
copy to test/etc/nagios_no_host_template.cfg
index 1566c73..049260d 100644
--- a/test/etc/nagios_1r_1h_1s.cfg
+++ b/test/etc/nagios_no_host_template.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=no_host_template/hosts.cfg
+cfg_file=no_host_template/services.cfg
+cfg_file=no_host_template/contacts.cfg
+cfg_file=no_host_template/commands.cfg
+cfg_file=no_host_template/timeperiods.cfg
+cfg_file=no_host_template/hostgroups.cfg
+cfg_file=no_host_template/servicegroups.cfg
+cfg_file=no_host_template/shinken-specific.cfg
check_external_commands=1
check_for_orphaned_hosts=1
check_for_orphaned_services=1
diff --git a/test/etc/1r_1h_1s/commands.cfg b/test/etc/no_host_template/commands.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/commands.cfg
copy to test/etc/no_host_template/commands.cfg
diff --git a/test/etc/1r_1h_1s/contacts.cfg b/test/etc/no_host_template/contacts.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/contacts.cfg
copy to test/etc/no_host_template/contacts.cfg
diff --git a/test/etc/1r_1h_1s/hostgroups.cfg b/test/etc/no_host_template/hostgroups.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/hostgroups.cfg
copy to test/etc/no_host_template/hostgroups.cfg
diff --git a/test/etc/bad_notification_character/hosts.cfg b/test/etc/no_host_template/hosts.cfg
similarity index 88%
copy from test/etc/bad_notification_character/hosts.cfg
copy to test/etc/no_host_template/hosts.cfg
index eae41e8..85c530c 100644
--- a/test/etc/bad_notification_character/hosts.cfg
+++ b/test/etc/no_host_template/hosts.cfg
@@ -50,3 +50,12 @@ define host{
_oslicense gpl
}
+
+
+
+define host{
+ address 127.0.0.1
+ check_command check-host-alive-parent!up!$HOSTSTATE:test_router_0$
+ host_name my_host
+ use generic-host,missing-template
+}
\ No newline at end of file
diff --git a/test/etc/1r_1h_1s/servicegroups.cfg b/test/etc/no_host_template/servicegroups.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/servicegroups.cfg
copy to test/etc/no_host_template/servicegroups.cfg
diff --git a/test/etc/1r_1h_1s/services.cfg b/test/etc/no_host_template/services.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/services.cfg
copy to test/etc/no_host_template/services.cfg
diff --git a/test/etc/1r_1h_1s/shinken-specific.cfg b/test/etc/no_host_template/shinken-specific.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/shinken-specific.cfg
copy to test/etc/no_host_template/shinken-specific.cfg
diff --git a/test/etc/10r_1000h_20000s/timeperiods.cfg b/test/etc/no_host_template/timeperiods.cfg
similarity index 100%
copy from test/etc/10r_1000h_20000s/timeperiods.cfg
copy to test/etc/no_host_template/timeperiods.cfg
diff --git a/test/jenkins/longtests.txt b/test/jenkins/longtests.txt
index ebee545..bc85ba8 100644
--- a/test/jenkins/longtests.txt
+++ b/test/jenkins/longtests.txt
@@ -87,6 +87,7 @@ test_inheritance_and_plus.py
test_module_ip_tag.py
test_dot_virg_in_command.py
test_bad_escalation_on_groups.py
+test_no_host_template.py
test_parse_perfdata.py
# takes long
diff --git a/test/jenkins/shorttests.txt b/test/jenkins/shorttests.txt
index 6026665..6e95840 100644
--- a/test/jenkins/shorttests.txt
+++ b/test/jenkins/shorttests.txt
@@ -94,4 +94,5 @@ test_inheritance_and_plus.py
test_module_ip_tag.py
test_dot_virg_in_command.py
test_bad_escalation_on_groups.py
+test_no_host_template.py
test_parse_perfdata.py
diff --git a/test/quick_tests.sh b/test/quick_tests.sh
index c4d5abe..58c2912 100755
--- a/test/quick_tests.sh
+++ b/test/quick_tests.sh
@@ -132,6 +132,7 @@ launch_and_assert test_service_template_inheritance.py
launch_and_assert test_module_ip_tag.py
launch_and_assert test_dot_virg_in_command.py
launch_and_assert test_bad_escalation_on_groups.py
+launch_and_assert test_no_host_template.py
launch_and_assert test_maintenance_period.py
#Live status is a bit longer than the previous, so we put it at the end.
diff --git a/test/test_bad_timeperiods.py b/test/test_no_host_template.py
similarity index 73%
copy from test/test_bad_timeperiods.py
copy to test/test_no_host_template.py
index d919194..c902d7b 100755
--- a/test/test_bad_timeperiods.py
+++ b/test/test_no_host_template.py
@@ -26,21 +26,24 @@
from shinken_test import *
-class TestConfig(ShinkenTest):
- #setUp is in shinken_test
+class TestNoHostTemplate(ShinkenTest):
+ #Uncomment this is you want to use a specific configuration
+ #for your test
def setUp(self):
- self.setup_with_file('etc/nagios_bad_timeperiods.cfg')
-
+ self.setup_with_file('etc/nagios_no_host_template.cfg')
+
#Change ME :)
- def test_dummy(self):
+ def test_host_without_a_template(self):
#
# Config is not correct because of a wrong relative path
# in the main config file
#
- print "Get the bad timeperiod"
- tp = self.sched.timeperiods.find_by_name("24x7")
- self.assert_(tp.is_correct() == False)
+ print "Get the hosts and services"
+ now = time.time()
+ host = self.sched.hosts.find_by_name("my_host")
+ b = host.is_correct()
+ self.assert_(b)
if __name__ == '__main__':
--
UNNAMED PROJECT
More information about the Pkg-nagios-changes
mailing list