getComponents($device_id, $options); $response[] = [ 'id' => '', 'label' => ' ', 'status' => ' ', 'disable' => '', 'ignore' => '', ]; foreach ($COMPONENTS[$device_id] as $ID => $AVP) { if ($AVP['status'] == 0) { $class = "green"; $status = "Ok"; } elseif ($AVP['status'] == 1) { $class = "grey"; $status = "Warning"; } else { // Critical $class = "red"; $status = "Critical"; } $response[] = [ 'id' => $ID, 'type' => $AVP['type'], 'label' => $AVP['label'], 'status' => "" . $status . "", 'disable' => '', 'ignore' => '', ]; }//end foreach $output = [ 'current' => $current, 'rowCount' => $rowCount, 'rows' => $response, 'total' => count($COMPONENTS[$device_id]), ]; echo _json_encode($output);