diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2010-07-28 10:50:08 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2010-07-28 10:50:08 +0200 |
commit | 0b0c6a595591bb9f3963a4b25141ddff0a73c124 (patch) | |
tree | ac22837a2c05a9f416b7864bed268aa0137fb781 | |
parent | 9cde275bb0dbe97b9f5eb5293a97f608324fa9db (diff) |
Move extra status.dat parsing into separate function
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | bin/icli | 15 |
2 files changed, 13 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..84c048a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/build/ @@ -54,9 +54,6 @@ sub read_status_line { } when('servicestatus') { push(@{$data->{services}->{$cache->{host_name}}}, $cache); - if ($cache->{current_state} != 0) { - $extra->{$cache->{host_name}}->{service_problem} = 1; - } } when('contactstatus') { push(@{$data->{contacts}}, $cache); @@ -78,6 +75,17 @@ sub read_status { close($fh); } +sub enhance_status { + HOST: for my $h (keys %{$data->{services}}) { + for my $s (@{$data->{services}->{$h}}) { + if ($s->{current_state} != 0) { + $extra->{$h}->{service_problem} = 1; + next HOST; + } + } + } +} + sub service_state { my ($digit) = @_; given ($digit) { @@ -166,6 +174,7 @@ GetOptions( ); read_status(); +enhance_status(); if ($for_host) { if (have_host($for_host)) { |