getRootDSE(); $query = array(); $query['base'] = $attrs['monitorcontext']; $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 optain 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 (is_array($results[$dn]['description'])) $description = implode(' ',$results[$dn]['description']); else $description = $results[$dn]['description']; $description = preg_replace('/"/','\'',$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 ) { if (is_array($results[$dn]['description'])) $description = implode(' ',$results[$dn]['description']); else $description = $results[$dn]['description']; $description = preg_replace('/"/','\'',$description); printf('',$description,$dn); echo ''; } echo '
%s
'); echo ''; printf('',$results['cn=Monitor']['monitoredInfo']); 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']) ? $results[$db]['labeledURI'] : _('Internal'),$results[$db]['namingContexts']); else printf('%s ',$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']); 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] : ' '); echo ''; } echo '
%s%s
'; echo '
'; echo '
%s
'; echo ''; echo '
'; echo ''; if (isset($results[$dn]['monitorOpInitiated'])) printf('', 'monitorOpInitiated',$results[$dn]['monitorOpInitiated']); if (isset($results[$dn]['monitorOpCompleted'])) printf('', 'monitorOpCompleted',$results[$dn]['monitorOpCompleted']); if (isset($results[$dn]['monitoredInfo'])) printf('', 'monitoredInfo',$results[$dn]['monitoredInfo']); # Look for some connecitons foreach ($results as $key => $value) { if (preg_match('/^.*,'.$dn.'$/',$key)) { echo ''; printf('',$results[$key]['cn']); 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]); echo ''; } } echo '
%s%s
'; echo '
'; echo '
'; ?>