1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- SCOM API package offers modules for accessing COMAR over D-Bus without pain and
- common methods/classes for SCOM scripts.
- Here are some examples for accessing SCOM:
- import scom
- link = scom.Link()
- # Localize strings
- link.setLocale()
- # Never use authentication agent (GUI)
- link.useAgent(False)
- # Get a list of packages that provide system.service method
- packages = list(link.System.Service)
- # Start a service
- link.System.Service["kdebase"].start()
- # Stop all services and ignore replies from packages.
- link.System.Service.stop(quiet=True)
- Asynchronous calls:
- import gobject
- import dbus.mainloop.glib
- dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
- mainloop = gobject.MainLoop()
- import scom
- link = scom.Link()
- # Localize strings
- link.setLocale()
- # Use authentication agent (GUI)
- link.useAgent()
- # Make an asynchronous call to get service information
- def handler(package, exception, result):
- if exception:
- print ("%s error: %s" % (package, exception))
- else:
- print ("%s result: %s" % (package, result))
- link.System.Service.info(async=handler)
- mainloop.run()
- Connecting SCOM service on alternate destination:
- import scom
- link = scom.Link(alternate=True)
- This will simply try to connect tr.org.pardus.scom2 instead
- of tr.org.pardus.scom
- Connecting to alternative DBus server:
- import scom
- link = scom.Link(socket="/mnt/target/var/run/dbus/system_bus_socket")
|