..as default daemon address.
#define RRDCACHED_DEFAULT_ADDRESS "unix:/tmp/rrdd.sock"
#define RRDCACHED_DEFAULT_PORT "42217"
+#define ENV_RRDCACHED_ADDRESS "RRDCACHED_ADDRESS"
int rrdc_connect (const char *addr);
int rrdc_disconnect (void);
return -1;
}
+ if (daemon == NULL)
+ {
+ char *temp;
+
+ temp = getenv (ENV_RRDCACHED_ADDRESS);
+ if (temp != NULL)
+ {
+ daemon = strdup (temp);
+ if (daemon == NULL)
+ {
+ rrd_set_error("strdup failed.");
+ return (-1);
+ }
+ }
+ }
+
cf = argv[optind + 1];
if (rrd_fetch_r(argv[optind], cf, start, end, step, daemon, ds_cnt,
rrd_set_error("unknown option '%s'", argv[optind - 1]);
return;
}
+ } /* while (1) */
+
+ if (im->use_rrdcached == 0)
+ {
+ char *temp;
+
+ temp = getenv (ENV_RRDCACHED_ADDRESS);
+ if (temp != NULL)
+ {
+ int status;
+
+ status = rrdc_connect (temp);
+ if (status != 0)
+ {
+ rrd_set_error ("rrdc_connect(%s) failed with status %i.",
+ temp, status);
+ return;
+ }
+ im->use_rrdcached = 1;
+ }
}
if (im->logarithmic && im->minval <= 0) {
goto out;
}
+ if ((tmplt == NULL) && (daemon == NULL))
+ {
+ char *temp;
+
+ temp = getenv (ENV_RRDCACHED_ADDRESS);
+ if (temp != NULL)
+ {
+ daemon = strdup (temp);
+ if (daemon == NULL)
+ {
+ rrd_set_error("strdup failed.");
+ goto out;
+ }
+ }
+ }
+
if (daemon != NULL)
{
int status;