Xymon Mailing List Archive search

graph definition: file pattern

2 messages in this thread

list Stef Coene · Mon, 06 May 2013 14:19:58 +0200 ·
Hi,

I'm looking for a way to influence the rrds in a multi-rrd graph.
I use FNPATTERN, but I want to have more control from the url because the graphs I want can change from server to server.

As example, this is a graph with 4 filesystems:
hobbitgraph.sh?host=serverA&
service=disk&
first=1&
count=4&
action=menu

But I want to specify the filesystems I want to see:
hobbitgraph.sh?host=serverA&
service=disk&
rrd=/,/home,/usr&
action=menu


An other solution for my case is the possibility to overrule the FNPATTERN in the config file from the url.  For instance, I want to change the FNPATTERN from [disk] so it only shows the filesystems beginning with /home:
hobbitgraph.sh?host=serverA&
service=disk&
FNPATTERN=disk,home(.*).rrd&
action=menu


The url's to the graphs are generated externally from xymon.
I use the filesystems as example.  I need this to group hdisk information on AIX per VG.


Any thoughts?


Stef
list Stef Coene · Tue, 07 May 2013 08:55:18 +0200 ·
For those who are interested, I hacked myself a patch.  This allows you to add a CGI parameter cgipat with a regular expression.
For instance, if you want to match all filesystems beginning with /home, add this to the url:
cgipat=/home.*

57d56
< char *cgipat = NULL;
218,220d216
<               else if (strcmp(cwalk->name, "cgipat") == 0) {
<                       cgipat = strdup(cwalk->value);
<               }
719,722d714
<       if (cgipat) {
<               addtobuffer(result, "&amp;cgipat="); <               addtobuffer(result, urlencode(cgipat));
<       }
927c919
<               pcre *pat, *expat = NULL, *cgipatt = NULL ;
---
              pcre *pat, *expat = NULL;
958,969d949
<               if (cgipat) {
<                       cgipatt = pcre_compile(cgipat, PCRE_CASELESS, &errmsg, &errofs, NULL);
<                       if (!cgipatt) {
<                               char msg[8192];
< <                               snprintf(msg, sizeof(msg), <                                        "CGIpat error, PCRE pattern %s invalid: %s, offset %d\n",
<                                        htmlquoted(cgipat), errmsg, errofs);
<                               errormsg(msg);
<                       }
<               }
< 989,994d968
< <          if (cgipatt) {
<                          result = pcre_exec(cgipatt, NULL, d->d_name, strlen(d->d_name), 0, 0, <                                             ovector, (sizeof(ovector)/sizeof(int)));
<                          if (result < 0) continue;
<          }