/* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf */\r
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */\r
\r
/* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf */\r
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */\r
\r
-/* Modified by: xChaos, 20120610\r
+/* Modified by: xChaos, 20120612\r
ludva, 20080415\r
\r
Prometheus QoS is free software; you can redistribute it and/or\r
ludva, 20080415\r
\r
Prometheus QoS is free software; you can redistribute it and/or\r
char *credit = "/var/lib/misc/prometheus.credit"; /* credit log file */\r
char *classmap = "/var/lib/misc/prometheus.classes"; /* credit log file */\r
char *html = "/var/www/traffic.html"; /* hall of fame - html version */\r
char *credit = "/var/lib/misc/prometheus.credit"; /* credit log file */\r
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 *preview = "/var/www/preview.html"; /* hall of fame preview - html version */\r
char *json = "/var/www/logs/traffic.json"; /* hall of fame - json version */\r
char *json = "/var/www/logs/traffic.json"; /* hall of fame - json version */\r
+char *json_preview = "/var/www/logs/preview.json"; /* hall of fame preview - 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
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
option("hall-of-fame-filename",html);\r
option("json-filename",json);\r
option("hall-of-fame-preview",preview);\r
option("hall-of-fame-filename",html);\r
option("json-filename",json);\r
option("hall-of-fame-preview",preview);\r
+ option("json-preview",json_preview);\r
option("log-filename",cmdlog);\r
option("credit-filename",credit);\r
option("classmap-filename",classmap);\r
option("log-filename",cmdlog);\r
option("credit-filename",credit);\r
option("classmap-filename",classmap);\r
}\r
done; /* ugly macro end */\r
}\r
}\r
done; /* ugly macro end */\r
}\r
- f=fopen(preview,"w");\r
- ptr=preview; \r
+ html=preview;\r
+ json=json_preview;\r
- else if(!dry_run && !just_flush)\r
+\r
+ if(!dry_run && !just_flush)\r
{\r
/*-----------------------------------------------------------------*/\r
{\r
/*-----------------------------------------------------------------*/\r
- printf("Writing daily statistics %s ... ", json);\r
+ printf("Writing json overview %s ... ", json);\r
/*-----------------------------------------------------------------*/\r
f=fopen(json, "w");\r
if(f > 0)\r
/*-----------------------------------------------------------------*/\r
f=fopen(json, "w");\r
if(f > 0)\r
{\r
fprintf(f, ",\n");\r
}\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
+ fprintf(f, " \"%s\":{ \"lms\": %d, \"ip\":\"%s\", \"total\":%Lu, \"down\":%Lu, \"proxy\":%Lu, \"up\":%Lu, \"min\":%d, \"max\":%d, \"limit\":%d }",\r
+ ip->name, ip->lmsid, ip->addr, ip->traffic, ip->direct, ip->proxy, ip->upload, ip->min, ip->desired, ip->max);\r
- f=fopen(html,"w");\r
- ptr=html;\r
+ f=fopen(html,"w");\r
+ if(f > 0)\r
{\r
int count=1;\r
i=0;\r
\r
/*-----------------------------------------------------------------*/\r
{\r
int count=1;\r
i=0;\r
\r
/*-----------------------------------------------------------------*/\r
- printf("Sorting data and generating statistics page %s ...\n", ptr);\r
+ printf("Sorting data and generating statistics page %s ...\n", html);\r
/*-----------------------------------------------------------------*/\r
\r
if(use_jquery_popups)\r
/*-----------------------------------------------------------------*/\r
\r
if(use_jquery_popups)\r
{\r
unsigned long long total_traffic=0, total_direct=0, total_proxy=0, total_upload=0, tmp_sum=0;\r
int active_classes=0;\r
{\r
unsigned long long total_traffic=0, total_direct=0, total_proxy=0, total_upload=0, tmp_sum=0;\r
int active_classes=0;\r
{\r
fprintf(f, "%s %d\n", ip->addr, ip->mark);\r
}\r
{\r
fprintf(f, "%s %d\n", ip->addr, ip->mark);\r
}\r
{\r
puts("done.");\r
fclose(f);\r
{\r
puts("done.");\r
fclose(f);\r