I needed to set up a separate view of Mon, that shows only a handful
of watches. Furthermore, I wanted my regular view of Mon to not show
those watches. mon.cgi knows how to "see only these watches", but
I didn't see any way to "exclude these particular watches".
Hence, the patch. I've implemented a "no_watch" keyword, that,
like the "watch" keyword is a regexp that matches watches, except
that if you list it in "no_watch" then you won't see it.
The patch is attached. Ryan, does this look reasonable?
-- Ed
--- /tmp/newmon.cgi Wed Feb 2 02:16:35 2005
+++ newmon.cgi.pl Wed Feb 2 02:40:48 2005
@@ -141,7 +141,7 @@
$login_expire_time $cookie_name $cookie_path %cgiparams
$monhost_and_port_args $monhost_and_port_args_meta
$has_read_config $moncgi_config_file $cf_file_mtime
- $untaint_ack_msgs @show_watch $show_watch_strict
+ $untaint_ack_msgs @show_watch @no_watch $show_watch_strict
$required_mon_client_version $css_style $zebra_table);
# Formatting-related global vars
use vars qw($BGCOLOR $TEXTCOLOR $LINKCOLOR $VLINKCOLOR
@@ -158,6 +158,7 @@
undef $monhost_and_port_args_meta; # This is defined if the user
overrided monhost or monport
undef @show_watch;
undef $show_watch_strict;
+undef @no_watch;
$RCSID = '$Id: mon.cgi,v 1.39 2005/01/23 10:19:10 ryan Exp $';
$RCSVERSION = '$Revision: 1.39 $';
@@ -930,7 +931,12 @@
my ($group) = (@_);
my $watch;
# Do not print out the status for this group
-# unless it is on the "allowed" list
+# unless it is on the "allowed" list and not on the "disallowed" list
+if (@no_watch) {
+ foreach $watch (@no_watch) {
+ return 0 if ($group =~ m/^$watch$/);
+ }
+}
if (@show_watch) { #user defined one or more watch keywords
#
# Loop through each access control and look for a match
@@ -3550,6 +3556,8 @@
push(@show_watch, $val);
} elsif ($key eq "show_watch_strict") {
$show_watch_strict = $val;
+ } elsif ($key eq "no_watch") {
+ push(@no_watch, $val);
} else {
print STDERR "mon.cgi: moncgi_read_cf: Unknown key-value
pair in config file $cf_file: '$key = $val'\n";
return 0;
_______________________________________________
mon mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/mon