SymuxClient(3)

NAME
SymuxClient - Object client interface for symux

SYNOPSIS
use SymuxClient;

DESCRIPTION
"SymuxClient" provides an object client interface for listening to, and parsing of, symux data.

CONSTRUCTOR

new ( ARGS )
    Creates a new "SymuxClient" object that holds the data it receives from symux via stdin or file arguments. Arguments are:

        fd*            filedescriptor to read data from, defaults to
                       stdin.

        retry*         maximum number of retries; used to limit number
                       of connection attempts and number of successive
                       read attempts

    Arguments marked with * are optional.

    Example:
        $sc = new SymuxClient();

  METHODS

getitem (host, stream, item)

Refresh the measured data and get an item from a stream for a particular host. Note that successive calls for this function deal with successive measurements of symon. Set "host" to '*' if data about any host is of interest. Any errors are sent out on STDOUT prepended with 'error: '.

getcacheditem (host, stream, item)

Get an item from a stream for a particular host. Returns "undef" if no data is cached, or if the data cached does not match the host. Can be called multiple times to obtain items from the same measurement. Set "host" to '*' if data about any host is of interest. Any errors are sent out on STDOUT prepended with 'error: '.

getsource ()

Get the symon source host of the currently cached information. Usefull to see what host's data getcacheditem is working on.

Example:
    $sc = new SymuxClient();

    print $sc->getitem("127.0.0.1", "if(de0)",
                       "packets_out");

    # get more data from that measurement
    print $sc->getcacheditem("127.0.0.1","if(de0)",
                             "packets_in");

    # start a new measurement
    print $sc->getitem("*", "if(de0)",
                       "packets_out");
    # which hosts packets_out was that?
    print $sc->getsource();