Sarg on PFSense 2.1 - View graphical results on embedded (Nanobsd)



  • Hello  :)
    I have a little problem with SARG on PFSense 2.1 (Nanobsd - embedded), when I want to view graphical results.
    A long time I searched for an answer and tried to get around this Problem by different tests on my system - but had no luck. So this is my first post here.

    The sarg report directory is changed to an external disk and it works all fine. All reports are generated (Text and graphics)
    Only when I want to see the graph chart, sargs gives me this error message:
    Warning: copy(/usr/local/www/sarg-images/temp/graph_day_byte.243518286.png): failed to open stream: Read-only
    file system in /usr/local/www/sarg_frame.php on line 72

    Here is the line:
    copy("{$dir}/{$prefix}/{$images[1][$x]}.png","/usr/local/www/sarg-images/temp/{$images[1][$x]}.{$rand}.png");

    As we can see, the system wants to copy a file from my reports-folder to /usr/local/www/sarg-images/temp/<filename>.png
    Ok, I know, that the system is running on NanoBSD and Compact flash – therefore, to protect the CF the files system is mounted to
    read only. When I execute "/etc/rc.conf_mount_rw" the error is away, but the file system is permanently unprotected...not what I want.

    May I ask,

    • why the graphic files (*.png) have to be copied to that location?
    • if there is a way to see the graphical logs AND let the file system on read-only state?
      (eg. by  relocate the /usr/local/www/sarg-images/temp/ directory
                                      or
                                      switching the FS to rw while the php needs it?)

    My configuration is

    • Alix Board 2D13
    • PFSense 2.1 Release (pfSense-2.1-RELEASE-4g-i386-nanobsd.img)
    • Squid 2.7.9 pkg v.4.3.3 (Works fine)
      --> Transparent mode
      --> Cache size is set to 0
    • SARG  2.3.6_2 pkg v.0.6.3

    Best regards
    Joerg</filename>



  • Thank for the feedback.  These sarg report calls via php and image copy are there to restrict sarg view to users logged on pfsense gui.

    I'll check code to force a rw before file copy.



  • Oh, that would be great.

    I tried to add this line in sarg_frame.php

    shell_exec('/etc/rc.conf_mount_rw');
    ...

    But this did not work -- Dont know why, but I'm no php programmer  ;)

    Best regards
    Joerg



  • Hello,
    I solved it for me :) :
    In file "/usr/local/www/sarg_frame.phb" ..
        - added a line with "conf_mount_rw();" before the for-loop
        - added a line with "conf_mount_ro();" after    the for-loop

    In file "/usr/local/www/sarg_reports.phb" ..
        - added a line with "conf_mount_rw();" before the line "exec('rm -f /usr/local/www/sarg-images/temp/');"
        - added a line with "conf_mount_ro();" after    the line "exec('rm -f /usr/local/www/sarg-images/temp/
    ');"

    Just for information.

    Best regards
    Joerg



  • I've updated the package to include these changes with no version bump.


Log in to reply