Helpful, I hope, EmailReports command lines to use



  • 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>


Log in to reply