Page 1 of 1

NCPA Adding Custom Data to the Web Page

Posted: Sun Nov 02, 2014 8:00 am
by mikew
What do I need to know in order to add custom data on the web page for NCPA on a host. I am working with a company that wants to add serveral custom graphics for data on the web page.

I can see in the source that there are several functions that create the current data. Can I just write a custom function and add it to this page:

Code: Select all

function load_interface() {
    var interface_div = $('#interface');
    var INTERFACE_API = '/api/interface/';
    var INTERFACE_BASE = '/graph/interface/';
    var metrics = ['bytes_recv', 'bytes_sent'];
    
    $.getJSON(INTERFACE_API, function(d) {
        $.each(d.value['interface'], function(key) {
            var sent = INTERFACE_BASE + key + '/bytes_sent?delta=1&unit=K';
            var recv = INTERFACE_BASE + key + '/bytes_recv?delta=1&unit=K';
            interface_div.append($('<div>').load(sent));
            interface_div.append($('<div>').load(recv));
        })
    })
}
Any information on what I need to do would be helpful....

Re: NCPA Adding Custom Data to the Web Page

Posted: Mon Nov 03, 2014 4:23 pm
by abrist
You will most likely have much better luck getting this answer on the ncpa github page: https://github.com/NagiosEnterprises/ncpa