I've had this a lot over time and would appreciate a quick explanation if possible as to what may be happening so I can fix it myself. I'm sure 'al_c' has fixed this for me a time or two in the past but it happens so often for me I hate to even ask every time!
Error #4 reading the hourly data file: `data/2015-05-22-hourly_data.js` SyntaxError: Expected '}'
I looked at usage a few times yesterday and all was fine and now I try to look back at yesterday for the whole day and get this error above. I have this like three days of the last week.
I've had this a lot over time and would appreciate a quick explanation if possible as to what may be happening so I can fix it myself. I'm sure 'al_c' has fixed this for me a time or two in the past but it happens so often for me I hate to even ask every time!
Error #4 reading the hourly data file: `data/2015-05-22-hourly_data.js` SyntaxError: Expected '}'
I looked at usage a few times yesterday and all was fine and now I try to look back at yesterday for the whole day and get this error above. I have this like three days of the last week.
Dave - in spite of what the error message indicates, I'm pretty sure one of the lines in your hourly usage file is missing a close bracket `)`...
e.g., look for something like the second line in the code below
(Once you've found the offending line, you will have to fix it in both /opt/YAMon2/data and /tmp/www/data.
I have seen this happen on my router but only on one or two occasions - not as regularly as you seem to get it. Clearly there is a bug in my code but I don't know what provokes the error yet.
Can you set your loglevel to -1 and PM the log to me once the error occurs again?
Thanks, I just fixed one day that wouldn't pull up the day at all and gave just the error. Here is what the file looked like when opened in Notepad++. All I did was delete a space to get the whole like displayed on the same line like the rest of the file. Didn't seem to have an actual character missing just on a separate line.
After getting the line all on one line and uploading to both places, I don't get an error. My totals for that day on a couple of devices are crazy high but not error anymore. Thanks as always.
Not sure how to get the accurate total but I'm pretty sure a couple of these aren't correct. What's gonna happen if I just drop the last couple of digits on one of the hourly download numbers to at least get it closer to a real number? I'm assuming more may have to be done?
Thanks, I just fixed one day that wouldn't pull up the day at all and gave just the error. Here is what the file looked like when opened in Notepad++. All I did was delete a space to get the whole like displayed on the same line like the rest of the file. Didn't seem to have an actual character missing just on a separate line.
After getting the line all on one line and uploading to both places, I don't get an error. My totals for that day on a couple of devices are crazy high but not error anymore. Thanks as always.
Ok... that's a different problem... the regular expression is matching two results rather than just one. I suspect an IP address changed or new device was added to your network and is re-using an IP address... I just started getting that sort of behaviour too and I'm working on an update.
Posted: Sat May 23, 2015 23:38 Post subject: Re: Symbolic Linking to data... does this work for you???
al_c wrote:
First, create a directory and create the symbolic link
Code:
mkdir /tmp/www/data2
mount -o bind /opt/YAMon2/data /tmp/www/data2
I was just comparing that with the command that I picked for the earlier issue with Openwrt (the one that you mentioned you went on to create a config.file parameter for):
ln -s /tmp/www /www/user
I'm sure there's some nuanced difference between using mount -o and ln -s, but I'm not sure what it is aside from the ln one being visible with ls -l and the other not. I'm curious, though. BTW, using mount -o for your data2 test did work on OpenrWRT.
Quote:
I'm pretty sure there is a way to persist the sym link in nvram... So instead, I have a bit of code that creates the sym link when the script starts
That's fortunate, since OpenWRT doesn't have nvram.
Posted: Sun May 24, 2015 3:36 Post subject: Re: Symbolic Linking to data... does this work for you???
rseiler wrote:
al_c wrote:
First, create a directory and create the symbolic link
Code:
mkdir /tmp/www/data2
mount -o bind /opt/YAMon2/data /tmp/www/data2
I was just comparing that with the command that I picked for the earlier issue with Openwrt (the one that you mentioned you went on to create a config.file parameter for):
ln -s /tmp/www /www/user
I'm sure there's some nuanced difference between using mount -o and ln -s, but I'm not sure what it is aside from the ln one being visible with ls -l and the other not. I'm curious, though. BTW, using mount -o for your data2 test did work on OpenrWRT.
The only other practical difference I'm aware of involves chroots. Symlinks within chroots point to targets within the chroot, while bind-mounting allows for the possibility of mounting something from outside a chroot to within the chroot.
Personally, I love bind-mounting. I use it on my routers in a run-on-mount script to mount persistent subdirectories on a USB drive to /tmp/root (a.k.a. root's home-dir) and /var/log, providing me with a persistent home-directory and a persistent log storage medium.
For the purposes of YAMon2, the two methods should operate interchangeably. _________________ Ubiquiti EdgeRouter Lite | Primary router
D-Link dgs-1100-08 smartswitch | Main VLAN-aware switch
Netgear R7000 #1 | Primary AP
Netgear R7000 #2 | AC-only client-bridge (office)
Asus RT-AC66U | AC-only client-bridge (HTPC)
Netgear WNDR3700v2 | client-bridge (basement)
Am I the only one with this problem?
My every OTHER month in the report is missing. As you can tell from the attached picture
Nov, Jan,Mar,May is there, but "Dec, Feb, Apr" are missing. It it looks like a "undocumented feature" to me
Am I the only one with this problem?
My every OTHER month in the report is missing. As you can tell from the attached picture
Nov, Jan,Mar,May is there, but "Dec, Feb, Apr" are missing. It it looks like a "undocumented feature" to me
Help.
Wow... I've never seen that!
Do the monthly files exist in your /opt/YAMon2/data directory?
Did you view the reports at all in April? If no, then currently, there will be no entry.
At the moment, you can only add new entries to the bottom of the table... so the only way add a missing entry in the middle is to delete the ones below it and then click the green `+` to add this back to the table.
I'll see if I can detect a missing value and (at a minimum) leave a blank in the table.
Am I the only one with this problem?
My every OTHER month in the report is missing. As you can tell from the attached picture
Nov, Jan,Mar,May is there, but "Dec, Feb, Apr" are missing. It it looks like a "undocumented feature" to me
Help.
Wow... I've never seen that!
Do the monthly files exist in your /opt/YAMon2/data directory?
Did you view the reports at all in April? If no, then currently, there will be no entry.
At the moment, you can only add new entries to the bottom of the table... so the only way add a missing entry in the middle is to delete the ones below it and then click the green `+` to add this back to the table.
I'll see if I can detect a missing value and (at a minimum) leave a blank in the table.
A request, Al_C. I don't check this as often as I should to ensure it is working correctly. Can there be an option to send a snapshot of the daily stats page at the end of the day?
I know it seems like a lot of email, but I would happily delete it after seeing it but this way I would not miss it even when I forget about it. Especially since this all works so well I CAN forget about it from time to time.
A request, Al_C. I don't check this as often as I should to ensure it is working correctly. Can there be an option to send a snapshot of the daily stats page at the end of the day?
I know it seems like a lot of email, but I would happily delete it after seeing it but this way I would not miss it even when I forget about it. Especially since this all works so well I CAN forget about it from time to time.
With the new send alert capability, this now possible... I'll see what I can add
Posted: Mon Jun 01, 2015 4:19 Post subject: YAMon 2.1.0b is now available
Three new features in this release
1. You can now opt to organize the files within your data directory (so you can have sub-directories for month and/or year)
2. You can `symlink` to the data directory (meaning that you do not need separate copies on your USB drive and in the /tmp/www/ directories).
3. The script now limits you to 24 sendAlert messages per day (the last one being an alert that you've gone over your limit)
#1 & 2 were requested by particular users... sorry for forgetting who deserves the credit for these features.
NB - if you enable the symlink option, you *must* also change the path to data on the `Settings` tab in your reports to `data2` (or whatever value you've set in `config.file`).
I've also made a number of changes to how the script keeps internal track of the current/active IP & MAC addresses on the router. Hopefully this'll help to address a number of issues some of you have had over the past year or so.
Yet Another Monitor
Copyright (c) 2013-2014 Al Caughey
All rights reserved.
http://usage-monitoring.com
Launch options:
+ <path to yamon2.sh>
+ <path to yamon2.sh> <path to config.file>
+ <path to yamon2.sh> --help
+ <path to yamon2.sh> --stop
YAMon :: 2.1.0b
root@Nighthawk:/tmp/mnt/sda1/yamon# iptables v1.3.7: host/network `192.168.x.xxx' not found
iptables v1.3.7: host/network `192.168.x.xxx' not found
Probably due to the fact that I am running 10.0.0.* as my network.
edit: Or maybe that the default setting for 'includebridge' is set to 1.
Last edited by Mizehra on Mon Jun 01, 2015 13:07; edited 1 time in total
root@Nighthawk:/tmp/mnt/sda1/yamon# iptables v1.3.7: host/network `192.168.x.xxx' not found
iptables v1.3.7: host/network `192.168.x.xxx' not found[/code][/code]
Probably due to the fact that I am running 10.0.0.* as my network.
edit: Or maybe that the default setting for 'includebridge' is set to 1.
You are right... _includeBridge should be 0 (unless you have a bridge in your network). Change line #68 of `default config.file`.
My bad for leaving an incorrect value in the config. No help to you but I've fixed the zip file on page one of this thread. Thanks for pointing this out.