shinken-solutions / shinken

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

Attempt to make hot services dependencies #1018

Open claneys opened 10 years ago

claneys commented 10 years ago

I try to introduce dependencies into configuration packs. The idea is to have a service dependencies config file into each pack that will be read by a hot-dependencies script then processed by hot-dependencies module.

The script just make association and wrote a json file. To do so, it will communicate with the arbiter asking it a hosts list with their use flags to know which service dependencies read and apply for each of them.

The difficulty now is to retrieve list of parents hosts of hosts since we can have services relies on services on others hosts.

act_depend_of and act_depend_of_me aren't available at runtime to read them, so I try to figure it out how to retrieve this list or any other way to do so.

naparuba commented 10 years ago

No available? strange. Look at parent_dependencies and child_dependencies properties, should be easier to parse :)

On Wed, Oct 23, 2013 at 8:57 AM, Forlot Romain notifications@github.comwrote:

I try to introduce dependencies into configuration packs. The idea is to have a service dependencies config file into each pack that will be read by a hot-dependencies script then processed by hot-dependencies module.

The script just make association and wrote a json file. To do so, it will communicate with the arbiter asking it a hosts list with their use flags to know which service dependencies read and apply for each of them.

The difficulty now is to retrieve list of parents hosts of hosts since we can have services relies on services on others hosts.

act_depend_of and act_depend_of_me aren't available at runtime to read them, so I try to figure it out how to retrieve this list or any other way to do so.

— Reply to this email directly or view it on GitHubhttps://github.com/naparuba/shinken/issues/1018 .

claneys commented 10 years ago

Not available neither, here are available properties ( host.properties ) :

