Hi all, I'm relatively new at using perl, but would like to write a script that prints the status of all services on all hosts. I thought the StatusLog module would be good, but it doesn't seem to work with the latest v3 nagios? It's probably more likely I'm doing something wrong, but are there any existing examples of how to use it properly with the latest versions of nagios?
The documentation says "Nagios::Service::Status has the following accessor methods (For V1):", then lists those methods. However, many return null, such as host_up. Are these methods only available in nagios v1? If so, how do I get a status of each service for all hosts and services? I've tried something as simple as this: use Nagios::StatusLog; my $log = Nagios::StatusLog->new( Filename => "/var/log/nagios/status.dat", Version => 3.0 ); my @host_info = qw(host_name status modified_attributes check_command check_period notification_period check_interval retry_interval event_handler has_been_checked should_be_scheduled check_execution_time check_latency check_type current_state last_hard_state last_event_id current_event_id current_problem_id last_problem_id plugin_output); foreach my $host ($log->list_hosts) { my $obj = $log->host($host); foreach my $hostinfo (@host_info) { print "host: $host valname: $hostinfo value: ",$obj->$hostinfo,"\n"; } } I'm not sure this is the correct way to do it, and I don't think the host_info array is complete. Some values also return null. Can someone supply a more complete example of how to parse the status.dat file or otherwise obtain real-time information about the status of every nagios variable for every host? Thanks, Alex ------------------------------------------------------------------------------ 10 Tips for Better Web Security Learn 10 ways to better secure your business today. Topics covered include: Web security, SSL, hacker attacks & Denial of Service (DoS), private keys, security Microsoft Exchange, secure Instant Messaging, and much more. http://www.accelacomm.com/jaw/sfnl/114/51426210/ _______________________________________________ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null