Skip to content

Commit 9ae9a5c

Browse files
committed
Add ASN support
1 parent 08c52ca commit 9ae9a5c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Remove the allow/deny lines in `/config/nginx/proxy-confs/dashboard.subdomain.co
3232
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
3333
```
3434
- Either [Swag Maxmind mod](https://github.com/linuxserver/docker-mods/tree/swag-maxmind) or [Swag DBIP mod](https://github.com/linuxserver/docker-mods/tree/swag-dbip) are required to enable the geo location graph.
35+
- Either Maxmind's or DB-IP's ASN mmdb are required under `/config/geoip2db/asn.mmdb` to enable the ASN graph.
3536
- To clear the dashboard stats, you must remove the logs (/config/log/nginx) and **recreate** the container.
3637

3738
## Dashboard Support

root/dashboard/www/index.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ function GetLinks() {
280280
}
281281

282282
function GetGoaccess() {
283+
$geodb = '';
283284
$dbip = '/config/geoip2db/dbip-country-lite.mmdb';
284285
$maxmind = '/config/geoip2db/GeoLite2-City.mmdb';
285286
if (file_exists($dbip) and file_exists($maxmind)):
@@ -288,12 +289,16 @@ function GetGoaccess() {
288289
$geodb = '--geoip-database='.$dbip;
289290
elseif (file_exists($maxmind)):
290291
$geodb = '--geoip-database='.$maxmind;
291-
else:
292-
$geodb = '';
292+
endif;
293+
294+
$asndb = '';
295+
$asn = '/config/geoip2db/asn.mmdb';
296+
if (file_exists($asn)):
297+
$asndb = '--geoip-database='.$asn;
293298
endif;
294299

295300
$access_log = file_exists("/dashboard/logs") ? "/dashboard/logs/*.log" : "/config/log/nginx/access.log";
296-
$goaccess = shell_exec("cat $access_log | /usr/bin/goaccess -a -o html --config-file=/dashboard/goaccess.conf $geodb -");
301+
$goaccess = shell_exec("cat $access_log | /usr/bin/goaccess -a -o html --config-file=/dashboard/goaccess.conf $geodb $asndb -");
297302
$goaccess = str_replace("<title>Server&nbsp;Statistics", "<title>SWAG&nbsp;Dashboard", $goaccess);
298303
$goaccess = str_replace("<h1 class='h-dashboard'>", "<h1>", $goaccess);
299304
$goaccess = str_replace("<i class='fa fa-tachometer'></i>", "<img src='/icon.svg' width='32' height='32'>&nbsp;SWAG&nbsp;", $goaccess);

0 commit comments

Comments
 (0)