opendns-fetchstats
I saw a post in the old forums about opendns-fetchstats. I looked up the url, but having fairly limited experience with programming (basic VB scripts in MS Access), I don't quite know what to do with the code on the page. Can anyone help me? There are no explanations on the site. I'd like to download complete csv files from my log covering a week at a time.
-
When running the script using a 5-digit org ID, I get either "You cannot access xxxxx" or "You cannot access all" if I try to use "all". I am a Full Admin.
When trying to visit
https://dashboard.opendns.com/stats/all/topdomains/
it redirects me to
-
I'm having the same issue as danjcarrington. When I first attempted to login, it just told me I didn't have access. I assumed this was because we had 2 step authentication on the account. Once I took two step authentication off it now says my password / username is incorrect. The only character in my password is a !. Any suggestions?
-
If you use your e-mail address as username, try with replacing the @ in your e-mail address by the %40 sequence.
If you're invoking the script within a Windows command script, you must use %%40 instead."we had 2 step authentication on the account."
And again, this script cannot be used to fetch stats for the Enterprise (Umbrella) line of services, just for the Home services (free and VIP), because it is not supposted to work with the Umbrella dashboard at https://dashboard2.opendns.com/
-
For anyone that would like to know. If you only want to retrieve blocked domains then you need to edit the "fetchstats.vbs" file. You'll need to go towards the end of the file and make the following change:
Change "/page" to "/blocked/page"
This will cut down on the amount of stats retrieved and narrow the system down to problem areas on your network.
This helps me as I really only need to see what's being blocked.
-
OK. @rotblitz, I'm trying to run the windows command script you listed above. It runs fine. But if I place it in a task in Task Scheduler I can't seem to get it right. It either says it's running forever and no window opens or I make adjustments to the task action and I get it to open a command window and runs and then leaves the window open and it has to be closed manually. I'm in Windows 10 and here's how I have the action set right now:
Action: Start Program
Program/Script: cmd
Arguments: start /c "" "C:\Users\T_Lma\Documents\OpenDNS stats\fetchstats_blocked.cmd"
Start in: C:\Users\T_Lma\Documents\OpenDNS stats
Anybody help me out here?
-
The problem may be that the Task Scheduler runs it under different credentials with different access rights. You'll have to debug the script to see what's going on.
Add this line at the begin on the script: @set debug=Y
Now change the command line in Scheduled Tasks to (one line):
cmd /c "C:\Users\T_Lma\Documents\OpenDNS stats\fetchstats_blocked.cmd" 1>C:\Users\T_Lma\Desktop\fetchstats.stdout.txt 2>C:\Users\T_Lma\Desktop\fetchstats.stderr.txt
This produces two files fetchstats.std???.txt on your Desktop showing the execution of the script and hopefully where it gets stuck.
-
Hi, I'm also trying to use this script, but i get this error :
C:\Users\xxxx\Desktop>cscript //NoLogo opends.vbs XXXXX@XXX networkID 2016-08-12
Password: XXXXC:\Users\xxxx\Desktop\opends.vbs(16, 2) WinHttp.WinHttpRequest: Le délai imparti à l'opération est dépassé
(from french : the timeout for the operation is reached) -
"I am trying to retrieve the history from my router."
Does your router store history? Whatever, the OpenDNS stats are not on your router but in the cloud on OpenDNS' servers.
"Was told the past year would be accessible."
This is only true with some paid versions of OpenDNS. Which one do you use?
"need clarification & more specific directions... "
No problem, just ask your specific questions.
-
"I am trying to retrieve the history from my router."
Does your router store history? Whatever, the OpenDNS stats are not on your router but in the cloud on OpenDNS' servers.
**My router has several thousand "packets" stored on it.
"Was told the past year would be accessible."
This is only true with some paid versions of OpenDNS. Which one do you use?
** I purchased the VIP plan.
"need clarification & more specific directions... "
No problem, just ask your specific questions.
** I have OpenDNS set up & connected to my network, but access the router history. How do I do that?
-
"My router has several thousand "packets" stored on it."
Could be. But this is unrelated to OpenDNS stats and the fetchstats tool.
"I purchased the VIP plan."
Yes, this comes with a year of stored stats.
"I have OpenDNS set up & connected to my network, but access the router history. How do I do that?"
I say it again, your router history has nothing to do with OpenDNS. You must refer to your router support to see if you can access the "router history" and how.
However, if you want to download your OpenDNS stats from OpenDNS' servers, you run the opendns-fetchstats script as lengthy explained in this thread before. There's nothing to add to the instructions and explanations.
-
Hi
I'm not an IT person. I'm simply trying to fetch using the CMD line, but keep getting the message "usage:<username> <network-id> <YYYY-MM-DD> [<YYYY-MM-DD>]"
Any adia what i'm doing wrong? THis is what i've tried:
I'v saved the fetchstats.vbs code in a file, named in "fetchstats.vbs" and saved in my working directory.
I've saved the line "cscript //NoLogo fetchstats.vbs name@domain.com Network-ID 2017-01-03 2017-
01-04/" in a file named "fetch.cmd" in my working directory and ran it from the working dierectory to get the above message. I've also tried changing the "@" in the user name to "%40" and "%%40" per some instructions above, but nothing works.Do i need to add my login details somehow?
-
"Do i need to add my login details somehow?"
Well, the user name (e-mail address) is already a command parameter, and the VBS is supposed to prompt you for the password. If you want to run it out of a command script (cmd), you better refer to my earlier example, where you can see that the password is piped into the VBS.
Repeating it more readable:
@rem fetchstats.cmd created by RotBlitz, April 2014
@if not defined debug @echo off
for /f "tokens=1-4 delims=/-. " %%G in ('date /t') do call :fixdate %%G %%H %%I %%J
echo OpenDNS_Password|cscript //NoLogo fetchstats.vbs <username> <network-id> %@yy%-%@mm%-%@dd% > %@yy%%@mm%%@dd%.csv
goto :EOF
:fixdate
if "%~1" GTR "9999" shift /1
for /f "skip=1 tokens=2-4 delims=(-)" %%G IN ('echo.^|date') do (
set @%%G=%1&set @%%H=%2&set @%%I=%3
)
goto :EOFThe italic parts need to be edited by you.
-
Just a shout to rotblitz and the others who contributed to this thread; works great!
For those not that familiar with vbscript - when you download the code from Github (beside stripping all the junk at the end), just make sure to save it as ansi from Notepad, or you'll get an unrecognized character error.
Within the script as said above, you can select blocked or other reports.
The next step is to setup the Splunk dashboard to make it easier to get a quick view of the data, and maybe to setup the scheduler. I think the scheduler probably would be best run the just before midnight, unless you changed the code to get the previous day's stats, and just run it the next morning.
If I come up with anything of note, I'll post.
-
Just noticed today that fetchstat login doesn't seem to work anymore, I guess has to do with the new login page "look", although the URLs seems to be the same.
Message I get is "Login Failed. Check username and password". Using @ or %40 or %%40 all the same.
Logging through usual web interface works ok though, so it's not an account name/password problem.
-
Hey g2006y,
Great catch and easy fix:
Comment or delete this line (single quote is a comment)
' regEx.Pattern = ".*Logging you in.*"
Change it to this (they just changed the word, but there could be some error or other conditions this fix could miss, but it works)
regEx.Pattern = ".*Login*"Back in business. I had just setup my scheduler to work starting 7/30, and they updated the page so 7/31 failed, but I hadn't checked to see if it was running (it was a busy week). I see now I need to set some logging within the script(s).
Cheers,
Netwrench
-
In the same boat as ashbyc - using the shell script & getting "Login Failed" message due to the OpenDNS login page changes.
# Sign into OpenDNS
SIGNIN=`curl --silent --insecure \
--cookie "$COOKIEJAR" \
--cookie-jar "$COOKIEJAR" \
--data "formtoken=$FORMTOKEN&username=$USERNAME&password=$PASSWORD&sign_in_submit=foo" \
"$LOGINURL" \
| grep "*Login*"
`Appreciate any recommendations, thanks!
-
rroach78 - instead of using email@domain.com use email%40domain.com for login -- this and the regex is what I needed to change for this to work.
-
Just now had a chance to sit down & try to get this working. I feel like I'm close but not there yet. I've made changes to both the regex as well as replacing @ with %40 in the email address. Now instead of the login failed error, I get a message that reads "You can not access all". When I try to use my 6-digit ID instead of all, I get the same message with my ID.
Are there any other recommendations that I might be able to try? Thanks!
Please sign in to leave a comment.
Comments
105 comments