I know some of you like me use GitHub - IIPoliII/ServerStatus: Display and monitor your servers statistics in a beatiful way (or botox one)
But I was wondering if someone has an idea of how I could do it to add the value of every bandwidth.
This is really a specific part of the code, but i know that some of you are more skilled than me in JS. I litterlay don’t know why but JS is the language i definitly can’t fucking read.
Why don’t you just cat /sys/class/net/eth0/statistics/rx_bytes on the clients rather than using a counter which will be highly unreliable, even if your refresh rate is set to 1 second.
Have you considered using Netdata? You should be able to do something like this with it, either through its customizable JS widgets or by directly hitting its API.
Just curious what exactly you’re trying to do here since I also use the ServerStatus program (https://status.rowe.sh/). Are you just trying to total up the current bandwidth of ALL servers into one metric and display that?
When you pass this parameter, the installer does not download or compile any extra libraries. Once running, the Agent kills the thread responsible for the ACLK and claiming behavior, and behaves as though the ACLK, and thus Netdata Cloud, does not exist.
Niether i am really bad or i didn’t understood something so right i should declare my function then i call it every time the json is updated but what does $('[id="network"]').each(function () { define?
I will try my way around but god damn js is really not my cup of tea. It’s weird i had no big issues understand Go or Java it self. But JS like what?
I am really thank ful for your work Andrei and this page doesn’t mean we stop using hetrixtools it’s an addition to it c: I find it awesome you help me set it up.
Yes, declare it in the serverstatus.js file and call it in the uptime() function when the json file is fetched.
It’s jQuery to parse the network values on the page by looping over all the network row values on the page. Personally, I would use the ‘result’ variable in uptime(), which holds the raw json results, rather than getting what’s on the page.
As @Manson said that bit of code gets the network values from your status page and then for each of them it figures out the in/out traffic and adds that up.
Reading the data from what’s on the page already I would load it after the page has finished loading and I’d then call it after new data is pushed by whatever function pushes data into the page from the stats json.
Yeah i see. I will try to change a bit to have the raw json values. But sadly i don’t exactly understand on how i could do it. Since i need to loop trought each values. And add them it looks easy like doing bw_in = result.servers[i].network_rx + bw_in but didn’t exactly worked for me