'; echo '

Welcome to your new Observium dashboard!

'; if(isset($mod['vars']['converted'])) { echo 'This was autogenerated based on your previous front page. It can be modified to suit your requirements.
'; } else { echo 'This is an autogenerated default dashboard. It can be modified to suit your requirements.
'; } echo 'Please see the documentation for information about how to configure this dashboard. Including how to delete this widget!'; echo ''; break; case "weathermap": echo '
'; $wmap = dbFetchRow("SELECT * FROM `weathermaps` WHERE `wmap_name` = ?", array($mod['vars']['mapname'])); echo '

' . '' . htmlentities($wmap['wmap_name']) . '

' . '
' . PHP_EOL; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo '
'; echo '
'; echo '
'; break; case "map": echo '
'; print_dash_map($mod, $width, $height); echo '
'; break; case "graph": echo '
'; print_dash_graph($mod, $width, $height); echo '
'; break; case "port_percent": if($_SESSION['userlevel'] < 5) { echo '
'; echo '
'; echo '
You have insufficient permissions to view this widget.
'; echo '
'; echo '
'; } elseif ($height < 190) { echo '
'; echo 'WARNING This widget is not tall enough to display the requested content. Module Port Percent requires 190px or taller.'; echo '
'; } else { include($config['html_dir'] . "/includes/status-portpercent.inc.php"); } break; case "alert_table": echo '
'; echo '

Alert Status

'; echo '
'; print_alert_table(array('status' => 'failed', 'pagination' => FALSE, 'short' => TRUE) ); echo '
'; echo '
'; echo ''; break; case "status_summary": echo '
'; if($width > 1000) { $div_class = "col-md-6"; } else { $div_class = "col-md-12"; } if($height < 210) { $hide_group_bar = 1; } include($config['html_dir'] . '/includes/cache-data.inc.php'); include($config['html_dir'] . "/includes/status-summary.inc.php"); echo '
'; break; case "alert_boxes": case "old_status_boxes": //r($height); include($config['html_dir'] . '/includes/cache-data.inc.php'); //$count = round(($width) / 165) * round(($height+10) / 90); // 1.5 wide $count = floor(($width+10) / 198) * floor(($height+10) / 96); // 1.5 wide echo '
'; if($mod['widget_type'] == 'alert_boxes') { print_status_boxes($mod, $count); } else { print_status_boxes($config['frontpage']['device_status'], $count); } echo '
'; break; case "old_status_table": echo '
'; echo '

Status Warnings and Notifications

'; echo '
'; include($config['html_dir'] . '/includes/cache-data.inc.php'); echo generate_status_table($config['frontpage']['device_status']); echo generate_box_close(); break; case "status_donuts": include($config['html_dir'] . "/includes/status-donuts.inc.php"); break; case "syslog": echo '
'; echo ' '; echo '
'; print_syslogs(array('short' => TRUE, 'pagesize' => ($height - 36) / 26, 'priority' => $config['frontpage']['syslog']['priority'])); echo '
'; echo '
'; break; case "syslog_alerts": echo '
'; echo ' '; echo '
'; print_logalert_log(array('short' => TRUE, 'pagesize' => ($height - 36) / 26) ); echo '
'; echo '
'; break; case "alertlog": echo '
'; echo ' '; echo '
'; print_alert_log_short(array('short' => TRUE, 'pagesize' => ($height - 36) / 26)); echo '
'; echo '
'; break; case "eventlog": echo '
'; echo ' '; echo '
'; $pagesize = floor(($height - 36) / 26); //if($width > 1000) { $pagesize -= 3; $short = FALSE; } else { $short = TRUE; } print_events(array('short' => TRUE, 'pagesize' => $pagesize, 'pageno' => 1, 'severity' => $config['frontpage']['eventlog']['severity'])); echo '
'; echo '
'; break; case "realtime": echo '
'; $realtime_link = 'graph-realtime.php?type=bits&id=430082&interval=10'; ?> Your browser does not support SVG! You need to either use Firefox or Chrome, or download the Adobe SVG plugin. '; break; default: echo '
'; echo '
'; echo '

Unconfigured Module

'; echo '
'; echo '
'; break; } //echo '
'; } function print_dash_map ($vars, $width, $height) { global $config; ?>
'; include($config['html_dir']. '/includes/map/leaflet.inc.php'); } // End show_map function print_dash_graph($mod, $width, $height) { global $config; $vars = $mod['vars']; if (!isset($vars['type'])) { echo '
  Select Graph
