From 2a0ab172d96c5f8eeab45641d5129aaacd78aa7a Mon Sep 17 00:00:00 2001 From: Vitezslav Crhonek Date: Thu, 5 Dec 2013 14:12:43 +0100 Subject: doc: service indication example --- doc/admin/service-dbus/index.rst | 4 ++-- doc/admin/service-dbus/usage.rst | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/doc/admin/service-dbus/index.rst b/doc/admin/service-dbus/index.rst index dab439a..e35577c 100644 --- a/doc/admin/service-dbus/index.rst +++ b/doc/admin/service-dbus/index.rst @@ -6,8 +6,8 @@ the systemd D-Bus interface). It allows to enumerate system services and get their status, start/stop/restart/... a service and enable/disable a service. -The provider should be also able to do event based monitoring of service status -(emit indication event upon service status change) in the future. +The provider is also able to do event based monitoring of service status +(emit indication event upon service property change). Contents: diff --git a/doc/admin/service-dbus/usage.rst b/doc/admin/service-dbus/usage.rst index 2d8c706..cb70d31 100644 --- a/doc/admin/service-dbus/usage.rst +++ b/doc/admin/service-dbus/usage.rst @@ -44,3 +44,34 @@ Disable and enable 'cups' service, print EnabledDefault property:: print cups.EnabledDefault cups.TurnServiceOn() print cups.EnabledDefault + +Indications +----------- +OpenLMI Service provider is able (using indication manager and polling) to emit indication +event upon service (i. e. :ref:`LMI_Service ` instance) property modification +(:ref:`LMI_ServiceInstanceModificationIndication `). + +This is useful mainly for being notified when a service has changed state (has been started, +or stopped). + +In order to receive indications, create instances of CIM_IndicationFilter (which indications +should be delivered), CIM_IndicationHandler (what to do with those indications) and +CIM_IndicationSubscription (links filter and handler together). + +The following example in LMIShell does it all in one step:: + + c.subscribe_indication( + Name="service_modification", + QueryLanguage="DMTF:CQL", + Query="SELECT * FROM LMI_ServiceInstanceModificationIndication WHERE SOURCEINSTANCE ISA LMI_Service", + CreationNamespace="root/interop", + SubscriptionCreationClassName="CIM_IndicationSubscription", + FilterCreationClassName="CIM_IndicationFilter", + FilterSystemCreationClassName="CIM_ComputerSystem", + FilterSourceNamespace="root/cimv2", + HandlerCreationClassName="CIM_IndicationHandlerCIMXML", + HandlerSystemCreationClassName="CIM_ComputerSystem", + Destination="http://localhost:12121" + ) + +Indications are sent to the location specified in 'Destination' argument. -- cgit