1/**
2 * Script for plugin_snmplive
3 *
4 * Fetches the new snmpvalues
5 *
6 * @author Andreas Gohr <andi@splitbrain.org>
7 * @author Michael Luggen <michael.luggen@unifr.ch>
8 */
9
10function plugin_snmplive(ip,oid){
11    var snmpId = ip + oid;
12    if(!document.getElementById){
13        return;
14    }
15    var obj = document.getElementById(snmpId);
16    if(obj === null){
17        return;
18    }
19
20    // We use SACK to do the AJAX requests
21    var ajax = new sack(DOKU_BASE+'lib/plugins/snmplive/ajax.php');
22    ajax_qsearch.sack.AjaxFailedAlert = '';
23    ajax_qsearch.sack.encodeURIString = false;
24
25    // define callback
26    ajax.onCompletion = function(){
27        var data = this.response;
28        if(data === ''){ return; }
29        var out = document.getElementById(snmpId);
30
31        out.style.visibility = 'hidden';
32        out.innerHTML = data;
33        out.style.visibility = 'visible';
34
35        // restart timer
36        window.setTimeout("plugin_snmplive('"+ip+"','"+oid+"')",1000);
37    };
38
39    ajax.runAJAX('SNMPip='+encodeURI(ip)+'&SNMPoid='+encodeURI(oid));
40}
41