def _validate_output(self, request, output): if "command not found" in output: raise nagios.ServiceInaccessibleError(request, output) elif "ERROR: Phusion Passenger doesn't seem to be running." in output: raise nagios.ServiceInaccessibleError(request, output) elif "ERROR: You are not authorized" in output: raise nagios.AuthenticationFailedError(request, output) elif "ERROR" in output: raise nagios.StatusUnknownError(request, output) return True
def _validate_output(self, request, output): if "command not found" in output: raise nagios.ServiceInaccessibleError(request, output) elif "couldn't connect to server" in output: raise nagios.ServiceInaccessibleError(request, output) elif "exception: login failed" in output: raise nagios.AuthenticationFailedError(request, output) elif "ERROR" in output: raise nagios.StatusUnknownError(request, output) elif output.strip() == "": raise nagios.StatusUnknownError(request) return True
def run_query(self, request, query): cmd_template = "redis-cli --raw" if request.password is not None: cmd_template += " -a %s" % request.password if request.database is not None: cmd_template += " -n %s" % request.database if request.host is not None: cmd_template += " -h %s" % request.host if request.port is not None: cmd_template += " -p %s" % request.port cmd = "%s %s" % (cmd_template, query) if request.user: cmd = nagios.rootify(cmd, request.user) output = commands.getoutput(cmd) if "command not found" in output: raise nagios.ServiceInaccessibleError(request, output) elif output.strip() == "": raise nagios.ServiceInaccessibleError(request, output) return output
def _validate_output(self, request, output): if "command not found" in output or \ "Can't connect to MySQL server on" in output: raise nagios.ServiceInaccessibleError(request, output) elif "Access denied for user" in output: raise nagios.AuthenticationFailedError(request, output) elif "mysqladmin: connect to server at" in output: raise nagios.OutputFormatError(request, output) elif output.strip() == "": return False return True
def _validate_output(self, request, output): if ("command not found" in output or "psql: could not connect to server" in output): raise nagios.ServiceInaccessibleError(request, output) elif (("psql: FATAL: role" in output and "does not exist" in output) or "psql: fe_sendauth: no password supplied" in output): raise nagios.AuthenticationFailedError(request, output) elif "does not exist" in output or "psql:" in output: raise nagios.OutputFormatError(request, output) elif output.strip() == "": return False return True
def _validate_output(self, request, output): if output.strip() == "": raise nagios.ServiceInaccessibleError(request) elif "STAT" not in output or "END" not in output: raise nagios.ServiceInaccessibleError(request, output) return True
def _validate_output(self, request, output): if "command not found" in output: raise nagios.ServiceInaccessibleError(request, output) elif output.strip() == "": raise nagios.ServiceInaccessibleError(request, output) return True