horde.php 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. if (ubRouting::get('action') == 'horde') {
  3. if (ubRouting::checkGet('devid')) {
  4. $devId = ubRouting::get('devid', 'int');
  5. if (!empty($devId)) {
  6. $allTemplates = sp_SnmpGetAllModelTemplates();
  7. $allTemplatesAssoc = sp_SnmpGetModelTemplatesAssoc();
  8. $allDeadSwitches = zb_SwitchesGetAllDead();
  9. $allUserMacs = array();
  10. $allAddress = array();
  11. $devData = zb_SwitchGetData($devId);
  12. if (!empty($devData)) {
  13. if (ispos($devData['desc'], 'SWPOLL')) {
  14. if (isset($allTemplatesAssoc[$devData['modelid']])) {
  15. //dont poll dead devices
  16. if (!isset($alldeadswitches[$devData['ip']])) {
  17. $deviceTemplate = $allTemplatesAssoc[$devData['modelid']];
  18. sp_SnmpPollDevice($devData['ip'], $devData['snmp'], $allTemplates, $deviceTemplate, $allUserMacs, $allAddress, $devData['snmpwrite'], true);
  19. }
  20. }
  21. }
  22. }
  23. die('OK:HORDE');
  24. } else {
  25. die('ERROR:EMPTY_DEVID');
  26. }
  27. } else {
  28. die('ERROR:NO_DEVID');
  29. }
  30. }