getRootDSE(); $query = array(); $query['base'] = $attrs['monitorcontext'][0]; $query['scope'] = 'sub'; $query['attrs'] = array('+','*'); $results = $app['server']->query($query,null); if (! isset($attrs['monitorcontext']) || ! count($results)) { system_message(array( 'title' => _('Monitoring context does not exist'), 'body' => sprintf('%s: %s', _('Could not obtain the monitor context for this server'), $app['server']->getName()), 'type' => 'warn'), 'index.php'); } printf('

%s%s

',_('Monitor info for: '),$app['server']->getName()); printf('

%s

',_('Server reports the following information about itself')); echo ''; # cn=Monitor printf('',_('LDAP Server')); printf(''; foreach (array( 'cn=Backends,cn=Monitor' => 'cn=Backend %s,%s', 'cn=Overlays,cn=Monitor' => 'cn=Overlay %s,%s' ) as $dn => $child) { if (isset($results[$dn]['description'])) { $description = implode(' ',$results[$dn]['description']); $description = preg_replace('/"/','\'',$description); } else { $description = ''; } printf('',$description,$dn); echo ''; } # cn=Connections,cn=Monitor printf('',$results['cn=Connections,cn=Monitor']['description'],_('LDAP Connections')); printf(''; foreach (array( 'cn=Listeners,cn=Monitor', 'cn=Log,cn=Monitor', 'cn=Operations,cn=Monitor', 'cn=SASL,cn=Monitor', 'cn=TLS,cn=Monitor', 'cn=Statistics,cn=Monitor', 'cn=Threads,cn=Monitor', 'cn=Time,cn=Monitor', 'cn=Waiters,cn=Monitor' ) as $dn ) { $description = implode(' ',$results[$dn]['description']); $description = preg_replace('/"/','\'',$description); printf('',$description,$dn); echo ''; } echo '
%s
'); echo ''; printf('',$results[$attrs['monitorcontext'][0]]['monitoredinfo'][0]); echo '
%s
'; echo '
%s
'; echo ''; echo '
'; echo ''; $attrs = array( 'monitorruntimeconfig', 'supportedcontrol' ); echo ''; printf('',_('Type'),'namingContext'); foreach ($attrs as $attr) { printf('', $attr); } echo ''; $counter = 0; foreach ($results[$dn]['monitoredinfo'] as $index => $backend) { printf('',$counter++%2==0?'even':'odd'); printf('',$backend); $key = sprintf($child,$index,$dn); echo ''; foreach ($attrs as $attr) { echo ''; } echo ''; } echo '
%s%s%s
%s'; if (isset($results[$key]['seealso'])) { $seealso = is_array($results[$key]['seealso']) ? $results[$key]['seealso'] : array($results[$key]['seealso']); foreach ($seealso as $db) { if (isset($results[$db]['namingcontexts'])) { printf('%s
', isset($results[$db]['labeleduri']) ? implode(' ', $results[$db]['labeleduri']) : _('Internal'), implode(' ', $results[$db]['namingcontexts'])); } else { printf('%s ', implode(' ', $results[$db]['monitoredinfo'])); } } } else { echo ' '; } echo '
'; if (isset($results[$key][$attr])) { if (! is_array($results[$key][$attr])) { $sc = array($results[$key][$attr]); } else { $sc = $results[$key][$attr]; } if (strcasecmp('supportedcontrol',$attr) == 0) { foreach ($sc as $control) { $oidtotext = support_oid_to_text($control); printf('%s
', $control, $oidtotext['title']); } } else { printf('%s ', implode('
', $sc)); } } else { echo ' '; } echo '
'; echo '
%s
'); echo ''; echo '
'; echo ''; printf('', _('Total Connections'),$results['cn=Total,cn=Connections,cn=Monitor']['monitorcounter']); printf('', _('Current Connections'),$results['cn=Current,cn=Connections,cn=Monitor']['monitorcounter']); # Look for some connections foreach ($results as $key => $value) { if (preg_match('/^cn=Connection.*,cn=Connections,cn=Monitor$/',$key)) { echo ''; printf('',$results[$key]['cn'][0]); echo ''; echo ''; } } echo '
%s%s
%s%s
%s'; echo ''; $counter = 0; foreach (array( 'monitorconnectionactivitytime', 'monitorconnectionauthzdn', 'monitorconnectionget', 'monitorconnectionlistener', 'monitorconnectionlocaladdress', 'monitorconnectionmask', 'monitorconnectionnumber', 'monitorconnectionopscompleted', 'monitorconnectionopsexecuting', 'monitorconnectionopspending', 'monitorconnectionopsreceived', 'monitorconnectionpeeraddress', 'monitorconnectionpeerdomain', 'monitorconnectionprotocol', 'monitorconnectionread', 'monitorconnectionstarttime', 'monitorconnectionwrite' ) as $metric) { printf('',$counter++%2==0?'even':'odd'); printf('', $metric,isset($results[$key][$metric]) ? $results[$key][$metric][0] : ' '); echo ''; } echo '
%s%s
'; echo '
'; echo '
%s
'; echo ''; echo '
'; echo ''; if (isset($results[$dn]['monitoropinitiated'])) { printf('', 'monitorOpInitiated', $results[$dn]['monitoropinitiated'][0]); } if (isset($results[$dn]['monitoropcompleted'])) { printf('', 'monitorOpCompleted', $results[$dn]['monitoropcompleted'][0]); } if (isset($results[$dn]['monitoredinfo'])) { printf('', 'monitoredInfo', $results[$dn]['monitoredinfo'][0]); } # Look for some connecitons foreach ($results as $key => $value) { if (preg_match('/^.*,'.$dn.'$/',$key)) { echo ''; printf('',$results[$key]['cn'][0]); echo ''; echo ''; } } echo '
%s%s
%s%s
%s%s
%s'; echo ''; foreach (array( 'labeleduri', 'monitorconnectionlocaladdress', 'monitoredinfo', 'monitorcounter', 'monitoropinitiated', 'monitoropcompleted', 'monitortimestamp' ) as $metric) { if (isset($results[$key][$metric])) { printf('',$counter++%2==0?'even':'odd'); printf('', $metric,$results[$key][$metric][0]); echo ''; } } echo '
%s%s
'; echo '
'; echo '
';