{'statusmap_image': <shinken.property.StringProp object at 0x1226810>, 'business_impact_modulations': <shinken.property.StringProp object at 0x1226a10>, 'retry_interval': <shinken.property.IntegerProp object at 0x1226050>, 'action_url': <shinken.property.StringProp object at 0x12266d0>, 'escalations': <shinken.property.StringProp object at 0x1226a50>, 'low_flap_threshold': <shinken.property.IntegerProp object at 0x1226290>, 'process_perf_data': <shinken.property.BoolProp object at 0x1226390>, 'icon_image': <shinken.property.StringProp object at 0x1226710>, 'check_period': <shinken.property.StringProp object at 0x1226110>, 'use': <shinken.property.ListProp object at 0x11188d0>, 'display_name': <shinken.property.StringProp object at 0x121ce10>, 'notification_interval': <shinken.property.IntegerProp object at 0x12264d0>, 'failure_prediction_enabled': <shinken.property.BoolProp object at 0x12268d0>, 'flap_detection_options': <shinken.property.ListProp object at 0x1226350>, 'event_handler_enabled': <shinken.property.BoolProp object at 0x1226250>, 'trigger': <shinken.property.StringProp object at 0x1226c50>, 'parents': <shinken.property.ListProp object at 0x121ce90>, 'initial_state': <shinken.property.CharProp object at 0x121cf50>, 'first_notification_delay': <shinken.property.IntegerProp object at 0x1226510>, 'notification_options': <shinken.property.ListProp object at 0x1226590>, 'host_name': <shinken.property.StringProp object at 0x121cd50>, 'notifications_enabled': <shinken.property.BoolProp object at 0x12265d0>, 'event_handler': <shinken.property.StringProp object at 0x1226210>, 'obsess_over_host': <shinken.property.BoolProp object at 0x1226150>, 'freshness_threshold': <shinken.property.IntegerProp object at 0x12261d0>, 'alias': <shinken.property.StringProp object at 0x121cdd0>, 'imported_from': <shinken.property.StringProp object at 0x1118850>, 'time_to_orphanage': <shinken.property.IntegerProp object at 0x1226ad0>, 'name': <shinken.property.StringProp object at 0x1118910>, 'custom_views': <shinken.property.ListProp object at 0x1226d90>, 'check_command': <shinken.property.StringProp object at 0x121cf10>, 'passive_checks_enabled': <shinken.property.BoolProp object at 0x12260d0>, 'check_interval': <shinken.property.IntegerProp object at 0x121cfd0>, 'notes': <shinken.property.StringProp object at 0x1226650>, 'check_freshness': <shinken.property.BoolProp object at 0x1226190>, 'active_checks_enabled': <shinken.property.BoolProp object at 0x1226090>, 'icon_image_alt': <shinken.property.StringProp object at 0x1226750>, 'hostgroups': <shinken.property.StringProp object at 0x121ced0>, 'reactionner_tag': <shinken.property.StringProp object at 0x1226990>, 'notes_url': <shinken.property.StringProp object at 0x1226690>, 'service_overrides': <shinken.property.ListProp object at 0x1226b10>, 'maintenance_period': <shinken.property.StringProp object at 0x1226a90>, 'realm': <shinken.property.StringProp object at 0x1226910>, 'contacts': <shinken.property.StringProp object at 0x1226450>, 'notification_period': <shinken.property.StringProp object at 0x1226550>, 'trending_policies': <shinken.property.ListProp object at 0x1226cd0>, 'resultmodulations': <shinken.property.StringProp object at 0x12269d0>, 'retain_status_information': <shinken.property.BoolProp object at 0x12263d0>, 'business_rule_downtime_as_ack': <shinken.property.BoolProp object at 0x1226bd0>, 'stalking_options': <shinken.property.ListProp object at 0x1226610>, 'flap_detection_enabled': <shinken.property.BoolProp object at 0x1226310>, 'high_flap_threshold': <shinken.property.IntegerProp object at 0x12262d0>, 'macromodulations': <shinken.property.ListProp object at 0x1226d50>, 'retain_nonstatus_information': <shinken.property.BoolProp object at 0x1226410>, 'contact_groups': <shinken.property.StringProp object at 0x1226490>, 'business_rule_smart_notifications': <shinken.property.BoolProp object at 0x1226b90>, 'address': <shinken.property.StringProp object at 0x121ce50>, 'trigger_name': <shinken.property.ListProp object at 0x1226c90>, 'vrml_image': <shinken.property.StringProp object at 0x12267d0>, '3d_coords': <shinken.property.StringProp object at 0x1226890>, '2d_coords': <shinken.property.StringProp object at 0x1226850>, 'checkmodulations': <shinken.property.ListProp object at 0x1226d10>, 'poller_tag': <shinken.property.StringProp object at 0x1226950>, 'icon_set': <shinken.property.StringProp object at 0x1226790>, 'business_impact': <shinken.property.IntegerProp object at 0x1226c10>, 'max_check_attempts': <shinken.property.IntegerProp object at 0x121cf90>, 'business_rule_output_template': <shinken.property.StringProp object at 0x1226b50>}
naparuba commented 10 years ago

But why running properties should not be available? They are more valuable to query than properties one :)

On Wed, Oct 23, 2013 at 12:01 PM, Forlot Romain notifications@github.comwrote:

Not available neither, here are available properties ( host.properties ) :

