YAMon 2.2 Usage Reporting: by device per hr/day/mo or live

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2, 3, 4 ... 107, 108, 109  Next
Author Message
al_c
DD-WRT Guru


Joined: 13 Apr 2013
Posts: 1520
Location: Ottawa Canada

PostPosted: Sat Apr 05, 2014 20:26    Post subject: Reply with quote
nitrocs wrote:
When upgrading to a new version, should all files (setup, www, etc) be deleted so that the new script can re-create or is leaving those put fine?

No you do not have to delete anything.

On the router, just to be safe I've put everything into a separate directory (`/opt/YAMon2/`).

For the web side of things, the script copies or creates and names all of the necessary files and directories (so there are no naming clashes).

Al
Sponsor
tsaylor
DD-WRT Novice


Joined: 20 Jan 2014
Posts: 19

PostPosted: Sun Apr 06, 2014 23:50    Post subject: Re: Version 2.0.4d is now available Reply with quote
al_c wrote:
Todd (tsaylor) if you're still following this, I should've heeded your advice several months ago to break the downloads & uploads in two data structures... Embarassed

Well, I won't tell you how to paint your masterpiece. Very Happy

I've switched to version 2 now, but things are looking a bit odd (attached the version 1 output followed by the version 2 output). I had stopped version 1 like an hour ago so I'd expect the two to be pretty close. I'll start it up again for better comparisons going forward, for now.



screenshot007.png
 Description:
 Filesize:  151.5 KB
 Viewed:  17249 Time(s)

screenshot007.png



screenshot006.png
 Description:
 Filesize:  130.11 KB
 Viewed:  17249 Time(s)

screenshot006.png


al_c
DD-WRT Guru


Joined: 13 Apr 2013
Posts: 1520
Location: Ottawa Canada

PostPosted: Mon Apr 07, 2014 1:18    Post subject: Re: Version 2.0.4d is now available Reply with quote
tsaylor wrote:
al_c wrote:
Todd (tsaylor) if you're still following this, I should've heeded your advice several months ago to break the downloads & uploads in two data structures... Embarassed

Well, I won't tell you how to paint your masterpiece. Very Happy

I've switched to version 2 now, but things are looking a bit odd (attached the version 1 output followed by the version 2 output). I had stopped version 1 like an hour ago so I'd expect the two to be pretty close. I'll start it up again for better comparisons going forward, for now.

There are no units in the second screenshot... have you got a bad hourly usage file?

Al
Vishwa
DD-WRT User


Joined: 05 Mar 2014
Posts: 193
Location: Edmonton, AB

PostPosted: Mon Apr 07, 2014 17:47    Post subject: Reply with quote
Hi, I thought I try to run this and have encountered a few problems. If someone could help me that would be great. I am a novice in DD-WRT. Here is what is happening.

I initially wanted to do exactly as the instruction says but the first obstacle was I couldn't create a directory inside of /opt either by winscp or by putty command "mkdir /opt/YAMon2. Came up with error that I didn't have permission although I should.
I then updated my router(R7000) from version 23700 to 23770 R01, restarted the whole process and still got the same error.
Then I installed YAMon2 in /tmp/mnt/sda1(the directory created when USB flash drive was mounted) and made the appropriate changes in the script to point that location.
When I run the yamon.startup command, it runs with an intial error "bad number"
But is seems to be running as I can see several hourly files and others updated.
The next problem I have is I cannot see the report by pointing my browser to "http://192.168.0.1/user/yamon.html"
First there is no /user directory under root. The only /user directory is under /root/www. But, even if I pointed my browser to that place, it doesn't load anything.

If there is any hope for me, I would like to try it. If, on the other hand it is beyond me, I will give up for now and try in the future. Thanks in advance.
al_c
DD-WRT Guru


Joined: 13 Apr 2013
Posts: 1520
Location: Ottawa Canada

PostPosted: Mon Apr 07, 2014 18:05    Post subject: Reply with quote
Vishwa wrote:
Hi, I thought I try to run this and have encountered a few problems. If someone could help me that would be great. I am a novice in DD-WRT. Here is what is happening.

I initially wanted to do exactly as the instruction says but the first obstacle was I couldn't create a directory inside of /opt either by winscp or by putty command "mkdir /opt/YAMon2. Came up with error that I didn't have permission although I should.
I then updated my router(R7000) from version 23700 to 23770 R01, restarted the whole process and still got the same error.
Then I installed YAMon2 in /tmp/mnt/sda1(the directory created when USB flash drive was mounted) and made the appropriate changes in the script to point that location.
When I run the yamon.startup command, it runs with an intial error "bad number"
But is seems to be running as I can see several hourly files and others updated.
The next problem I have is I cannot see the report by pointing my browser to "http://192.168.0.1/user/yamon.html"
First there is no /user directory under root. The only /user directory is under /root/www. But, even if I pointed my browser to that place, it doesn't load anything.

If there is any hope for me, I would like to try it. If, on the other hand it is beyond me, I will give up for now and try in the future. Thanks in advance.


Is the `/opt` directory on a USB drive? How is that drive formatted? Unless I'm mistaken, if you did not choose `ext2` then you might have problems (readonly permissions).

With respect to the bad number error message, are you running v2.0.4d? If no, please download and install that one (there were bad number errors in earlier versions)

Next, open your config.file and set `_log2file=2` and also `_loglevel=0`... then save config.file.
Start the script (in Putty.exe) and let it run until the bad number error message appears (or longer)

