Example #1
0
    def test_svn(self):
        """Performs the test of the subversion server"""

        self.validate_variables()
        self.set_timeout()

        self.vprint(2, "now running subversion test")

        uri = self.generate_uri()

        self.vprint(3, "subversion server address is '%s'" % uri)

        cmd = which(
            "svn") + " ls " + uri + " --no-auth-cache --non-interactive"

        if self.username:
            cmd += " --username=%s" % self.username
        if self.password:
            cmd += " --password=%s" % self.password

        result, output = self.run(cmd)

        if result == 0:
            if not output:
                return (WARNING, "Test passed but no output was received " \
                               + "from svn program, abnormal condition, "  \
                               + "please check.")
            if self.verbosity >= 1:
                return (OK, "svn repository online - directory listing: " \
                          + "%s" % output.replace("\n", " ").strip())
            return (OK, "svn repository online - " \
                      + "directory listing successful")
        else:
            if not output:
                return (CRITICAL, "Connection failed. " \
                                + "There was no output from svn")
            if output == "svn: Can't get password\n":
                output = "password required to access this repository but" \
                       + " none was given or cached"
            output = output.lstrip("svn: ")
            return (CRITICAL, "Error connecting to svn server - %s " \
                                    % output.replace("\n", " ").rstrip(" "))
Example #2
0
    def test_svn(self):
        """Performs the test of the subversion server"""

        self.validate_variables()
        self.set_timeout()

        self.vprint(2, "now running subversion test")

        uri = self.generate_uri()

        self.vprint(3, "subversion server address is '%s'" % uri)

        cmd = which("svn") + " ls " + uri + " --no-auth-cache --non-interactive"

        if self.username:
            cmd += " --username=%s" % self.username
        if self.password:
            cmd += " --password=%s" % self.password

        result, output = self.run(cmd)

        if result == 0:
            if not output:
                return (WARNING, "Test passed but no output was received " \
                               + "from svn program, abnormal condition, "  \
                               + "please check.")
            if self.verbosity >= 1:
                return (OK, "svn repository online - directory listing: " \
                          + "%s" % output.replace("\n", " ").strip())
            return (OK, "svn repository online - " \
                      + "directory listing successful")
        else:
            if not output:
                return (CRITICAL, "Connection failed. " \
                                + "There was no output from svn")
            if output == "svn: Can't get password\n":
                output = "password required to access this repository but" \
                       + " none was given or cached"
            output = output.lstrip("svn: ")
            return (CRITICAL, "Error connecting to svn server - %s " \
                                    % output.replace("\n", " ").rstrip(" "))
Example #3
0
    def test_vnc(self):
        """Performs the test of the vnc server"""

        self.validate_variables()
        self.set_timeout()

        self.vprint(2, "now running vnc test")

        cmd = "%s -compresslevel 0 -passwd %s -vncQuality 0 %s /dev/null" \
              % (which("vncsnapshot"), self.passwdfile, self.server)

        result, output = self.run(cmd)

        if result == 0:
            if not output:
                return (WARNING, "Test passed but no output was received " \
                               + "from vncsnapshot program, abnormal "     \
                               + "condition, please check.")
            else:
                msg = "vnc logged in and image obtained successfully"
                if self.verbosity >= 1:
                    line1 = output.split("\n")[0]
                    if line1[:36] == "VNC server supports protocol version":
                        msg += ". %s" % line1
                    return (OK, msg)
                else:
                    return (OK, msg)
        else:
            if not output:
                return (CRITICAL, "Connection failed. " \
                                + "There was no output from vncsnapshot")
            else:
                if output.split("\n")[0][:36] == \
                                        "VNC server supports protocol version":
                    output = "".join(output.split("\n")[1:])
                if "Connection refused" in output and self.verbosity == 0:
                    output = "Connection refused"
                return (CRITICAL, "Error connecting to vnc server - %s" \
                                        % output.replace("\n", " ").rstrip(" "))
import sys
import time
import lib_nagios as nagios
from lib_nagios import NagiosTester, which, end
from lib_nagios import OK, WARNING, CRITICAL, UNKNOWN, DEFAULT_TIMEOUT
from optparse import OptionParser

__author__      = "Hari Sekhon"
__title__       = "Nagios Plugin for VNC"
__version__     = 0.6

nagios.CHECK_NAME = "VNC"
# The standard VNC port
DEFAULT_PORT      = 5900

BIN = which("vncsnapshot")

class VncTester(NagiosTester):
    """Holds state for the vnc test"""

    def __init__(self):
        """Initializes all variables to their default states"""

        super(VncTester, self).__init__()

        #self.port       = ""
        self.passwdfile = ""


    def validate_variables(self):
        """Runs through the validation of all test variables
Example #5
0
import sys
import time
import lib_nagios as nagios
from lib_nagios import NagiosTester, which, end
from lib_nagios import OK, WARNING, CRITICAL, UNKNOWN, DEFAULT_TIMEOUT
from optparse import OptionParser

__author__      = "Hari Sekhon"
__title__       = "Nagios Plugin for VNC"
__version__     = 0.6

nagios.CHECK_NAME = "VNC"
# The standard VNC port
DEFAULT_PORT      = 5900

BIN = which("vncsnapshot")

class VncTester(NagiosTester):
    """Holds state for the vnc test"""

    def __init__(self):
        """Initializes all variables to their default states"""

        super(VncTester, self).__init__()

        #self.port       = ""
        self.passwdfile = ""


    def validate_variables(self):
        """Runs through the validation of all test variables
   the subversion client "svn" to be installed somewhere in the path"""

import sys
import time
import lib_nagios as nagios
from lib_nagios import NagiosTester, which, end
from lib_nagios import OK, WARNING, CRITICAL, UNKNOWN, DEFAULT_TIMEOUT
from optparse import OptionParser

__author__      = "Hari Sekhon"
__title__       = "Nagios Plugin for Subversion"
__version__     = 0.6

nagios.CHECK_NAME = "SVN"

BIN = which("svn")


class SvnTester(NagiosTester):
    """Holds state for the svn test"""

    def __init__(self):
        """Initializes all variables to their default states"""

        super(SvnTester, self).__init__()

        self.directory  = ""
        self.http       = False
        self.https      = False
        self.password   = ""
        self.port       = ""
Example #7
0
   the subversion client "svn" to be installed somewhere in the path"""

import sys
import time
from optparse import OptionParser
import lib_nagios as nagios
from lib_nagios import NagiosTester, which, end
from lib_nagios import OK, WARNING, CRITICAL, UNKNOWN, DEFAULT_TIMEOUT

__author__      = "Hari Sekhon"
__title__       = "Nagios Plugin for Subversion"
__version__     = '0.6.1'

nagios.CHECK_NAME = "SVN"

BIN = which("svn")


class SvnTester(NagiosTester):
    """Holds state for the svn test"""

    def __init__(self):
        """Initializes all variables to their default states"""

        super(SvnTester, self).__init__()

        self.directory  = ""
        self.http       = False
        self.https      = False
        self.password   = ""
        self.port       = ""