[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a
Naparuba
naparuba at gmail.com
Tue Feb 28 22:12:49 UTC 2012
The following commit has been merged in the debian/master branch:
commit e6a0a69bd54ec2b1a4bd66ee110fb9fb4e810eb3
Author: Naparuba <naparuba at gmail.com>
Date: Mon Jan 9 17:06:04 2012 +0100
Add : dispatch the discovery rules into the packs.
diff --git a/bin/shinken-discovery b/bin/shinken-discovery
index 736fa64..9d763ab 100755
--- a/bin/shinken-discovery
+++ b/bin/shinken-discovery
@@ -550,8 +550,16 @@ class DiscoveryMerger:
def get_runners_outputs(self):
+ for r in self.allowed_runners():
+ if r.is_finished():
+ print r.discoveryrun_name, r.current_launch
+ if r.current_launch.exit_status != 0:
+ print "Error on run"
self.raw_disco_data = '\n'.join(r.get_output() for r in self.allowed_runners() if r.is_finished())
- print "Got Raw disco data", self.raw_disco_data
+ if len(self.raw_disco_data) != 0:
+ print "Got Raw disco data", self.raw_disco_data
+ else:
+ print "Got no data!"
# Write all configuration we've got
diff --git a/etc/discovery.cfg b/etc/discovery.cfg
index a638fc8..35850e3 100644
--- a/etc/discovery.cfg
+++ b/etc/discovery.cfg
@@ -2,8 +2,13 @@
# Log file of the discovery command
log_file=/tmp/discovery.log
+
# Configuration files with common discovery objects
# like discoveryrules or runners
+cfg_dir=packs
+
+# Default discovery rules and runners. Should be AFTER
+# the packs ones ;)
cfg_file=discovery_rules.cfg
cfg_file=discovery_runs.cfg
diff --git a/etc/discovery_rules.cfg b/etc/discovery_rules.cfg
index a20119e..45b9f59 100644
--- a/etc/discovery_rules.cfg
+++ b/etc/discovery_rules.cfg
@@ -1,29 +1,9 @@
##### Here are some rules for tagging hosts with classic templates
# Classic Network services
-define discoveryrule {
- discoveryrule_name Http
- creation_type host
- openports ^80$
- +use http
-}
define discoveryrule {
- discoveryrule_name Https
- creation_type host
- openports ^443$
- +use https
-}
-
-define discoveryrule {
- discoveryrule_name Ftp
- creation_type host
- openports ^21$
- +use ftp
-}
-
-define discoveryrule {
discoveryrule_name Ssh
creation_type host
openports ^22$
@@ -31,251 +11,6 @@ define discoveryrule {
}
-define discoveryrule {
- discoveryrule_name Dns
- creation_type host
- openports ^53$
- +use dns
-}
-
-
-define discoveryrule {
- discoveryrule_name Smtp
- creation_type host
- openports ^25$
- +use smtp
-}
-
-define discoveryrule {
- discoveryrule_name Smtps
- creation_type host
- openports ^465$
- +use smtps
-}
-
-
-define discoveryrule {
- discoveryrule_name Ldap
- creation_type host
- openports ^389$
- +use ldap
-}
-
-define discoveryrule {
- discoveryrule_name Ldaps
- creation_type host
- openports ^636$
- +use ldaps
-}
-
-define discoveryrule {
- discoveryrule_name HPPrinterState
- creation_type host
- openports 631,9100
- +use printer-hp
-}
-
-define discoveryrule {
- discoveryrule_name Mysql
- creation_type host
- openports ^3306$
- +use mysql
-}
-
-
-define discoveryrule {
- discoveryrule_name Oracle
- creation_type host
- openports ^1521$
- +use oracle
-}
-
-
-
-define discoveryrule {
- discoveryrule_name Mssql
- creation_type host
- openports ^1433$
- +use mssql
-}
-
-
-######### Os part
-
-### Look for a VMWare Host
-define discoveryrule {
- discoveryrule_name ESX
- creation_type host
- isesxhost 1
- +use esx
-}
-
-#### And now look for VMware machines
-
-define discoveryrule {
- discoveryrule_name VMware-VM
- creation_type host
- isesxvm 1
- +use vmware-vm
-}
-
-
-
-#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 2000 tag...
-# Yes, there are still some outside!
-define discoveryrule {
- discoveryrule_name Windows2000
- creation_type host
- os windows
- osversion 2000
- +use windows2000
-}
-
-
-# windows 2003 tag
-define discoveryrule {
- discoveryrule_name Windows2003
- creation_type host
- os windows
- osversion 2003
- +use windows2003
-}
-
-#windows 2008 is return as vista by nmap...
-define discoveryrule {
- discoveryrule_name Windows2008
- creation_type host
- os windows
- osversion vista
- +use windows2008
-}
-
-
-#windows 2008 is return as vista by nmap...
-define discoveryrule {
- discoveryrule_name Windows2008r2
- creation_type host
- os windows
- osversion 7
- +use windows2008,windows2008r2
-}
-
-
-# HPUX part
-define discoveryrule {
- discoveryrule_name HpUx
- creation_type host
- os hp-ux
- +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
-}
-
-
-
-# Network Equipements Now
-
-# Generic tags
-# Switch
-define discoveryrule {
- discoveryrule_name Switch
- creation_type host
- ostype switch
- +use switch
-}
-
-
-# Generic router
-define discoveryrule {
- discoveryrule_name Router
- creation_type host
- ostype router
- +use router
-}
-
-
-# Fortinate firewalls
-define discoveryrule {
- discoveryrule_name Fortinet
- creation_type host
- macvendor fortinet
- +use fortinet
-}
-
-# Cisco equipements
-define discoveryrule {
- discoveryrule_name Cisco
- creation_type host
- osvendor cisco
- +use cisco
-}
-
-# Nortel equipements
-define discoveryrule {
- discoveryrule_name Nortel
- creation_type host
- osvendor nortel
- +use nortel
-}
-
-
-# Procurve
-define discoveryrule {
- discoveryrule_name Procurve
- creation_type host
- ostype switch
- osvendor hp
- +use procurve
-}
-
-
-
-
-# HP Stuff
-# Blade check
-define discoveryrule {
- discoveryrule_name HPBladeChassis
- creation_type host
- os embedded
- ostype remote management
- osvendor hp
- +use hp-blade-chassis
-}
-
-# Hp server check with hpasm
-define discoveryrule {
- discoveryrule_name HPAsm
- creation_type host
- macvendor hewlett packard
- # HPASM server port
- openports ^2301$
- +use hp-asm
-}
diff --git a/etc/packs/databases/mssql/discovery.cfg b/etc/packs/databases/mssql/discovery.cfg
new file mode 100644
index 0000000..c697651
--- /dev/null
+++ b/etc/packs/databases/mssql/discovery.cfg
@@ -0,0 +1,6 @@
+define discoveryrule {
+ discoveryrule_name Mssql
+ creation_type host
+ openports ^1433$
+ +use mssql
+}
diff --git a/etc/packs/databases/mysql/discovery.cfg b/etc/packs/databases/mysql/discovery.cfg
new file mode 100644
index 0000000..8320925
--- /dev/null
+++ b/etc/packs/databases/mysql/discovery.cfg
@@ -0,0 +1,6 @@
+define discoveryrule {
+ discoveryrule_name Mysql
+ creation_type host
+ openports ^3306$
+ +use mysql
+}
diff --git a/etc/packs/databases/oracle/discovery.cfg b/etc/packs/databases/oracle/discovery.cfg
new file mode 100644
index 0000000..f8e6e6c
--- /dev/null
+++ b/etc/packs/databases/oracle/discovery.cfg
@@ -0,0 +1,6 @@
+define discoveryrule {
+ discoveryrule_name Oracle
+ creation_type host
+ openports ^1521$
+ +use oracle
+}
diff --git a/etc/packs/microsoft/exchange/exchange-ht/db_activity.cfg b/etc/packs/microsoft/exchange/exchange-ht/db_activity.cfg
index 9eda5cf..03c6248 100644
--- a/etc/packs/microsoft/exchange/exchange-ht/db_activity.cfg
+++ b/etc/packs/microsoft/exchange/exchange-ht/db_activity.cfg
@@ -1,5 +1,5 @@
define service{
- service_description HubTransportQueues
+ service_description DatabaseActivity
use generic-service
register 0
host_name exchange-ht
diff --git a/etc/packs/microsoft/windows/discovery.cfg b/etc/packs/microsoft/windows/discovery.cfg
new file mode 100644
index 0000000..f29ee50
--- /dev/null
+++ b/etc/packs/microsoft/windows/discovery.cfg
@@ -0,0 +1,46 @@
+# Now the windows part
+define discoveryrule {
+ discoveryrule_name Windows
+ creation_type host
+ os windows
+ +use windows
+}
+
+# windows 2000 tag...
+# Yes, there are still some outside!
+define discoveryrule {
+ discoveryrule_name Windows2000
+ creation_type host
+ os windows
+ osversion 2000
+ +use windows2000
+}
+
+
+# windows 2003 tag
+define discoveryrule {
+ discoveryrule_name Windows2003
+ creation_type host
+ os windows
+ osversion 2003
+ +use windows2003
+}
+
+#windows 2008 is return as vista by nmap...
+define discoveryrule {
+ discoveryrule_name Windows2008
+ creation_type host
+ os windows
+ osversion vista
+ +use windows2008
+}
+
+
+#windows 2008 is return as vista by nmap...
+define discoveryrule {
+ discoveryrule_name Windows2008r2
+ creation_type host
+ os windows
+ osversion 7
+ +use windows2008,windows2008r2
+}
diff --git a/etc/packs/microsoft/windows/each_cpu.cfg b/etc/packs/microsoft/windows/each_cpu.cfg
index cf34004..7bf180b 100644
--- a/etc/packs/microsoft/windows/each_cpu.cfg
+++ b/etc/packs/microsoft/windows/each_cpu.cfg
@@ -1,5 +1,5 @@
define service{
- service_description Cpu
+ service_description EachCpu
use generic-service
register 0
host_name windows
diff --git a/etc/packs/network/cisco/discovery.cfg b/etc/packs/network/cisco/discovery.cfg
new file mode 100644
index 0000000..b914d0c
--- /dev/null
+++ b/etc/packs/network/cisco/discovery.cfg
@@ -0,0 +1,7 @@
+# Cisco equipements
+define discoveryrule {
+ discoveryrule_name Cisco
+ creation_type host
+ osvendor cisco
+ +use cisco
+}
diff --git a/etc/packs/network/fortinet/discovery.cfg b/etc/packs/network/fortinet/discovery.cfg
new file mode 100644
index 0000000..0bb8514
--- /dev/null
+++ b/etc/packs/network/fortinet/discovery.cfg
@@ -0,0 +1,7 @@
+# Fortinate firewalls
+define discoveryrule {
+ discoveryrule_name Fortinet
+ creation_type host
+ macvendor fortinet
+ +use fortinet
+}
diff --git a/etc/packs/network/nortel/discovery.cfg b/etc/packs/network/nortel/discovery.cfg
new file mode 100644
index 0000000..8b7f303
--- /dev/null
+++ b/etc/packs/network/nortel/discovery.cfg
@@ -0,0 +1,7 @@
+# Nortel equipements
+define discoveryrule {
+ discoveryrule_name Nortel
+ creation_type host
+ osvendor nortel
+ +use nortel
+}
diff --git a/etc/packs/network/procurve/discovery.cfg b/etc/packs/network/procurve/discovery.cfg
new file mode 100644
index 0000000..ee899f9
--- /dev/null
+++ b/etc/packs/network/procurve/discovery.cfg
@@ -0,0 +1,8 @@
+# Procurve
+define discoveryrule {
+ discoveryrule_name Procurve
+ creation_type host
+ ostype switch
+ osvendor hp
+ +use procurve
+}
diff --git a/etc/packs/network/router/discovery.cfg b/etc/packs/network/router/discovery.cfg
new file mode 100644
index 0000000..f0b470b
--- /dev/null
+++ b/etc/packs/network/router/discovery.cfg
@@ -0,0 +1,7 @@
+# Generic router
+define discoveryrule {
+ discoveryrule_name Router
+ creation_type host
+ ostype router
+ +use router
+}
diff --git a/etc/packs/network/services/dns/discovery.cfg b/etc/packs/network/services/dns/discovery.cfg
new file mode 100644
index 0000000..fbcc500
--- /dev/null
+++ b/etc/packs/network/services/dns/discovery.cfg
@@ -0,0 +1,6 @@
+define discoveryrule {
+ discoveryrule_name Dns
+ creation_type host
+ openports ^53$
+ +use dns
+}
diff --git a/etc/packs/network/services/ftp/discovery.cfg b/etc/packs/network/services/ftp/discovery.cfg
new file mode 100644
index 0000000..13b8d00
--- /dev/null
+++ b/etc/packs/network/services/ftp/discovery.cfg
@@ -0,0 +1,7 @@
+
+define discoveryrule {
+ discoveryrule_name Ftp
+ creation_type host
+ openports ^21$
+ +use ftp
+}
diff --git a/etc/packs/network/services/http/discovery.cfg b/etc/packs/network/services/http/discovery.cfg
new file mode 100644
index 0000000..269b3db
--- /dev/null
+++ b/etc/packs/network/services/http/discovery.cfg
@@ -0,0 +1,7 @@
+# The discovery rule for tagging http
+define discoveryrule {
+ discoveryrule_name Http
+ creation_type host
+ openports ^80$
+ +use http
+}
diff --git a/etc/packs/network/services/https/discovery.cfg b/etc/packs/network/services/https/discovery.cfg
new file mode 100644
index 0000000..bc72897
--- /dev/null
+++ b/etc/packs/network/services/https/discovery.cfg
@@ -0,0 +1,7 @@
+
+define discoveryrule {
+ discoveryrule_name Https
+ creation_type host
+ openports ^443$
+ +use https
+}
diff --git a/etc/packs/network/services/ldap/discovery.cfg b/etc/packs/network/services/ldap/discovery.cfg
new file mode 100644
index 0000000..9372867
--- /dev/null
+++ b/etc/packs/network/services/ldap/discovery.cfg
@@ -0,0 +1,6 @@
+define discoveryrule {
+ discoveryrule_name Ldap
+ creation_type host
+ openports ^389$
+ +use ldap
+}
diff --git a/etc/packs/network/services/ldaps/discovery.cfg b/etc/packs/network/services/ldaps/discovery.cfg
new file mode 100644
index 0000000..784a3b9
--- /dev/null
+++ b/etc/packs/network/services/ldaps/discovery.cfg
@@ -0,0 +1,6 @@
+define discoveryrule {
+ discoveryrule_name Ldaps
+ creation_type host
+ openports ^636$
+ +use ldaps
+}
diff --git a/etc/packs/network/services/smtp/discovery.cfg b/etc/packs/network/services/smtp/discovery.cfg
new file mode 100644
index 0000000..f4aef89
--- /dev/null
+++ b/etc/packs/network/services/smtp/discovery.cfg
@@ -0,0 +1,6 @@
+define discoveryrule {
+ discoveryrule_name Smtp
+ creation_type host
+ openports ^25$
+ +use smtp
+}
diff --git a/etc/packs/network/services/smtps/discovery.cfg b/etc/packs/network/services/smtps/discovery.cfg
new file mode 100644
index 0000000..bbe8325
--- /dev/null
+++ b/etc/packs/network/services/smtps/discovery.cfg
@@ -0,0 +1,6 @@
+define discoveryrule {
+ discoveryrule_name Smtps
+ creation_type host
+ openports ^465$
+ +use smtps
+}
diff --git a/etc/packs/network/switch/discovery.cfg b/etc/packs/network/switch/discovery.cfg
new file mode 100644
index 0000000..7555823
--- /dev/null
+++ b/etc/packs/network/switch/discovery.cfg
@@ -0,0 +1,9 @@
+# Generic tags
+# Switch
+define discoveryrule {
+ discoveryrule_name Switch
+ creation_type host
+ ostype switch
+ +use switch
+}
+
diff --git a/etc/packs/os/hpux/discovery.cfg b/etc/packs/os/hpux/discovery.cfg
new file mode 100644
index 0000000..d853a50
--- /dev/null
+++ b/etc/packs/os/hpux/discovery.cfg
@@ -0,0 +1,6 @@
+define discoveryrule {
+ discoveryrule_name HpUx
+ creation_type host
+ os hp-ux
+ +use hpux
+}
diff --git a/etc/packs/os/linux/discovery.cfg b/etc/packs/os/linux/discovery.cfg
new file mode 100644
index 0000000..7413886
--- /dev/null
+++ b/etc/packs/os/linux/discovery.cfg
@@ -0,0 +1,7 @@
+#os is returned by the nmap discovery script
+define discoveryrule {
+ discoveryrule_name Linux
+ creation_type host
+ os linux
+ +use linux
+}
diff --git a/etc/packs/printers/hp/discovery.cfg b/etc/packs/printers/hp/discovery.cfg
new file mode 100644
index 0000000..b6f5558
--- /dev/null
+++ b/etc/packs/printers/hp/discovery.cfg
@@ -0,0 +1,6 @@
+define discoveryrule {
+ discoveryrule_name HPPrinterState
+ creation_type host
+ openports 631,9100
+ +use printer-hp
+}
diff --git a/etc/packs/servers/hp/hp-asm/discovery.cfg b/etc/packs/servers/hp/hp-asm/discovery.cfg
new file mode 100644
index 0000000..4cf5af7
--- /dev/null
+++ b/etc/packs/servers/hp/hp-asm/discovery.cfg
@@ -0,0 +1,9 @@
+# Hp server check with hpasm
+define discoveryrule {
+ discoveryrule_name HPAsm
+ creation_type host
+ macvendor hewlett packard
+ # HPASM server port
+ openports ^2301$
+ +use hp-asm
+}
diff --git a/etc/packs/servers/hp/hp-blade-chassis/discovery.cfg b/etc/packs/servers/hp/hp-blade-chassis/discovery.cfg
new file mode 100644
index 0000000..e2a8bfd
--- /dev/null
+++ b/etc/packs/servers/hp/hp-blade-chassis/discovery.cfg
@@ -0,0 +1,9 @@
+# Blade check
+define discoveryrule {
+ discoveryrule_name HPBladeChassis
+ creation_type host
+ os embedded
+ ostype remote management
+ osvendor hp
+ +use hp-blade-chassis
+}
diff --git a/etc/packs/storage/emc/discovery.cfg b/etc/packs/storage/emc/discovery.cfg
new file mode 100644
index 0000000..5e3ecfb
--- /dev/null
+++ b/etc/packs/storage/emc/discovery.cfg
@@ -0,0 +1,7 @@
+# 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/etc/packs/vmware/esx/discovery.cfg b/etc/packs/vmware/esx/discovery.cfg
new file mode 100644
index 0000000..e13c2df
--- /dev/null
+++ b/etc/packs/vmware/esx/discovery.cfg
@@ -0,0 +1,7 @@
+### Look for a VMWare Host
+define discoveryrule {
+ discoveryrule_name ESX
+ creation_type host
+ isesxhost 1
+ +use esx
+}
diff --git a/etc/packs/vmware/vm/discovery.cfg b/etc/packs/vmware/vm/discovery.cfg
new file mode 100644
index 0000000..1353384
--- /dev/null
+++ b/etc/packs/vmware/vm/discovery.cfg
@@ -0,0 +1,8 @@
+#### And now look for VMware machines
+
+define discoveryrule {
+ discoveryrule_name VMware-VM
+ creation_type host
+ isesxvm 1
+ +use vmware-vm
+}
diff --git a/libexec/nmap_discovery_runner.py b/libexec/nmap_discovery_runner.py
index c86d055..6048dce 100755
--- a/libexec/nmap_discovery_runner.py
+++ b/libexec/nmap_discovery_runner.py
@@ -51,7 +51,6 @@ opts, args = parser.parse_args()
if not opts.simulate:
simulate = None
- targets = ''
else:
simulate = opts.simulate
diff --git a/shinken/objects/discoveryrun.py b/shinken/objects/discoveryrun.py
index 3be652e..628356d 100644
--- a/shinken/objects/discoveryrun.py
+++ b/shinken/objects/discoveryrun.py
@@ -73,6 +73,8 @@ class Discoveryrun(Item):
def get_output(self):
return '\n'.join([self.current_launch.output, self.current_launch.long_output])
+
+
class Discoveryruns(Items):
name_property = "discoveryrun_name"
--
UNNAMED PROJECT
More information about the Pkg-nagios-changes
mailing list