help | logout
getHostsAndModules

getHostsAndModules

Name

getHostsAndModules -- Retrieves all host and module names.

Synopsis

$err = $pd->getHostsAndModules(\@hosts, \@modules);

Description

This function connects to a History Listener or MySQL database and collects all host and modules names that have data associated with them. The purpose of this function is to give users a list of hosts and modules to choose from when they want to view data.

The two parameters must be references to arrays. They should be empty, as the function will fill them with the list of hosts and modules. The following is an example of how to use this function:

my @hosts;
my @modules;

$pd->getHostsAndModules(\@hosts, \@modules);

print "Hosts:\n";
foreach my $host (@hosts) {
	print "$host\n";
}

print "\nModules:\n";
foreach my $module (@modules) {
	print "$module\n";
}
				

Returns

Returns -1 if an error occurred, or 0 otherwise. In case of error, the program will croak() with an appriopriate message.