summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 75fc7aa)
raw | patch | inline | side by side (parent: 75fc7aa)
author | alex <alex@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 21 Jul 2001 18:17:44 +0000 (18:17 +0000) | ||
committer | alex <alex@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 21 Jul 2001 18:17:44 +0000 (18:17 +0000) |
program/doc/rrdgraph_graph.pod | patch | blob | history | |
program/src/rrd_graph.c | patch | blob | history |
index a94aa37e49f8ca6b73293bfc3969cc4dfa28157a..eed76105926300dd6987457d050af43d1032f880 100644 (file)
B<PRINT:>I<vname>B<:>I<CF>B<:>I<format>
-I<Soon depriciated. Use the new form of this command in new scripts.>
+I<Depriciated. Use the new form of this command in new scripts.>
The first form of this command is to be used with B<CDEF> I<vname>s.
B<PRINT:>I<vname>B<:>I<format>
B<GPRINT:>I<vname>B<:>I<CF>B<:>I<format>
-I<Soon depriciated. Use the new form of this command in new scripts.>
+I<Depriciated. Use the new form of this command in new scripts.>
This is the same as B<PRINT> but now it is printed inside the graph.
See L<PRINT> for more information.
B<HRULE:>I<value>B<#>I<rrggbb>[B<:>I<legend>]
-I<Soon depriciated. Use a VDEF and a LINEx in new scripts.>
-
Draw an horizontal line at I<value>. Its color is composed from three
hexadecimal numbers specifying the color components (00 is off, FF is
maximum) red, green and blue. Optionally a legend box and string is
-printed in the legend section.
+printed in the legend section. I<value> can be a variable from a B<VDEF>.
+It is an error to use I<vname>s from B<DEF> or B<CDEF> here.
B<VRULE:>I<time>B<#>I<rrggbb>[B<:>I<legend>]
index 18f7d2382cc9c25650439c147059dec5da5925b3..313c518369aa1c4fc63c98f6a2ecba86695a52f1 100644 (file)
--- a/program/src/rrd_graph.c
+++ b/program/src/rrd_graph.c
return 0;
}
case GF_GPRINT:
+ /* PRINT and GPRINT can now print VDEF generated values.
+ * There's no need to do any calculations on them as these
+ * calculations were already made.
+ */
vidx = im->gdes[i].vidx;
- max_ii =((im->gdes[vidx].end
- - im->gdes[vidx].start)
- /im->gdes[vidx].step
- *im->gdes[vidx].ds_cnt);
- printval = DNAN;
- validsteps = 0;
- for(ii=im->gdes[vidx].ds+im->gdes[vidx].ds_cnt;
- ii < max_ii+im->gdes[vidx].ds_cnt;
- ii+=im->gdes[vidx].ds_cnt){
- if (! finite(im->gdes[vidx].data[ii]))
- continue;
- if (isnan(printval)){
- printval = im->gdes[vidx].data[ii];
- validsteps++;
- continue;
- }
+ if (im->gdes[vidx].gf==GF_VDEF) { /* simply use vals */
+ printval = im->gdes[vidx].yrule;
+ } else { /* need to calculate max,min,avg etcetera */
+ max_ii =((im->gdes[vidx].end
+ - im->gdes[vidx].start)
+ / im->gdes[vidx].step
+ * im->gdes[vidx].ds_cnt);
+ printval = DNAN;
+ validsteps = 0;
+ for(ii=im->gdes[vidx].ds+im->gdes[vidx].ds_cnt;
+ ii < max_ii+im->gdes[vidx].ds_cnt;
+ ii+=im->gdes[vidx].ds_cnt){
+ if (! finite(im->gdes[vidx].data[ii]))
+ continue;
+ if (isnan(printval)){
+ printval = im->gdes[vidx].data[ii];
+ validsteps++;
+ continue;
+ }
- switch (im->gdes[i].cf){
- case CF_HWPREDICT:
- case CF_DEVPREDICT:
- case CF_DEVSEASONAL:
- case CF_SEASONAL:
- case CF_AVERAGE:
- validsteps++;
- printval += im->gdes[vidx].data[ii];
- break;
- case CF_MINIMUM:
- printval = min( printval, im->gdes[vidx].data[ii]);
- break;
- case CF_FAILURES:
- case CF_MAXIMUM:
- printval = max( printval, im->gdes[vidx].data[ii]);
- break;
- case CF_LAST:
- printval = im->gdes[vidx].data[ii];
+ switch (im->gdes[i].cf){
+ case CF_HWPREDICT:
+ case CF_DEVPREDICT:
+ case CF_DEVSEASONAL:
+ case CF_SEASONAL:
+ case CF_AVERAGE:
+ validsteps++;
+ printval += im->gdes[vidx].data[ii];
+ break;
+ case CF_MINIMUM:
+ printval = min( printval, im->gdes[vidx].data[ii]);
+ break;
+ case CF_FAILURES:
+ case CF_MAXIMUM:
+ printval = max( printval, im->gdes[vidx].data[ii]);
+ break;
+ case CF_LAST:
+ printval = im->gdes[vidx].data[ii];
+ }
}
- }
- if (im->gdes[i].cf == CF_AVERAGE || im -> gdes[i].cf > CF_LAST) {
- if (validsteps > 1) {
- printval = (printval / validsteps);
+ if (im->gdes[i].cf==CF_AVERAGE || im->gdes[i].cf > CF_LAST) {
+ if (validsteps > 1) {
+ printval = (printval / validsteps);
+ }
}
- }
+ } /* prepare printval */
+
+
if ((percent_s = strstr(im->gdes[i].format,"%S")) != NULL) {
/* Magfact is set to -1 upon entry to print_calc. If it
* is still less than 0, then we need to run auto_scale.
printval /= magfact;
}
*(++percent_s) = 's';
- }
- else if (strstr(im->gdes[i].format,"%s") != NULL) {
+ } else if (strstr(im->gdes[i].format,"%s") != NULL) {
auto_scale(im,&printval,&si_symb,&magfact);
}
+
if (im->gdes[i].gf == GF_PRINT){
(*prdata)[prlines-2] = malloc((FMT_LEG_LEN+2)*sizeof(char));
if (bad_format(im->gdes[i].format)) {
case GF_PRINT:
im.prt_c++;
case GF_GPRINT:
- if(sscanf(
- &argv[i][argstart],
- "%29[^#:]:" CF_NAM_FMT ":%n",
- varname,symname,&strstart) == 2){
- scan_for_col(&argv[i][argstart+strstart],FMT_LEG_LEN,im.gdes[im.gdes_c-1].format);
- if((im.gdes[im.gdes_c-1].vidx=find_var(&im,varname))==-1){
- im_free(&im);
- rrd_set_error("unknown variable '%s'",varname);
- return -1;
- }
- if((im.gdes[im.gdes_c-1].cf=cf_conv(symname))==-1){
- im_free(&im);
- return -1;
- }
-
- } else {
+ strstart=0;
+ sscanf(&argv[i][argstart], DEF_NAM_FMT ":%n"
+ ,varname
+ ,&strstart
+ );
+
+ if (strstart==0) {
im_free(&im);
- rrd_set_error("can't parse '%s'",&argv[i][argstart]);
+ rrd_set_error("can't parse vname in '%s'",&argv[i][argstart]);
return -1;
- }
+ };
+
+ if ((im.gdes[im.gdes_c-1].vidx=find_var(&im,varname))==-1){
+ im_free(&im);
+ rrd_set_error("Unknown variable '%s' in (G)PRINT",varname);
+ return -1;
+ } else {
+ int n=0;
+
+ sscanf(&argv[i][argstart+strstart],CF_NAM_FMT ":%n"
+ ,symname
+ ,&n
+ );
+ if (im.gdes[im.gdes[im.gdes_c-1].vidx].gf==GF_VDEF) {
+ /* No consolidation function should be present */
+ if (n != 0) {
+ rrd_set_error("(G)PRINT of VDEF needs no CF");
+ im_free(&im);
+ return -1;
+ }
+ } else {
+ /* A consolidation function should follow */
+ if (n==0) {
+ im_free(&im);
+ rrd_set_error("Missing or incorrect CF in (G)PRINTing '%s' (%s)",varname,&argv[i][argstart]);
+ return -1;
+ };
+ if((im.gdes[im.gdes_c-1].cf=cf_conv(symname))==-1){
+ im_free(&im);
+ return -1;
+ };
+ strstart+=n;
+ };
+ };
+
+ scan_for_col(
+ &argv[i][argstart+strstart]
+ ,FMT_LEG_LEN
+ ,im.gdes[im.gdes_c-1].format
+ );
break;
case GF_COMMENT:
if(strlen(&argv[i][argstart])>FMT_LEG_LEN) argv[i][argstart+FMT_LEG_LEN-3]='\0' ;