diff --git a/discovery.php b/discovery.php index 52e4a1722c..cd3ecb9c66 100755 --- a/discovery.php +++ b/discovery.php @@ -21,7 +21,14 @@ if ($options['h'] == "odd") { } elseif ($options['h'] == "all") { $where = " "; $doing = "all"; } elseif($options['h']) { - $where = "AND `device_id` = '".$options['h']."'"; $doing = "Host ".$options['h']; + if (is_numeric($options['h'])) + { + $where = "AND `device_id` = '".$options['h']."'"; $doing = "Host ".$options['h']; + } + else + { + $where = "AND `hostname` LIKE '".str_replace('*','%',mres($options['h']))."'"; $doing = "Host ".$options['h']; + } } elseif ($options['i'] && isset($options['n'])) { $where = "AND MOD(device_id,".$options['i'].") = '" . $options['n'] . "'"; $doing = "Proc ".$options['n'] ."/".$options['i']; } diff --git a/poll-device.php b/poll-device.php index 79ef536ebc..e36ce2694f 100755 --- a/poll-device.php +++ b/poll-device.php @@ -17,7 +17,14 @@ if ($options['h'] == "odd") { } elseif ($options['h'] == "all") { $where = " "; $doing = "all"; } elseif ($options['h']) { - $where = "AND `device_id` = '".$options['h']."'"; $doing = "Host ".$options['h']; + if (is_numeric($options['h'])) + { + $where = "AND `device_id` = '".$options['h']."'"; $doing = "Host ".$options['h']; + } + else + { + $where = "AND `hostname` LIKE '".str_replace('*','%',mres($options['h']))."'"; $doing = "Host ".$options['h']; + } } elseif ($options['i'] && isset($options['n'])) { $where = "AND MOD(device_id,".$options['i'].") = '" . $options['n'] . "'"; $doing = "Proc ".$options['n'] ."/".$options['i']; }