{'statusmap_image': <shinken.property.StringProp object at 0x1226810>, 'business_impact_modulations': <shinken.property.StringProp object at 0x1226a10>, 'retry_interval': <shinken.property.IntegerProp object at 0x1226050>, 'action_url': <shinken.property.StringProp object at 0x12266d0>, 'escalations': <shinken.property.StringProp object at 0x1226a50>, 'low_flap_threshold': <shinken.property.IntegerProp object at 0x1226290>, 'process_perf_data': <shinken.property.BoolProp object at 0x1226390>, 'icon_image': <shinken.property.StringProp object at 0x1226710>, 'check_period': <shinken.property.StringProp object at 0x1226110>, 'use': <shinken.property.ListProp object at 0x11188d0>, 'display_name': <shinken.property.StringProp object at 0x121ce10>, 'notification_interval': <shinken.property.IntegerProp object at 0x12264d0>, 'failure_prediction_enabled': <shinken.property.BoolProp object at 0x12268d0>, 'flap_detection_options': <shinken.property.ListProp object at 0x1226350>, 'event_handler_enabled': <shinken.property.BoolProp object at 0x1226250>, 'trigger': <shinken.property.StringProp object at 0x1226c50>, 'parents': <shinken.property.ListProp object at 0x121ce90>, 'initial_state': <shinken.property.CharProp object at 0x121cf50>, 'first_notification_delay': <shinken.property.IntegerProp object at 0x1226510>, 'notification_options': <shinken.property.ListProp object at 0x1226590>, 'host_name': <shinken.property.StringProp object at 0x121cd50>, 'notifications_enabled': <shinken.property.BoolProp object at 0x12265d0>, 'event_handler': <shinken.property.StringProp object at 0x1226210>, 'obsess_over_host': <shinken.property.BoolProp object at 0x1226150>, 'freshness_threshold': <shinken.property.IntegerProp object at 0x12261d0>, 'alias': <shinken.property.StringProp object at 0x121cdd0>, 'imported_from': &l t;shinken.property.StringProp object at 0x1118850>, 'time_to_orphanage': <shinken.property.IntegerProp object at 0x1226ad0>, 'name': <shinken.property.StringProp object at 0x1118910>, 'custom_views': <shinken.property.ListProp object at 0x1226d90>, 'check_command': <shinken.property.StringProp object at 0x121cf10>, 'passive_checks_enabled': <shinken.property.BoolProp object at 0x12260d0>, 'check_interval': <shinken.property.IntegerProp object at 0x121cfd0>, 'notes': <shinken.property.StringProp object at 0x1226650>, 'check_freshness': <shinken.property.BoolProp object at 0x1226190>, 'active_checks_enabled': <shinken.property.BoolProp object at 0x1226090>, 'icon_image_alt': <shinken.property.StringProp object at 0x1226750>, 'hostgroups': <shinken.property.StringProp object at 0x121ced0>, 'reactionner_tag': <shinken.property.StringProp object at 0x1226990>, 'notes_url': <shinken.property.StringProp object at 0x1226690>, 'service_overrides': <shinken.property.ListProp object at 0x1226b10>, 'maintenance_period': <shinken.property.StringProp object at 0x1226a90>, 'realm': <shinken.property.StringProp object at 0x1226910>, 'contacts': <shinken.property.StringProp object at 0x1226450>, 'notification_period': <shinken.property.StringProp object at 0x1226550>, 'trending_policies': <shinken.property.ListProp object at 0x1226cd0>, 'resultmodulations': <shinken.property.StringProp object at 0x12269d0>, 'retain_status_information': <shinken.property.BoolProp object at 0x12263d0>, 'business_rule_downtime_as_ack': <shinken.property.BoolProp object at 0x1226bd0>, 'stalking_options': <shinken.property.ListProp object at 0x1226610>, 'flap_detection_enabled': <shinken.property.BoolProp object at 0x1226310>, 'high_flap_threshold': <shinken.property.IntegerProp object at 0x12262d0>, 'macromodulations': <shinken.property.ListPro p object at 0x1226d50>, 'retain_nonstatus_information': <shinken.property.BoolProp object at 0x1226410>, 'contact_groups': <shinken.property.StringProp object at 0x1226490>, 'business_rule_smart_notifications': <shinken.property.BoolProp object at 0x1226b90>, 'address': <shinken.property.StringProp object at 0x121ce50>, 'trigger_name': <shinken.property.ListProp object at 0x1226c90>, 'vrml_image': <shinken.property.StringProp object at 0x12267d0>, '3d_coords': <shinken.property.StringProp object at 0x1226890>, '2d_coords': <shinken.property.StringProp object at 0x1226850>, 'checkmodulations': <shinken.property.ListProp object at 0x1226d10>, 'poller_tag': <shinken.property.StringProp object at 0x1226950>, 'icon_set': <shinken.property.StringProp object at 0x1226790>, 'business_impact': <shinken.property.IntegerProp object at 0x1226c10>, 'max_check_attempts': <shinken.property.IntegerProp object at 0x121cf90

, 'business_rule_output_template': <shinken.property.StringProp object at 0x1226b50>}

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

