in reply to Parsing nagios status.dat file
Unfortunately, all fields are named differently.# assuming that DATA contains the config my @hosts; do{ &new_host() if /{/ } while <DATA>; sub new_host { my $data = {}; until (defined ($_=<DATA>) && $_=~/}/) { chomp; my (undef,$field,$value)=split /^[\t ]*([^=]*)=/,$_; $data->{$field}=$value; } push @hosts,$data; }
|
|---|