Skip to content
Snippets Groups Projects
Commit 4f6b9a67 authored by Mark Harrison's avatar Mark Harrison
Browse files

Change the check data structure from a list to a hash.

This means that if a particular check is loaded twice (Same module, same check
name), the most recently loaded one will take precedence. This allows included
files to override default behavior with certain checks if required.

git-svn-id: https://labs.omniti.com/resmon/branches/resmon2@372 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55
parent 4b03439f
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,7 @@ sub new {
push @{$self->{modstatus}}, "$current`$check_name";
next;
}
push(@{$self->{Module}->{$current}}, $object);
$self->{Module}->{$current}->{$check_name} = $object;
} elsif (/^\s*\}\s*$/) {
$current = undef;
} else {
......@@ -82,7 +82,7 @@ sub new {
$current = "BAD_MODULE";
next;
}
$self->{Module}->{$current} ||= [];
$self->{Module}->{$current} ||= {};
next;
}
elsif(/\S*LIB\s+(\S+)\s*;\s*/) {
......
......@@ -89,7 +89,7 @@ if($config->{port});
while(1) {
while(my($module_name, $mod_configs) = each %{$config->{Module}}) {
foreach my $monitor_obj (@$mod_configs) {
while(my($check_name, $monitor_obj) = each %$mod_configs) {
my $check_metric = {};
my $starttime = [gettimeofday];
# Get old status if it hasn't expired
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment