PHP scripts to display a more user-friendly overview of nagios status
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

script.js 806B

12345678910111213141516171819202122232425262728293031323334
  1. function update() {
  2. new Ajax.Request(document.location.href, {method: 'get', parameters: {xml: 'true', rand: Math.random() * 1000}, onSuccess: updateResult});
  3. }
  4. function updateResult(transport) {
  5. var xml = transport.responseXML;
  6. var updated = false;
  7. $$('.update').each(function(el) {
  8. try {
  9. var updatable = xml.getElementById(el.id);
  10. if (el.innerHTML != updatable.innerHTML || el.className != updatable.className) {
  11. el.innerHTML = updatable.innerHTML;
  12. el.className = updatable.className + ' updated';
  13. updated = true;
  14. }
  15. } catch (e) {
  16. //alert('Something broke: ' + e);
  17. }
  18. });
  19. if (updated) {
  20. setTimeout(updateCancel, 3000);
  21. }
  22. }
  23. function updateCancel() {
  24. $$('.updated').each(function(el) {
  25. el.removeClassName('updated');
  26. });
  27. }
  28. new PeriodicalExecuter(update, 10);