Beispiel #1
0
 def info(self,*args):
     cmdline = '%s info %s'%(self.rrd_bin,string_quote_join(args))
     outstr = subprocessSupport.iexe_cmd(cmdline).split('\n')
     outarr = {}
     for line in outstr:
         linearr = line.split('=')
         outarr[linearr[0]] = linearr[1]
     return outarr
Beispiel #2
0
    def dump(self,*args):
        """
        Run rrd_tool dump

        Input is usually just the file name.
        Output is a list of lines, as returned from rrdtool.
        """
        cmdline = '%s dump %s' % (self.rrd_bin, string_quote_join(args))
        outstr = subprocessSupport.iexe_cmd(cmdline).split('\n')
        return outstr
Beispiel #3
0
def iexe_cmd(cmd, stdin_data=None, child_env=None):
    """
    Fork a process and execute cmd - rewritten to use select to avoid filling
    up stderr and stdout queues.

    @type cmd: string
    @param cmd: Sting containing the entire command including all arguments
    @type stdin_data: string
    @param stdin_data: Data that will be fed to the command via stdin
    @type env: dict
    @param env: Environment to be set before execution
    """
    stdoutdata = ""
    try:
        stdoutdata = subprocessSupport.iexe_cmd(cmd, stdin_data=stdin_data,
                                                child_env=child_env)
    except Exception, ex:
        raise ExeError, "Unexpected Error running '%s'. Details: %s" % (cmd, ex)
Beispiel #4
0
 def graph(self,*args):
     cmdline = '%s graph %s'%(self.rrd_bin, string_quote_join(args))
     outstr = subprocessSupport.iexe_cmd(cmdline)
     return
Beispiel #5
0
 def __init__(self):
     self.rrd_bin = (subprocessSupport.iexe_cmd("which rrdtool").split('\n')[0]).strip()