'; exit(); } if (isset($vars['timestamp_from']) && preg_match(OBS_PATTERN_TIMESTAMP, $vars['timestamp_from'])) { $vars['from'] = strtotime($vars['timestamp_from']); unset($vars['timestamp_from']); } if (isset($vars['timestamp_to']) && preg_match(OBS_PATTERN_TIMESTAMP, $vars['timestamp_to'])) { $vars['to'] = strtotime($vars['timestamp_to']); unset($vars['timestamp_to']); } // Period alone is sufficient /* if (isset($vars['period'])) { $vars['to'] = "now"; $vars['from'] = "-".$vars['period']; } if (!isset($vars['from'])) { $vars['from'] = $config['time']['day']; } if (!isset($vars['to'])) { $vars['to'] = $config['time']['now']; } */ preg_match('/^(?P[a-z0-9A-Z-]+)_(?P.+)/', $vars['type'], $graphtype); if (OBS_DEBUG) { print_vars($graphtype); } $type = $graphtype['type']; $subtype = $graphtype['subtype']; if (is_numeric($vars['device'])) { $device = device_by_id_cache($vars['device']); } elseif (!empty($vars['device'])) { $device = device_by_name($vars['device']); } elseif ($type === "device" && is_numeric($vars['id'])) { $device = device_by_id_cache($vars['id']); } $preserve_id = $vars['id']; if (is_file($config['html_dir'] . "/includes/graphs/" . $type . "/auth.inc.php")) { include($config['html_dir'] . "/includes/graphs/" . $type . "/auth.inc.php"); } $vars['id'] = $preserve_id; if (!$auth) { print_error_permission(); return; } if (isset($config['entities'][$type])) { $entity = get_entity_by_id_cache($type, $vars['id']); entity_rewrite($type, $entity); } if ($type === 'bgp') { $entity = get_entity_by_id_cache('bgp_peer', $vars['id']); entity_rewrite('bgp_peer', $entity); } //$device = device_by_id_cache($entity['device_id']); //$graph_array['type'] = $vars['entity_type'] . '_' . $vars['graph_type']; //$graph_array['id'] = $vars['entity_id']; // Generate navbar with subtypes $graph_array = $vars; //$graph_array['from'] = '-1day'; //$graph_array['to'] = 'now'; $graph_array['width'] = $width - 76 + 14; // RRD graphs are 75px wider than request value $graph_array['height'] = $height - 34; //68; // RRD graphs are taller than request value if ($graph_array['width'] > 350) { $graph_array['width'] -= 6; } // RRD graphs > 350px are 6 px wider because of larger legend font if ($graph_array['width'] > 350) { $graph_array['height'] -= 6; } // RRD graphs > 350px are 6 px wider because of larger legend font $title_div = 'top:0px; left: 0px; padding: 4px; border-top-left-radius: 4px; border: 1px solid #e5e5e5; border-left: none; border-top: none; background-color: rgba(255, 255,255, 0.75); '; $title_div = 'widget-title'; if ($height < 100) { $graph_array['height'] = $height; $graph_array['width'] = $width; $graph_array['graph_only'] = 'yes'; $title_div = 'top:5px; left: 5px; padding: none; border-radius: 2px; border: 1px solid #e5e5e5; background: rgba(255, 255, 255, 0.7);'; $title_div = 'widget-title-small'; } else { $graph_array['draw_all'] = 'yes'; } $t_len = $vars['width'] / 10; $subtype_text = (isset($config['graph_types'][$type][$subtype]) ? $config['graph_types'][$type][$subtype]['descr'] : nicecase($subtype)); if (!isset($graph_array['title'])) { if ($type === 'global') { $title = "Global :: " . $subtype_text; } elseif (str_contains($type, "multi")) { $count = safe_count($graph_array['id']); $title = $count . ' ' . nicecase(str_replace("multi-", '', $type)) . ' :: ' . $subtype_text; } else { $title = device_name($device, $t_len / 2 - 2) . ($type === "device" ? ' :: ' : ' :: ' . truncate($entity['entity_shortname'], 32) . ' :: ' ) . $subtype_text; } } else { $title = $graph_array['title']; unset($graph_array['title']); } //$graph_array['format'] = 'png'; //$graph_array['img_id'] = generate_random_string(5); $graph_array['legend'] = 'no'; $graph_array['class'] = 'image-refresh'; $graph = generate_graph_tag($graph_array, TRUE); $link_array = $graph_array; $link_array['page'] = "graphs"; unset($link_array['graph_only']); unset($link_array['height'], $link_array['width']); $link = generate_url($link_array); //echo '
' . $device['hostname'] . '' . truncate($entity['entity_name'], 32) . '
'; echo '

' . '' . escape_html($title) . '

' . '
' . PHP_EOL; echo '
'; echo '
'; echo ''.$graph['img_tag'].''; echo '
'; echo '
'; } // EOF