Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Helpful, I hope, EmailReports command lines to use

    Scheduled Pinned Locked Moved pfSense Packages
    1 Posts 1 Posters 682 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      Private User
      last edited by

      I have been working on EmailReports and I thought I would post my solution(s) so that others could make use of them.

      I created a normal daily email report and then added the following to receive the 'Top Sites' report from LightSquid in 'Report Commands';

      /usr/bin/fetch –no-verify-hostname --no-verify-peer -o - https://<ip address="">:<port>/lightsquid/topsites.cgi?$(date -v-1d -v+0m -v+0y "+year=%Y&month=%m&day=%d")

      This gives me yesterdays Top Sites every morning which is exactly what I want.

      And some more;

      /usr/bin/fetch --no-verify-hostname --no-verify-peer -o - https://<ip address="">:<port>/lightsquid/index.cgi

      /usr/bin/fetch --no-verify-hostname --no-verify-peer -o - https://<ip address="">:<port>/lightsquid/group_detail.cgi?$(date -v-1d -v+0m -v+0y"+year=%Y&month=%m&day=%d")

      Then, because I could not figure out how to translate the month number to the month name in Fetch, I moved to PHP when I wanted more detail;

      Four separate files......

      $date = new DateTime();
      $date->add(DateInterval::createFromDateString('yesterday'));
      $result = $date->format('dMY');
      $results = file_get_contents("/usr/pbi/sarg-i386/local/sarg-reports/". $result . "-" . $result ."/index.html", "r");
      echo $results;

      ....
      $results = file_get_contents("/usr/pbi/sarg-i386/local/sarg-reports/". $result . "-" . $result ."/topsites.html", "r");
      echo $results;

      ....
      $results = file_get_contents("/usr/pbi/sarg-i386/local/sarg-reports/". $result . "-" . $result ."/siteuser.html", "r");
      echo $results;

      ....
      $results = file_get_contents("/usr/pbi/sarg-i386/local/sarg-reports/". $result . "-" . $result ."/download.html", "r");
      echo $results;

      I tried combining the four files in the one php script but the html formatting ( HEAD and such ) confused the result so it was easier to make four individual files.

      This all generates a very detailed report of traffic ( done in the 'Report Graphs' section ) and users statistics.</port></ip></port></ip></port></ip>

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.