Forum Discussion
Alex_Chow_3394
Nimbostratus
Oct 29, 2007Perl unable to print String[] - get_monitor_association
Hi.
I am trying to use get_monitor_association() to query monitors of a server.
monitor_rule has structure of:
- type:MonitorRuleType(An indicator of how to deal/interpret with the list of monitors in monitor_templates.)
- quorum:long(A value to be used when type is MONITOR_RULE_TYPE_M_OF_N, i.e. this value is the M in M of N. This value is ignored for other rule types.)
- monitor_templates:String[](The list of monitors that constitute this monitor rule.)
However, the following Perl code is unable to retrieve the monitor_templates list.
Please kindly give advice.
Thanks in advance.
Alex
$soapResponse = $NodeAddress->get_monitor_association
(
SOAP::Data->name(server_names => [$sServerName]),
);
&checkResponse($soapResponse);
my @MonitorAssociationList = @{$soapResponse->result};
foreach $MonitorAssociation (@MonitorAssociationList)
{
print $MonitorAssociation ->{'server_name'} . "\n";
$monitorRule = $MonitorAssociation -> {'monitor_rule'};
print $monitorRule -> {'type'} . "\n";
Okay so far for the above
**** Unable to show result for followings ****
@MonitorTemplatesList = $monitorRule -> {'monitor_templates'};
print "$MonitorTemplatesList[0]\n";
print "@MonitorTemplatesList \n";
}
- Alex_Chow_3394
Nimbostratus
Hi. - Yeah, it's an array. You can do something like this if you want to iterate through the list.
@MonitorTemplatesList = @{$monitorRule->{'monitor_templates'}}; foreach $MonitorTemplate (@MonitorTemplatesList) { print "Template: $MonitorTemplate\n"; }
- mariogolf_57851
Nimbostratus
Do you have an example for a PoolMember get_monitor_association?
- Great example, thanks for the contribution!
- mariogolf_57851
Nimbostratus
Thank you Joe. Just building on your examples. I appreciate your comments as well as your code.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects