1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

Save traffic history on computer shared folder

Discussion in 'Asuswrt-Merlin' started by hazardass, Apr 16, 2018.

  1. hazardass

    hazardass Occasional Visitor

    Joined:
    Aug 24, 2015
    Messages:
    18
    Hello, I cannot find info about this anywhere including the manual here:
    https://github.com/RMerl/asuswrt-merlin/wiki/Enhanced-Traffic-monitoring

    Everything is about saving traffic log to router memory or USB drive. I want to save it to a shared folder on my computer, just like I used to with a Linkys WRT router.

    I shared a folder on my pc, but I can't figure out the syntax for the location in the router settings. I tried:
    //192.168.1.237/Router_history/ but I don't see any files being created in that folder. I also don't get any error messages, even if I enter an invalid address, so it's hard to tell if I'm doing something wrong. I've attached a screenshot.
    My old Linksys router would tell me if it was invalid.

    [​IMG]

    What am I doing wrong? Btw I've seen screenshots on other threads that show a "Browse" button next to the location box, but I don't have that button. Why don't I have it?

    Thank you very much!
    RT-N66U
     

    Attached Files:

    Last edited: Apr 17, 2018
  2. Please support SNBForums! Just click on this link before you buy something from Amazon and we'll get a small commission on anything you buy. Thanks!
  3. joegreat

    joegreat Very Senior Member

    Joined:
    Jan 9, 2013
    Messages:
    1,678
    Location:
    Vienna, Austria
    You should mount the remote (PC shared) folder before usage (on command line) and then you can select and use it like a router internal drive - the path you specified requires a mount before it can be used and via the GUI/location information it does not work.

    To make it sticky after reboot the mount command should go into one of the user scripts (suggest post-mount or service-start).
     
  4. hazardass

    hazardass Occasional Visitor

    Joined:
    Aug 24, 2015
    Messages:
    18
    on the merlin wiki there is a section about user scripts, but none of that actually explains how or where to enter them. I've never worked with scripts. That wiki is really doesn't explain the basics so i'm searching other guides. Where do I even go to enter a script? It seems that kind of info is just hidden to the average user.

    If someone feels a little more generous with information about the basics, that would be great. Thanks.
     
  5. hazardass

    hazardass Occasional Visitor

    Joined:
    Aug 24, 2015
    Messages:
    18
    OK, this is what I did:
    • In the router (RT-N66U, 380.70, factory default) under Admin/System, I enabled:
    -"Enable JFFS custom scripts and configs"
    -"Enable SSH" (LAN+WAN)
    -"Enable Telnet"
    • I got WinSCP. I created the 'services-start' file under /jffs/scripts/, and entered those two lines shown in the screenshot below. (with the real credentials)
    • I rebooted router, but nothing happened as far as I can tell. I don't even know what should happen if the mount is successfull. How can I tell if it's mounted?
    [​IMG]

    I have a couple of questions, if I may

    1) Does the syntax above look correct?
    Here, 'Router_history' is a shared folder I created on my D: drive on my PC (192.168.1.237). Do I need to include the 'D:' drive name somewhere in the path?

    The template in the wiki isn't quite clear. It says:
    mount \\\\192.168.1.100\\ShareName /cifs1 -t cifs -o "username=User,password=Pass"
    , but it doesn't explain what is 'ShareName' exactly, is it the actual shared folder name, or is the drive name, or is it the complete path to that shared folder.
    So, the question is, what exactly should I mount here: just the computer root, or the full path to the shared folder?

    2) Then, what exactly do I enter under Tools/Other Tools in the router menu? What is the syntax? The only examples for this part are for USB flash drive, not for a shared network folder.

    [​IMG]

    3) How do I know if it worked? I looked in the folder but there is nothing there. If it works, should I see a new file right away?

    Thanks to anyone willing to lend a hand.
     
    Last edited: Apr 17, 2018
  6. hazardass

    hazardass Occasional Visitor

    Joined:
    Aug 24, 2015
    Messages:
    18
    Does nobody store their traffic history on a shared folder on their PC? :-( Any word of advice, or an example would be greatly appreciated. Please help.
     
  7. joegreat

    joegreat Very Senior Member

    Joined:
    Jan 9, 2013
    Messages:
    1,678
    Location:
    Vienna, Austria
    Nope, and no reason to do it! :rolleyes:

    I run Traffic History now for years and store it on the router - the zip file with all the stored history is less then 2 kByte (yes, kilo-Byte) small:
    -rw-rw-rw- 1 admin root 1.1K Apr 18 20:16 tomato_rstats_14dda9cb6e98.gz

    And you can view the data on the router GUI - so, no need to fiddle around with remote shared folders on a PC... :cool:
    And: what will you do with this tiny zip file on your PC?

    All the needed help is give above - you just need to fiddle a bit with Linux command line or Samba Share and you are there - without fiddle no music! ;)

    The right commands executed on the router via SSH/Telnet are:
    1. mkdir /tmp/mnt/share (creates the mount point for the remote directory where to find the remote files on the router)
    2. mount \\\\pc-ip-address\\shared-folder /tmp/mnt/share -t cifs -o "username=name,password=pwd" (mounting the pc-ip-address\folder to the created mount point - with correct name and pwd)
    3. check with mount if the mount command was successful: \134\134192.168.0.2\134Music on /tmp/mnt/share type cifs (rw,relatime,unc=\\pc-ip-address\shared-folder,username=name,uid=0,noforceuid,gid=0,noforcegid,addr=pc-ip-address,posixpaths,serverino,acl,rsize=16384,wsize=57344)
    4. use the mount point /tmp/mnt/share in the router GUI to store the history file and be happy until you reboot the router (bcs. then the above settings are gone and need to be re-done) - and: never turn off the PC with the shared folder - as otherwise the traffic history will not be recorded anymore..
    5. Learn how to put this into a user-script to be executed at startup of the router - as already suggested here.
     
    Last edited: Apr 18, 2018
    skeal likes this.
  8. hazardass

    hazardass Occasional Visitor

    Joined:
    Aug 24, 2015
    Messages:
    18
    joegreat,
    Thank you for the response! Using the mount command without any options really helped to see if it worked. For a while, the mounting only worked when I did it manually, but didn't work in a boot script like services-start, and I don't know why. Eventually it started working on boot as well, and I don't know what fixed it. I think the first time it worked was when I used the path you suggested "/tmp/mnt/share". Then I switched back to /cifs1 and it worked again.

    When you say you store the history on router, do you mean NVRAM, or a custom location?
    I read in the wiki that the router memory may not be the best place for this because it gets worn out over time. I'm just not sure if they are talking about RAM, NVRAM, or both.

    So I wanted to skip storing history on the router altogether, just to be safe, but now I'm realizing that may not be possible. The custom location that I enter in the GUI (Tools > Other Tools) has to be a location on the router i.e. a "mount point" like /cifs1 or the one you suggested, and it cannot be a direct network path to the shared folder. The mount point is then 'linked' to the network share via the mount command, and the history file is actually stored in both locations, which is redundant.

    If I just store it on the router without mounting any external share, the question is how long will the history survive there. Even though it's in the non-volatile RAM, I'm guessing that it can still get deleted in some cases like flashing the firmware, is that correct? You say you've stored it there for years, but it probably gets reset when you update the FW, or you just don't update it.

    The one difference I found between storing in NVRAM vs. a custom location, is that the NVRAM option cannot work with per-device traffic monitoring enabled, so that makes the choice easy. I wonder if that's a limitation of the Merlin FW, or the RT-N66U model. When using a custom location, the real-time per-device monitor works, even though I still can't see per-device daily traffic reports (it shows no data). The Global history works fine which is really what I need to track my monthly internet usage.

    The interesting thing is that only when I store history in RAM, only then all the history reports work fine. Of course that's useless because history is reset every time router is rebooted.
     
    Last edited: Apr 19, 2018
Please support SNBForums! Just click on this link before you buy something from Amazon and we'll get a small commission on anything you buy. Thanks!