[Xymon] graph definition: file pattern

Stef Coene stef.coene at docum.org
Tue May 7 08:55:18 CEST 2013


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, "&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;
<          }




More information about the Xymon mailing list