Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require '../autoload.php';
- $Config = new Config();
- $datas = array();
- if (count($Config->get('ping:hosts')) > 0)
- $hosts = $Config->get('ping:hosts');
- foreach ($hosts as $host)
- {
- exec('/bin/ping -c 1 '.$host.' | awk -F/ \'/^rtt/ { print $5 }\'', $result);
- if (!isset($result[0]))
- {
- $result[0] = 0;
- }
- $datas[] = array(
- 'host' => $host,
- 'ping' => $result[0],
- );
- unset($result);
- }
- echo json_encode($datas);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement