Deprecate stats table in favor of prometheus integration

This commit is contained in:
Calvin Montgomery 2017-07-17 21:58:58 -07:00
parent c7bec6251e
commit e780e7dadb
14 changed files with 93 additions and 1583 deletions

View file

@ -34,7 +34,6 @@ addMenuItem("#acp-user-lookup", "Users");
addMenuItem("#acp-channel-lookup", "Channels");
addMenuItem("#acp-loaded-channels", "Active Channels");
addMenuItem("#acp-eventlog", "Event Log");
addMenuItem("#acp-stats", "Stats");
/* Log Viewer */
function readSyslog() {
@ -541,79 +540,6 @@ function filterEventLog() {
$("#acp-eventlog-filter").change(filterEventLog);
$("#acp-eventlog-refresh").click(readEventlog);
/* Stats */
$("a:contains('Stats')").click(function () {
socket.emit("acp-list-stats");
});
socket.on("acp-list-stats", function (rows) {
var labels = [];
var ucounts = [];
var ccounts = [];
var mcounts = [];
var lastdate = "";
rows.forEach(function (r) {
var d = new Date(parseInt(r.time));
var t = "";
if (d.toDateString() !== lastdate) {
lastdate = d.toDateString();
t = d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
t += " " + d.toTimeString().split(" ")[0];
} else {
t = d.toTimeString().split(" ")[0];
}
labels.push(t);
ucounts.push(r.usercount);
ccounts.push(r.chancount);
mcounts.push(r.mem / 1048576);
});
var userdata = {
labels: labels,
datasets: [
{
fillColor: "rgba(151, 187, 205, 0.5)",
strokeColor: "rgba(151, 187, 205, 1)",
pointColor: "rgba(151, 187, 205, 1)",
pointStrokeColor: "#fff",
data: ucounts
}
]
};
var channeldata = {
labels: labels,
datasets: [
{
fillColor: "rgba(151, 187, 205, 0.5)",
strokeColor: "rgba(151, 187, 205, 1)",
pointColor: "rgba(151, 187, 205, 1)",
pointStrokeColor: "#fff",
data: ccounts
}
]
};
var memdata = {
labels: labels,
datasets: [
{
fillColor: "rgba(151, 187, 205, 0.5)",
strokeColor: "rgba(151, 187, 205, 1)",
pointColor: "rgba(151, 187, 205, 1)",
pointStrokeColor: "#fff",
data: mcounts
}
]
};
new Chart($("#stat_users")[0].getContext("2d")).Line(userdata);
new Chart($("#stat_channels")[0].getContext("2d")).Line(channeldata);
new Chart($("#stat_mem")[0].getContext("2d")).Line(memdata);
});
/* Initialize keyed table sorts */
$("table").each(function () {
var table = $(this);

File diff suppressed because it is too large Load diff