def getStatus(self, statClass=None): """ Return the status number for this WinService """ if self.startMode not in self.getMonitoredStartModes(): return -1 return Service.getStatus(self, statClass)
def stop(self): """Stop the LogicMonitor collector""" logging.debug("Running Collector.stop...") if self.platform == "Linux": logging.debug("Platform is Linux") output = Service.getStatus("logicmonitor-agent") if "is running" in output: logging.debug("Service logicmonitor-agent is running") logging.debug("System changed") self.change = True if self.check_mode: self.exit(changed=True) logging.debug("Stopping service logicmonitor-agent") (output, err) = Service.doAction("logicmonitor-agent", "stop") if output != 0: self.fail( msg="Error: Failed stopping logicmonitor-agent " + "service. " + err) output = Service.getStatus("logicmonitor-watchdog") if "is running" in output: logging.debug("Service logicmonitor-watchdog is running") logging.debug("System changed") self.change = True if self.check_mode: self.exit(changed=True) logging.debug("Stopping service logicmonitor-watchdog") (output, err) = Service.doAction("logicmonitor-watchdog", "stop") if output != 0: self.fail( msg="Error: Failed stopping logicmonitor-watchdog " + "service. " + err) else: self.fail( msg="Error: LogicMonitor Collector must be " + "installed on a Linux device.")