From: oetiker Date: Thu, 25 Sep 2008 15:25:51 +0000 (+0000) Subject: This adds support for
: in the rrd client library. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=f3816cb9cea7ce0b5390afe5508b5f209ec7a52a;p=rrdtool.git This adds support for
: in the rrd client library. Obviously this is required to take advantage of the server's ability to bind to a non-standard port -- kevin brintnall git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1522 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/doc/rrdcached.pod b/doc/rrdcached.pod index 0f34dc2..bdb8949 100644 --- a/doc/rrdcached.pod +++ b/doc/rrdcached.pod @@ -37,6 +37,13 @@ name are resolved using L. For network sockets, a port may be specified by using the form I
:I. The default port is 42217. +These formats are accepted: + + unix: + + + : + If the B<-l> option is not specified the default address, C, will be used. diff --git a/doc/rrddump.pod b/doc/rrddump.pod index 89e378b..c26d31b 100644 --- a/doc/rrddump.pod +++ b/doc/rrddump.pod @@ -47,10 +47,8 @@ the xml headers. Address of the L daemon. If specified, a C command is sent to the server before reading the RRD files. This allows B to return -fresh data even if the daemon is configured to cache values for a long time. To -specify a UNIX domain socket use the prefix C, see example below. Other -addresses are interpreted as normal network addresses, i.Ee. IPv4 or IPv6 -addresses in most cases. +fresh data even if the daemon is configured to cache values for a long time. +For a list of accepted formats, see the B<-l> option in the L manual. rrdtool dump --daemon unix:/var/run/rrdcached.sock /var/lib/rrd/foo.rrd diff --git a/doc/rrdfetch.pod b/doc/rrdfetch.pod index d187b69..0052aa6 100644 --- a/doc/rrdfetch.pod +++ b/doc/rrdfetch.pod @@ -53,10 +53,8 @@ specify the end time. Address of the L daemon. If specified, a C command is sent to the server before reading the RRD files. This allows B to return -fresh data even if the daemon is configured to cache values for a long time. To -specify a UNIX domain socket use the prefix C, see example below. Other -addresses are interpreted as normal network addresses, i.Ee. IPv4 or IPv6 -addresses in most cases. +fresh data even if the daemon is configured to cache values for a long time. +For a list of accepted formats, see the B<-l> option in the L manual. rrdtool fetch --daemon unix:/var/run/rrdcached.sock /var/lib/rrd/foo.rrd AVERAGE diff --git a/doc/rrdflush.pod b/doc/rrdflush.pod index f691c21..a593821 100644 --- a/doc/rrdflush.pod +++ b/doc/rrdflush.pod @@ -24,10 +24,10 @@ The name of the B that is to be written to disk. =item B<--daemon> I
-Address of the L daemon. If not specified, the RRDCACHED_ADDRESS -environment variable must be set (see below). To specify a UNIX domain socket -use the prefix C, see example below. Other addresses are interpreted as -normal network addresses, i.Ee. IPv4 or IPv6 addresses in most cases. +Address of the L daemon. If not specified, the +RRDCACHED_ADDRESS environment variable must be set (see below). For a +list of accepted formats, see the B<-l> option in the L +manual. rrdtool flush --daemon unix:/var/run/rrdcached.sock /var/lib/rrd/foo.rrd diff --git a/doc/rrdgraph.pod b/doc/rrdgraph.pod index 2c57dbb..9a2f752 100644 --- a/doc/rrdgraph.pod +++ b/doc/rrdgraph.pod @@ -271,10 +271,8 @@ when using graphv and even when using PRINT. Address of the L daemon. If specified, a C command is sent to the server before reading the RRD files. This allows the graph to contain -fresh data even if the daemon is configured to cache values for a long time. To -specify a UNIX domain socket use the prefix C, see example below. Other -addresses are interpreted as normal network addresses, i.Ee. IPv4 or IPv6 -addresses in most cases. +fresh data even if the daemon is configured to cache values for a long time. +For a list of accepted formats, see the B<-l> option in the L manual. rrdtool graph [...] --daemon unix:/var/run/rrdcached.sock [...] diff --git a/doc/rrdinfo.pod b/doc/rrdinfo.pod index 2af411a..00e5d16 100644 --- a/doc/rrdinfo.pod +++ b/doc/rrdinfo.pod @@ -25,10 +25,8 @@ The name of the B you want to examine. Address of the L daemon. If specified, a C command is sent to the server before reading the RRD files. This allows B to return -fresh data even if the daemon is configured to cache values for a long time. To -specify a UNIX domain socket use the prefix C, see example below. Other -addresses are interpreted as normal network addresses, i.Ee. IPv4 or IPv6 -addresses in most cases. +fresh data even if the daemon is configured to cache values for a long time. +For a list of accepted formats, see the B<-l> option in the L manual. rrdtool info --daemon unix:/var/run/rrdcached.sock /var/lib/rrd/foo.rrd diff --git a/doc/rrdlast.pod b/doc/rrdlast.pod index ecec65a..a8bf757 100644 --- a/doc/rrdlast.pod +++ b/doc/rrdlast.pod @@ -22,10 +22,8 @@ The name of the B that contains the data. Address of the L daemon. If specified, a C command is sent to the server before reading the RRD files. This allows B to return -fresh data even if the daemon is configured to cache values for a long time. To -specify a UNIX domain socket use the prefix C, see example below. Other -addresses are interpreted as normal network addresses, i.Ee. IPv4 or IPv6 -addresses in most cases. +fresh data even if the daemon is configured to cache values for a long time. +For a list of accepted formats, see the B<-l> option in the L manual. rrdtool last --daemon unix:/var/run/rrdcached.sock /var/lib/rrd/foo.rrd diff --git a/doc/rrdlastupdate.pod b/doc/rrdlastupdate.pod index db506ab..ecdff8d 100644 --- a/doc/rrdlastupdate.pod +++ b/doc/rrdlastupdate.pod @@ -22,10 +22,8 @@ The name of the B that contains the data. Address of the L daemon. If specified, a C command is sent to the server before reading the RRD files. This allows B to return -fresh data even if the daemon is configured to cache values for a long time. To -specify a UNIX domain socket use the prefix C, see example below. Other -addresses are interpreted as normal network addresses, i.Ee. IPv4 or IPv6 -addresses in most cases. +fresh data even if the daemon is configured to cache values for a long time. +For a list of accepted formats, see the B<-l> option in the L manual. rrdtool lastupdate --daemon unix:/var/run/rrdcached.sock /var/lib/rrd/foo.rrd diff --git a/doc/rrdupdate.pod b/doc/rrdupdate.pod index 82c6603..c285ee3 100644 --- a/doc/rrdupdate.pod +++ b/doc/rrdupdate.pod @@ -65,12 +65,9 @@ for the COMPUTE B. If given, B will try to connect to the caching daemon L at I
and will fail if the connection cannot be established. If the connection is successfully established the values will be sent to the daemon -instead of accessing the files directly. If I
begins with C -then everything after this prefix will be considered to be a UNIX domain -socket, see L below. Otherwise the address is interpreted as network -address or node name as understood by L. One practical -consequence is that both, IPv4 and IPv6, may be used if the system supports -it. This option is available for the B command only. +instead of accessing the files directly. + +For a list of accepted formats, see the B<-l> option in the L manual. =item B|IB<:>I[B<:>I...] diff --git a/doc/rrdxport.pod b/doc/rrdxport.pod index 11159e4..d7e6bb3 100644 --- a/doc/rrdxport.pod +++ b/doc/rrdxport.pod @@ -53,14 +53,12 @@ See L documentation. Address of the L daemon. If specified, a C command is sent to the server before reading the RRD files. This allows B to return -fresh data even if the daemon is configured to cache values for a long time. To -specify a UNIX domain socket use the prefix C, see example below. Other -addresses are interpreted as normal network addresses, i.Ee. IPv4 or IPv6 -addresses in most cases. +fresh data even if the daemon is configured to cache values for a long time. +For a list of accepted formats, see the B<-l> option in the L manual. - rrdtool xport --daemon unix:/var/run/rrdcached.sock ... + rrdtool xport --daemon unix:/var/run/rrdcached.sock ... -=item B<--enumds> +=item B<--enumds> The generated xml should contain the data values in enumerated tags. diff --git a/src/rrd_client.c b/src/rrd_client.c index 11fb80d..c573dad 100644 --- a/src/rrd_client.c +++ b/src/rrd_client.c @@ -352,6 +352,7 @@ static int rrdc_connect_network (const char *addr) /* {{{ */ struct addrinfo ai_hints; struct addrinfo *ai_res; struct addrinfo *ai_ptr; + char *port; assert (addr != NULL); assert (sd == -1); @@ -365,8 +366,14 @@ static int rrdc_connect_network (const char *addr) /* {{{ */ ai_hints.ai_family = AF_UNSPEC; ai_hints.ai_socktype = SOCK_STREAM; + port = rindex(addr, ':'); + if (port != NULL) + *port++ = '\0'; + ai_res = NULL; - status = getaddrinfo (addr, RRDCACHED_DEFAULT_PORT, &ai_hints, &ai_res); + status = getaddrinfo (addr, + port == NULL ? RRDCACHED_DEFAULT_PORT : port, + &ai_hints, &ai_res); if (status != 0) return (status);