Update Health Check

Change-Id: I526550685e50177bc1c1957e9e4fc2b42b64177c
This commit is contained in:
Xicheng Chang 2014-02-06 17:49:35 -08:00
parent 2ee5fa366e
commit 1da12a51c1
4 changed files with 20 additions and 16 deletions

View File

@ -39,7 +39,8 @@ class DhcpCheck(base.BaseCheck):
cobbler_settings = self.remote.get_settings()
if cobbler_settings['manage_dhcp'] == 0:
self.messages.append(
"[DHCP]Info: DHCP service is not managed by Compass")
"[%s]Info: DHCP service is not managed by Compass"
% self.NAME)
return (self.code, self.messages)
self.check_cobbler_dhcp_template()
print "[Done]"

View File

@ -19,16 +19,18 @@ class HdsCheck(base.BaseCheck):
try:
pkg_module = __import__(pkg_type)
except:
self.messages.append("[HDS]Error: No module named %s, "
"please install it first." % pkg_module)
self.messages.append("[%s]Error: No module named %s, "
"please install it first."
% (self.NAME, pkg_module))
method_name = 'self.check_' + pkg_type + '_snmp(pkg_module)'
eval(method_name)
print "[Done]"
self.check_snmp_mibs()
print "[Done]"
if self.code == 1:
self.messages.append("[HDS]Info: hds health check has complated. "
"No problems found, all systems go.")
self.messages.append("[%s]Info: hds health check has complated. "
"No problems found, all systems go."
% self.NAME)
return (self.code, self.messages)
def check_yum_snmp(self, pkg_module):
@ -44,8 +46,8 @@ class HdsCheck(base.BaseCheck):
uninstalled = []
for package in ['net-snmp-utils', 'net-snmp', 'net-snmp-python']:
if not yum_base.rpmdb.searchNevra(name=package):
self.messages.append("[HDS]Error: %s package is required "
"for HDS" % package)
self.messages.append("[%s]Error: %s package is required "
"for HDS" % (self.NAME, package))
uninstalled.append(package)
if len(uninstalled) != 0:
self._set_status(0, "[%s]Info: Uninstalled packages: %s"

View File

@ -162,8 +162,8 @@ class MiscCheck(base.BaseCheck):
if health_check_utils.check_chkconfig(serv) is True:
self._set_status(
0,
"[Miscellaenous Check]Error: %s is not disabled"
% serv)
"[%s]Error: %s is not disabled"
% (self.NAME, serv))
serv_to_disable.append(serv)
if len(serv_to_disable) != 0:
self._set_status(

View File

@ -28,12 +28,13 @@ class OsInstallerCheck(base.BaseCheck):
except:
self.code = 0
self.messages.append(
"[OS Installer]Error: Cannot login to Cobbler with "
"the tokens provided in the config file")
"[%s]Error: Cannot login to Cobbler with "
"the tokens provided in the config file"
% self.NAME)
self.messages.append(
"[OS Installer]Error: Failed to connect to Cobbler "
"[%s]Error: Failed to connect to Cobbler "
"API, please check if /etc/cobbler/setting "
"is properly configured")
"is properly configured" % self.NAME)
return (self.code, self.messages)
check_result = self.remote.check(self.token)
@ -44,7 +45,7 @@ class OsInstallerCheck(base.BaseCheck):
if len(check_result) != 0:
self.code = 0
for error_msg in check_result:
self.messages.append("[OS Installer]Error: " + error_msg)
self.messages.append("[%s]Error: " % self.NAME + error_msg)
if len(self.remote.get_distros()) == 0:
self._set_status(0,
@ -111,7 +112,7 @@ class OsInstallerCheck(base.BaseCheck):
if self.code == 1:
self.messages.append(
"[OS Installer]Info: OS Installer health check "
"has completed. No problems found, all systems go.")
"[%s]Info: OS Installer health check has completed."
" No problems found, all systems go." % self.NAME)
return (self.code, self.messages)