def check_apache_running(self, apache_service):
        """Checks if Apache service is running on port 80."""

        print "Checking Apache service......",
        serv_err_msg = health_check_utils.check_service_running(self.NAME,
                                                                apache_service)
        if not serv_err_msg == "":
            self._set_status(0, serv_err_msg)
        if 'http' != socket.getservbyport(80):
            self._set_status(
                0,
                "[%s]Error: Apache is not listening on port 80."
                % self.NAME)
        try:
            html = urllib2.urlopen('http://localhost')
            content = html.geturl()
            if "http://localhost/ods/ods.html" != content:
                self._set_status(
                    0,
                    "[%s]Error: Compass web is not redirected by Apache.")
        except Exception:
            self._set_status(
                0,
                "[%s]Error: Apache is not listening on port 80."
                % self.NAME)

        return True
    def check_tftp_service(self):
        """Checks if TFTP is running on port 69."""
        print "Checking TFTP services......",
        serv_err_msg = health_check_utils.check_service_running(
            self.NAME, 'xinetd')
        if not serv_err_msg == "":
            self._set_status(0, serv_err_msg)

        if 'tftp' != socket.getservbyport(69):
            self._set_status(
                0, "[%s]Error: tftp doesn't seem to be listening "
                "on Port 60." % self.NAME)

        return True
    def check_tftp_service(self):
        """Checks if TFTP is running on port 69."""
        print "Checking TFTP services......",
        serv_err_msg = health_check_utils.check_service_running(self.NAME,
                                                                'xinetd')
        if not serv_err_msg == "":
            self._set_status(0, serv_err_msg)

        if 'tftp' != socket.getservbyport(69):
            self._set_status(
                0,
                "[%s]Error: tftp doesn't seem to be listening "
                "on Port 60." % self.NAME)

        return True
    def check_ntp(self):
        """Validates ntp configuration and service."""

        print "Checking NTP......",
        conf_err_msg = health_check_utils.check_path(self.NAME,
                                                     '/etc/ntp.conf')
        if not conf_err_msg == "":
            self._set_status(0, conf_err_msg)

        serv_err_msg = health_check_utils.check_service_running(self.NAME,
                                                                'ntpd')
        if not serv_err_msg == "":
            self._set_status(0, serv_err_msg)

        return True
    def check_ntp(self):
        """Validates ntp configuration and service."""

        print "Checking NTP......",
        conf_err_msg = health_check_utils.check_path(self.NAME,
                                                     '/etc/ntp.conf')
        if not conf_err_msg == "":
            self._set_status(0, conf_err_msg)

        serv_err_msg = health_check_utils.check_service_running(
            self.NAME, 'ntpd')
        if not serv_err_msg == "":
            self._set_status(0, serv_err_msg)

        return True
    def check_rsyslogd(self):
        """Validates rsyslogd configuration and service."""

        print "Checking rsyslog......",
        conf_err_msg = health_check_utils.check_path(self.NAME,
                                                     '/etc/rsyslog.conf')
        if not conf_err_msg == "":
            self._set_status(0, conf_err_msg)

        dir_err_msg = health_check_utils.check_path(self.NAME,
                                                    '/etc/rsyslog.d/')
        if not dir_err_msg == "":
            self._set_status(0, dir_err_msg)

        serv_err_msg = health_check_utils.check_service_running(self.NAME,
                                                                'rsyslogd')
        if not serv_err_msg == "":
            self._set_status(0, serv_err_msg)

        return True
    def check_rsyslogd(self):
        """Validates rsyslogd configuration and service."""

        print "Checking rsyslog......",
        conf_err_msg = health_check_utils.check_path(self.NAME,
                                                     '/etc/rsyslog.conf')
        if not conf_err_msg == "":
            self._set_status(0, conf_err_msg)

        dir_err_msg = health_check_utils.check_path(self.NAME,
                                                    '/etc/rsyslog.d/')
        if not dir_err_msg == "":
            self._set_status(0, dir_err_msg)

        serv_err_msg = health_check_utils.check_service_running(
            self.NAME, 'rsyslogd')
        if not serv_err_msg == "":
            self._set_status(0, serv_err_msg)

        return True
    def check_apache_running(self, apache_service):
        """Checks if Apache service is running on port 80."""

        print "Checking Apache service......",
        serv_err_msg = health_check_utils.check_service_running(
            self.NAME, apache_service)
        if not serv_err_msg == "":
            self._set_status(0, serv_err_msg)
        if 'http' != socket.getservbyport(80):
            self._set_status(
                0,
                "[%s]Error: Apache is not listening on port 80." % self.NAME)
        try:
            html = urllib2.urlopen('http://localhost')
            html.geturl()
        except Exception:
            self._set_status(
                0,
                "[%s]Error: Apache is not listening on port 80." % self.NAME)

        return True