zen.php 725 B

1234567891011121314151617181920212223
  1. <?php
  2. class zahostZen extends zahost
  3. {
  4. /**
  5. * 获取服务状态。
  6. * Get service status from ZAgent server.
  7. *
  8. * @param object $host
  9. * @access public
  10. * @return array
  11. */
  12. public function getServiceStatus($host)
  13. {
  14. if(in_array($host->status, array('wait', 'offline'))) return $this->lang->zahost->init->serviceStatus;
  15. $result = json_decode(commonModel::http("http://{$host->extranet}:{$host->zap}/api/v1/service/check", json_encode(array('services' => 'all')), array(), array("Authorization:$host->tokenSN")));
  16. if(empty($result) || $result->code != 'success') return $this->lang->zahost->init->serviceStatus;
  17. return (array)$result->data;
  18. }
  19. }