data['allowed_sockets'] ?? []; $allowed_afs = $app->data['allowed_afs'] ?? []; /** * Builds the graphs variable * * @param string $gen_type * @param associative-array $ss_netid_mapper * @param array $graphs * @return $graphs */ function ss_graph_builder($gen_type, $ss_netid_mapper, $allowed_sockets, $graphs) { $graph_name = 'ss_' . $gen_type; $graphs[$graph_name]['type'] = $gen_type; // Build graphs for socket types and the netlink address family. if (! array_key_exists($gen_type, $ss_netid_mapper)) { $graph_descr = strtoupper($gen_type) . ' Sockets\' Statuses'; $graphs[$graph_name]['desc'] = $graph_descr; } else { // Build graphs for address family's netids. foreach ($ss_netid_mapper[$gen_type] as $netid) { // Don't build graphs for socket types (netids) // that have been filtered out. if (! in_array($netid, $allowed_sockets)) { continue; } $graph_descr = strtoupper($gen_type) . ' ' . strtoupper($netid) . ' Sockets\' Statuses'; $graphs[$graph_name]['netid_statuses'][$netid]['desc'] = $graph_descr; } } return $graphs; } /** * Builds a graph array and outputs the graph. * * @param string $gen_type * @param string $app_id * @param null|string $netid * @param string $graph_desc */ function ss_graph_printer($gen_type, $app_id, $netid, $graph_desc) { $graph_type = $gen_type; $graph_array['height'] = '100'; $graph_array['width'] = '215'; $graph_array['to'] = time(); $graph_array['id'] = $app_id; $graph_array['type'] = 'application_' . $gen_type; if (! is_null($netid)) { $graph_array['netid'] = $netid; } echo '