Take a screen shot and PM it to me (this'll show me exactly where the problem occurs in the code)

You see the reports at http://192.168.0.1/user/yamon2.html (not yamon.html). The report files are found on the router at `/tmp/www`... you do not have to add/create the `user` directory. That is just the way that it is Smile

Hope this helps

Al
Vishwa
DD-WRT User


Joined: 05 Mar 2014
Posts: 193
Location: Edmonton, AB

PostPosted: Mon Apr 07, 2014 18:13    Post subject: Reply with quote
Thank you very much. I will do as you instructed tonight. Regarding the usb, I didn't specifically do any formatting. I read your readme and got an existing 8GB flash drive, erased everything and inserted it into the router usb2.0 port. In the services-usb I enabled the automount.
I will do what you said and report back here. I think I am close as with winscp, when I open some files there are all the numbers.
I downloaded your script day before yesterday--I think it is the latest. I will check and if it wasn't start over again with the latest. Thank you again.
al_c
DD-WRT Guru


Joined: 13 Apr 2013
Posts: 1520
Location: Ottawa Canada

PostPosted: Mon Apr 07, 2014 18:27    Post subject: Reply with quote
Vishwa wrote:
Thank you very much. I will do as you instructed tonight. Regarding the usb, I didn't specifically do any formatting. I read your readme and got an existing 8GB flash drive, erased everything and inserted it into the router usb2.0 port. In the services-usb I enabled the automount.
I will do what you said and report back here. I think I am close as with winscp, when I open some files there are all the numbers.
I downloaded your script day before yesterday--I think it is the latest. I will check and if it wasn't start over again with the latest. Thank you again.


In the readme.txt there is a reference to Optware... see that for configuring things and formatting the USB drive.

I will update the readme to explicitly state that the drive must be formatted properly.


Al
Vishwa
DD-WRT User


Joined: 05 Mar 2014
Posts: 193
Location: Edmonton, AB

PostPosted: Mon Apr 07, 2014 18:33    Post subject: Reply with quote
Thank you very much, Al. I must have missed that part in the excitement of setting up something new. I will re read it. As a matter of fact, I read your readme in the first installment and then decided to try the second one thinking it must be easier by now.
Just a quick question on the readme file. What is the best way to read it? Which program? The reason I ask is that if I try it in notepad or other text editor, it displays without any breaks. Only winscp seems to use some line breaks in it.
mchaney
DD-WRT User


Joined: 26 Apr 2013
Posts: 372

PostPosted: Mon Apr 07, 2014 18:45    Post subject: Reply with quote
I can't get this script to run no matter what I try. I get:

Error #4 reading the devices data file: data/users.js`

And a similar one about the daily file. Those appear in a red box on the yamon2.html web page. All the tabs are blank as a result. I even tried typing in the basedir in yamon2.sh and even that didn't fix it. I'm running it from /jffs/YAMon2 and have changed all the scripts where /opt/YAMon2 appears and changed them all to /jffs/YAMon2. As far as I can tell, all permissions are fine. When I run 1.0.17b from /jffs/YAMon it works fine so it appears to be something with YAMon2. Any suggestions?

Mike
NiTrus
DD-WRT User


Joined: 25 Dec 2010
Posts: 261
Location: Twin Cities, MN

PostPosted: Mon Apr 07, 2014 19:26    Post subject: Reply with quote
mchaney wrote:
I can't get this script to run no matter what I try. I get:

Error #4 reading the devices data file: data/users.js`

And a similar one about the daily file. Those appear in a red box on the yamon2.html web page. All the tabs are blank as a result. I even tried typing in the basedir in yamon2.sh and even that didn't fix it. I'm running it from /jffs/YAMon2 and have changed all the scripts where /opt/YAMon2 appears and changed them all to /jffs/YAMon2. As far as I can tell, all permissions are fine. When I run 1.0.17b from /jffs/YAMon it works fine so it appears to be something with YAMon2. Any suggestions?

Mike


i had same problem, but thought it was cuz my
router rebooted on its own..hmmm
1.0.17 no probs

_________________
NETGEAR R9000 | RT | 32170
NETGEAR R7800 | AP | 32170
NETGEAR R7000 | AP | 32170

mchaney
DD-WRT User


Joined: 26 Apr 2013
Posts: 372

PostPosted: Mon Apr 07, 2014 22:05    Post subject: Reply with quote
NiTrus wrote:

i had same problem, but thought it was cuz my
router rebooted on its own..hmmm
1.0.17 no probs


Looking at yamon2.sh, looks like there are two variables that define the base dir: d_BaseDir and _BaseDir. It looks like there's a sequence where _BaseDir can end up with the pathname without the forward slash after it: like /opt/YAMon2 instead of /opt/YAMon2/. Don't know if that could be the problem or not. Maybe Al can look at that.

Mike
Vishwa
DD-WRT User


Joined: 05 Mar 2014
Posts: 193
Location: Edmonton, AB

PostPosted: Tue Apr 08, 2014 3:46    Post subject: Reply with quote
al_c wrote:


Is the `/opt` directory on a USB drive? How is that drive formatted? Unless I'm mistaken, if you did not choose `ext2` then you might have problems (readonly permissions).

With respect to the bad number error message, are you running v2.0.4d? If no, please download and install that one (there were bad number errors in earlier versions)

Next, open your config.file and set `_log2file=2` and also `_loglevel=0`... then save config.file.
Start the script (in Putty.exe) and let it run until the bad number error message appears (or longer)

Take a screen shot and PM it to me (this'll show me exactly where the problem occurs in the code)

You see the reports at http://192.168.0.1/user/yamon2.html (not yamon.html). The report files are found on the router at `/tmp/www`... you do not have to add/create the `user` directory. That is just the way that it is Smile

Hope this helps

Al


Success! Thank you very much Al. It was great to see what a small change in the config.file could do. I made those two changes you suggested and ran the script through putty and waited for the error message to appear so that I could send it to you. Lo and behold! instead of the error I started getting the report every 10 seconds or so in putty's dos window.
Then I tried with the browser at 192.168.0.1/user/yamon2.html and I got the report just with a minor error.
Anyway I like to thank you for your work and willingness to help. Thanks
al_c
DD-WRT Guru


Joined: 13 Apr 2013
Posts: 1520
Location: Ottawa Canada

PostPosted: Tue Apr 08, 2014 4:37    Post subject: Reply with quote
NiTrus wrote:
mchaney wrote:
I can't get this script to run no matter what I try. I get:

Error #4 reading the devices data file: data/users.js`

And a similar one about the daily file. Those appear in a red box on the yamon2.html web page. All the tabs are blank as a result. I even tried typing in the basedir in yamon2.sh and even that didn't fix it. I'm running it from /jffs/YAMon2 and have changed all the scripts where /opt/YAMon2 appears and changed them all to /jffs/YAMon2. As far as I can tell, all permissions are fine. When I run 1.0.17b from /jffs/YAMon it works fine so it appears to be something with YAMon2. Any suggestions?

Mike


i had same problem, but thought it was cuz my
router rebooted on its own..hmmm
1.0.17 no probs

Mike et al: The `Error #4 reading...` messages get displayed when the JavaScript cannot find a specified data file. I've found that it is virtutally inevitable that the JavaScript in the browser will try to read the file while the script on the router is updating it and this causes errors. Rather than displaying the unhelpful browser errors, I wait for a second or two and try to read the file again... after 3-4 consecutive unsuccessful attempts, I display the `Error #4 reading...` message

So, the data files exist? i.e., are they actually getting created (in /opt/YAMon2/data/... or whereever you've specified in config.file)? Do the files get copied to /tmp/www/data? Is there proper data in the files

As described in earlier threads, please help me help you by turning on logging and then send me the log file (and the data files too).

That said, there is definitely odd behaviour related to the router rebooting... following your earlier message, I rebooted my router twice this evening (once via the DD-WRT interface and a second time by flicking the power switch). On both occasions, the v2.x script restarted as expected ***BUT*** once it did, it did not capture data properly... in particular, the `getCV` function was not properly extract the current usage values from the data file?!?

The snippet from my log file below shows that the script is getting up/download data for IP address 192.168.1.4 and finds the `currentLine` from the data file but then does not extract the `down` & `up` values???
Code:
2014-04-08   00:04:20      0      --- Getting iptablesData
downloads
2684 192.168.1.4
1225 192.168.1.13
+++++++++++++++++++++++++++++
uploads
60 192.168.1.101
2725 192.168.1.4
3206 192.168.1.105
1529 192.168.1.13

2014-04-08   00:04:20   0      cIP:   192.168.1.4   ndown:   2684   nup:   2725
2014-04-08   00:04:20   0      --- currentLine:   hu({"mac":"00:xx:xx:xx:xx:E4","hour":"00","down":3934,"up":3542})
2014-04-08   00:04:20   0      --- values from currentLine:   00:xx:xx:xx:xx:E4   0   0 <--should be 3934 & 3542?!?
2014-04-08   00:04:20   0     >>> digitAdd do_tot   2684   0   2684
2014-04-08   00:04:20   0     >>> digitAdd up_tot   2725   0   2725
2014-04-08   00:04:20   1      >>> Update currentLine   00   00:xx:xx:xx:xx:E4   2684   2725   B


If I stop the script and then restart it manually, everything starts working again... I have no frickin` clue as to what might be causing this. ARGGGGGGHHHHH!

I'll sleep on it and take a look at things again in the morning.

Thanks for your patience (mine is running out)
spirosbo
DD-WRT Novice


Joined: 01 Oct 2013
Posts: 12

PostPosted: Tue Apr 08, 2014 11:47    Post subject: Reply with quote
sh: bad number pops up once during the beginning of the script due to detanod variable. It is missing an underscore when initially declared (should be _detanod) and should have an initial value other than null before the comparison later on.
al_c
DD-WRT Guru


Joined: 13 Apr 2013
Posts: 1520
Location: Ottawa Canada

PostPosted: Tue Apr 08, 2014 12:27    Post subject: Reply with quote
spirosbo wrote:
sh: bad number pops up once during the beginning of the script due to detanod variable. It is missing an underscore when initially declared (should be _detanod) and should have an initial value other than null before the comparison later on.


Thanks... fixed! Does anyone know if there is bash `strict` mode (a la "use strict" in JavaScript files)? Because , honestly, my router does not report that as an error.

Thanks
Goto page Previous  1, 2, 3, 4 ... 107, 108, 109  Next Display posts from previous:    Page 3 of 109
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum