json bug fix
[svn/Prometheus-QoS/.git] / prometheus.c
index 8c70bb0b86e7340f2feff6f13b3a1c47302fc75e..6aaa3c78869793a9c3042eb18a6e5bc0e5fb8235 100644 (file)
@@ -7,7 +7,7 @@
 /*  Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf  */\r
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */\r
 \r
-/* Modified by: xChaos, 20120516\r
+/* Modified by: xChaos, 20120610\r
                  ludva, 20080415\r
  \r
    Prometheus QoS is free software; you can redistribute it and/or\r
@@ -33,7 +33,7 @@
 \r
 #include "cll1-0.6.2.h"\r
 \r
-const char *version = "0.8.3-d";\r
+const char *version = "0.8.3-e";\r
 \r
 /* Version numbers: 0.8.3 is development releases ("beta"), 0.8.4 will be "stable" */\r
 /* Debian(RPM) package versions/patchlevels: 0.7.9-2, 0.8.0-1, 0.8.0-2, etc. */\r
@@ -58,7 +58,7 @@ char          *credit = "/var/lib/misc/prometheus.credit"; /* credit log file */
 char        *classmap = "/var/lib/misc/prometheus.classes"; /* credit log file */\r
 char            *html = "/var/www/traffic.html"; /* hall of fame - html version */\r
 char         *preview = "/var/www/preview.html"; /* hall of fame preview */\r
-char            *json = "/var/www/traffic.json"; /* hall of fame - json version */\r
+char            *json = "/var/www/logs/traffic.json"; /* hall of fame - json version */\r
 char          *cmdlog = "/var/log/prometheuslog"; /* command log filename */\r
 char         *log_dir = "/var/www/logs/"; /* log directory pathname, ended with slash */\r
 char         *log_url = "/logs/"; /* log directory relative URI prefix (partial URL) */\r
@@ -1649,17 +1649,17 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
    fprintf(f, "{\n");\r
    for_each(ip, ips)\r
    {\r
-    if(jsoncount)\r
-    {\r
-     fprintf(f, ",\n");\r
-    }\r
     if(     ip->lmsid > 0 \r
         && (ip->traffic || ip->direct || ip->proxy || ip->upload))\r
     {\r
-     fprintf(f, " %d:{ \"ip\":\"%s\", \"total\":%Lu, \"down\":%Lu, \"proxy\":%Lu, \"up\":%Lu }",\r
-                ip->lmsid, ip->addr, ip->traffic, ip->direct, ip->proxy, ip->upload);\r
+     if(jsoncount)\r
+     {\r
+      fprintf(f, ",\n");\r
+     }\r
+     fprintf(f, " \"%s\":{ \"lms\": %d, \"ip\":\"%s\", \"total\":%Lu, \"down\":%Lu, \"proxy\":%Lu, \"up\":%Lu }",\r
+                ip->name, ip->lmsid, ip->addr, ip->traffic, ip->direct, ip->proxy, ip->upload);\r
+     jsoncount++;\r
     }\r
-    jsoncount++;\r
    }\r
    fprintf(f, "}\n");\r
    fclose(f);\r
This page took 0.09842 seconds and 4 git commands to generate.