/** * Query Asterisk for details via SNMP */ public function ajaxGetForHostAction() { $host = $this->_getParam('host', null); if ($host) { $device = new \OSS_SNMP\SNMP($host, $this->_options['community']); $details['astVersion'] = $device->useAsterisk()->version(); $details['astTag'] = $device->useAsterisk()->tag(); $details['astUptime'] = $this->_timeticksToString($device->useAsterisk()->uptime()); $details['astReload'] = $this->_timeticksToString($device->useAsterisk()->reloadTime()); $details['astCallsProcessed'] = $device->useAsterisk()->callsProcessed(); $details['astCallsActive'] = $device->useAsterisk()->callsActive(); $details['calls'] = $device->useAsterisk_Channels()->channelDetails(true); unset($device); $this->getResponse()->setHeader('Content-Type', 'application/json')->setBody(Zend_Json::encode($details))->sendResponse(); exit(0); } }
- the IP address of hostname of a SNMP capable host (with Asterisk SNMP enabled) - the SNMP v2 community string for that host For example: {$argv[0]} 192.168.10.20 public HELPTEXT; exit(1); } require_once dirname(__FILE__) . '/../OSS_SNMP/SNMP.php'; $host = new \OSS_SNMP\SNMP($argv[1], $argv[2]); echo "\n\n"; echo "Asterisk version running on {$argv[1]}: " . $host->useAsterisk()->version() . "\n"; echo "Asterisk SVN tag running on {$argv[1]}: " . $host->useAsterisk()->tag() . "\n"; echo "Asterisk on {$argv[1]} up for: " . $host->useAsterisk()->uptime() / 100 / 60 / 60 . " hours\n"; echo "Asterisk on {$argv[1]} reloaded: " . $host->useAsterisk()->reloadTime() / 100 / 60 / 60 . " hours ago\n"; echo "Asterisk PID: " . $host->useAsterisk()->pid() . "\n"; echo "Asterisk control socket: " . $host->useAsterisk()->controlSocket() . "\n"; echo "Calls active: " . $host->useAsterisk()->callsActive() . "\n"; echo "Calls processed: " . $host->useAsterisk()->callsProcessed() . "\n"; echo "Modules compiled in: " . $host->useAsterisk()->modules() . "\n"; echo "\n\n"; echo "Indications defined: " . $host->useAsterisk_Indications()->number() . "\n"; echo "Default indications zone: " . $host->useAsterisk_Indications()->defaultZone() . "\n"; echo "Indication country codes:\n\n"; print_r($host->useAsterisk_Indications()->countryCodes()); echo "\n\n"; echo "Indication descriptions:\n\n";