shinken-solutions / shinken

Flexible and scalable monitoring framework
http://www.shinken-monitoring.org
GNU Affero General Public License v3.0
1.13k stars 336 forks source link

Adding -use properties for discoveryrules #646

Closed 6jo6jo closed 11 years ago

6jo6jo commented 11 years ago

Hi all,

I write a patch to add '-use' feature on discovery rules like this :

define discoveryrule { discoveryrule_name RouterOS creation_type host macvendor routerboard.com openports ^8291$ +use http,router-os -use linux }

diff --git a/shinken/discovery/discoverymanager.py b/shinken/discovery/discoverymanager.py index 1396d3d..9ea9884 100755 --- a/shinken/discovery/discoverymanager.py +++ b/shinken/discovery/discoverymanager.py @@ -32,6 +32,7 @@ import re  import time  import copy  import random +import string  # Always initialize random...  random.seed(time.time())  try: @@ -112,22 +113,52 @@ class DiscoveredHost(object):              d['address'] = self.data['ip']

         self.matched_rules.sort(by_order)

+          for r in self.matched_rules:              for k,v in r.writing_properties.iteritems():

diff --git a/shinken/objects/discoveryrule.py b/shinken/objects/discoveryrule.py index 45624ab..26c63ee 100755 --- a/shinken/objects/discoveryrule.py +++ b/shinken/objects/discoveryrule.py @@ -88,11 +88,12 @@ class Discoveryrule(MatchingItem):          # with a !, it's a not rule)          # -> in self.matches or self.not_matches          # in writing properties if start with + (means 'add this')

6jo6jo commented 11 years ago

Sorry, i'm not sure it's the good way (6 - Open an issue and paste your diff ...)

naparuba commented 11 years ago

Github is not happy with the +, can you send me the patch by mail? I'll integer it :)

6jo6jo commented 11 years ago

Bonsoir (je vie à Noumea GMT +11)

J'ai envoyé le patch sur la liste avec le wikicode pour la doc. Tu préfères peut être le patch en pièce jointe?

Joël

Envoyé de mon iPhone

Le 26 oct. 2012 à 18:37, "Gabès Jean" notifications@github.com a écrit :

Github is not happy with the +, can you send me the patch by mail? I'll integer it :)

— Reply to this email directly or view it on GitHubhttps://github.com/naparuba/shinken/issues/646#issuecomment-9804980.

naparuba commented 11 years ago

Was included. Close.