X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=prometheus.c;h=6aaa3c78869793a9c3042eb18a6e5bc0e5fb8235;hb=a7e55d860299849e031ce7997aca053223160bb3;hp=8301c0d9c8497ffe5b410a19b33c7301a6522976;hpb=457d52f2dac219d386fc50ffca07b73e85da48d7;p=svn%2FPrometheus-QoS%2F.git diff --git a/prometheus.c b/prometheus.c index 8301c0d..6aaa3c7 100644 --- a/prometheus.c +++ b/prometheus.c @@ -7,7 +7,7 @@ /* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* Modified by: xChaos, 20120516 +/* Modified by: xChaos, 20120610 ludva, 20080415 Prometheus QoS is free software; you can redistribute it and/or @@ -33,7 +33,7 @@ #include "cll1-0.6.2.h" -const char *version = "0.8.3-d"; +const char *version = "0.8.3-e"; /* Version numbers: 0.8.3 is development releases ("beta"), 0.8.4 will be "stable" */ /* Debian(RPM) package versions/patchlevels: 0.7.9-2, 0.8.0-1, 0.8.0-2, etc. */ @@ -58,7 +58,7 @@ char *credit = "/var/lib/misc/prometheus.credit"; /* credit log file */ char *classmap = "/var/lib/misc/prometheus.classes"; /* credit log file */ char *html = "/var/www/traffic.html"; /* hall of fame - html version */ char *preview = "/var/www/preview.html"; /* hall of fame preview */ -char *json = "/var/www/traffic.json"; /* hall of fame - json version */ +char *json = "/var/www/logs/traffic.json"; /* hall of fame - json version */ char *cmdlog = "/var/log/prometheuslog"; /* command log filename */ char *log_dir = "/var/www/logs/"; /* log directory pathname, ended with slash */ char *log_url = "/logs/"; /* log directory relative URI prefix (partial URL) */ @@ -1649,16 +1649,17 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); fprintf(f, "{\n"); for_each(ip, ips) { - if(jsoncount) + if( ip->lmsid > 0 + && (ip->traffic || ip->direct || ip->proxy || ip->upload)) { - fprintf(f, ",\n"); - } - if(ip->traffic || ip->direct || ip->proxy || ip->upload) - { - fprintf(f, " %d:{ \"ip\":\"%s\", \"total\":%Lu, \"down\":%Lu, \"proxy\":%Lu, \"up\":%Lu }", - ip->lmsid, ip->addr, ip->traffic, ip->direct, ip->proxy, ip->upload); + if(jsoncount) + { + fprintf(f, ",\n"); + } + fprintf(f, " \"%s\":{ \"lms\": %d, \"ip\":\"%s\", \"total\":%Lu, \"down\":%Lu, \"proxy\":%Lu, \"up\":%Lu }", + ip->name, ip->lmsid, ip->addr, ip->traffic, ip->direct, ip->proxy, ip->upload); + jsoncount++; } - jsoncount++; } fprintf(f, "}\n"); fclose(f);