where('device_id', $device['device_id'])->where('app_type', 'puppet-agent')->first(); // show only if Puppet Agent Application discovered if ($app) { $params = []; $sql = 'SELECT `metric`, `value` FROM `application_metrics` WHERE `app_id` =' . $app->app_id; $metrics = dbFetchKeyValue($sql, $params); ?>
app_id; $graph_array['from'] = \LibreNMS\Config::get('time.day'); $graph_array['legend'] = 'no'; // graph last run $title_last_run = 'Last run'; $graph_array_last_run = $graph_array; $graph_array_last_run['type'] = 'application_puppet-agent_last_run'; $link_array_last_run = $graph_array_last_run; $link_array_last_run['page'] = 'graphs'; unset($link_array_last_run['height'], $link_array_last_run['width'], $link_array_last_run['legend']); $link_last_run = \LibreNMS\Util\Url::generate($link_array_last_run); $overlib_content_last_run = generate_overlib_content($graph_array_last_run, $device['hostname'] . ' - ' . $title_last_run); $overlib_link_last_run = \LibreNMS\Util\Url::overlibLink($link_last_run, 'Last run', $overlib_content_last_run); // graph runtime $title_runtime = 'Runtime'; $graph_array_runtime = $graph_array; $graph_array_runtime['type'] = 'application_puppet-agent_time'; $link_array_runtime = $graph_array_runtime; $link_array_runtime['page'] = 'graphs'; unset($link_array_runtime['height'], $link_array_runtime['width'], $link_array_runtime['legend']); $link_runtime = \LibreNMS\Util\Url::generate($link_array_runtime); $overlib_content_runtime = generate_overlib_content($graph_array_runtime, $device['hostname'] . ' - ' . $title_runtime); $overlib_link_runtime = \LibreNMS\Util\Url::overlibLink($link_runtime, $title_runtime, $overlib_content_runtime); // graph resources $title_resources = 'Resources'; $graph_array_resources = $graph_array; $graph_array_resources['type'] = 'application_puppet-agent_resources'; $link_array_resources = $graph_array_resources; $link_array_resources['page'] = 'graphs'; unset($link_array_resources['height'], $link_array_resources['width'], $link_array_resources['legend']); $link_resources = \LibreNMS\Util\Url::generate($link_array_resources); $overlib_content_resources = generate_overlib_content($graph_array_resources, $device['hostname'] . ' - ' . $title_resources); $overlib_link_resources = \LibreNMS\Util\Url::overlibLink($link_resources, $title_resources, $overlib_content_resources); // graph events $title_events = 'Change Events'; $graph_array_events = $graph_array; $graph_array_events['type'] = 'application_puppet-agent_events'; $link_array_events = $graph_array_events; $link_array_events['page'] = 'graphs'; unset($link_array_events['height'], $link_array_events['width'], $link_array_events['legend']); $link_events = \LibreNMS\Util\Url::generate($link_array_events); $overlib_content_events = generate_overlib_content($graph_array_events, $device['hostname'] . ' - ' . $title_events); $overlib_link_events = \LibreNMS\Util\Url::overlibLink($link_events, $title_events, $overlib_content_events); echo '
Summary
' . $overlib_link_last_run . ': ' . $metrics['last_run_last_run'] . 'min ' . $overlib_link_runtime . ': ' . $metrics['time_total'] . 's ' . $overlib_link_resources . ': ' . $metrics['resources_total'] . '
' . $overlib_link_events . '
Success: ' . $metrics['events_success'] . ' Failure: ' . $metrics['events_failure'] . ' Total: ' . $metrics['events_total'] . '
'; }