claneys commented 10 years ago

running_properties are availables indeed... But if it try to retrieve child_dependencies ou act_depend_of, I get : Connexion error to http://localhost:7770/ : The requested URL returned error: 500 Internal Server Error

claneys commented 10 years ago

I managed how to get out of that error. Just pickle the returned data.

Now i wonder what would be the best way to read a nagios config file and handle it.

naparuba commented 10 years ago

read a nagios config file and all what is inside? The shinken.object.Config() object is done for this :)

On Thu, Oct 31, 2013 at 4:35 PM, Forlot Romain notifications@github.comwrote:

I managed how to get out of that error. Just pickle the returned data.

Now i wonder what would be the best way to read a nagios config file and handle it.

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

claneys commented 10 years ago

Yup, I stucked due to the use of log object that need to load an object to create its broks and load the message. (If i understand correctly :)

claneys commented 10 years ago

Thanks naparuba

claneys commented 10 years ago

Plugins works. Cool !

It's working as follow, parse all config files based on shinken.cfg and kept only servicedependcy part. Then map all servicedependency, which have template name for host_name and dependent_host_name directive, wtih host that have those template.

It is beta version for now, I have some problem to connect to the arbiter at launch (how to connect to when arbiter isn't ready :d ? ) And it's seems that arbiter doesn't launch mapping_command at mapping_command_interval but just at launch. Weird. Someone has an idea why ?

naparuba commented 10 years ago

nop, when the arbiter run it launc hte 'tick' method of the module once a second, and it's up to the module to ook at it and relaunch it if need. Look at debug logs, should be something about it

On Mon, Nov 4, 2013 at 5:57 PM, Forlot Romain notifications@github.comwrote:

Plugins works. Cool !

It's working as follow, parse all config files based on shinken.cfg and kept only servicedependcy part. Then map all servicedependency, which have template name for host_name and dependent_host_name directive, wtih host that have those template.

It is beta version for now, I have some problem to connect to the arbiter at launch (how to connect to when arbiter isn't ready :d ? ) And it's seems that arbiter doesn't launch mapping_command at mapping_command_interval but just at launch. Weird. Someone has an idea why ?

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

claneys commented 10 years ago

Thanks, it's ok now. I has problem when running arbiter launched manually with --debug parameter but specifying log_level=DEBUG in shinken.cfg resolv all my problems and everything works normally.

I'll put that in core if it's ok.

naparuba commented 10 years ago

--debug and log_level will get a little differences indeed. I should fix it, because with just log_level, print calls are not "catched" and it's a problem for huge debugging :(

On Wed, Nov 13, 2013 at 3:23 PM, Forlot Romain notifications@github.comwrote:

Thanks, it's ok now. I has problem when running arbiter launched manually with --debug parameter but specifying log_level=DEBUG in shinken.cfg resolv all my problems and everything works normally.

I'll put that in core if it's ok.

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

claneys commented 10 years ago

Okay. I'll delay push in core because lack of test...

Seb-Solon commented 10 years ago

Well i use this print issue as an advantage. Run not as a daemon but with a higher log level. This way I can easily see my print in the shell :)

claneys commented 10 years ago

Is it normal that multiple host_name definition or service_description in a servicedependency doesn't split value into list ? Is the final component to support splitting multiple definition or the primary object ?

Seb-Solon commented 10 years ago

Any news on that ? Maybe related to https://github.com/naparuba/shinken/issues/1029

I'll close it this week end to freeze if no news.