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.
-
"There are no explanations on the site."
There are, you just didn't see them. The most important is that README file.
It depends on what version you want to use, bash script or WSH/VBS, and on what platform (OS) you want to use it.
-
VBS: This is for Windows. Copy and paste fetchstats.vbs and save it as fetchstats.vbs. Then run it as explained in the same file:
cscript //NoLogo fetchstats.vbs <username> <network-id> <YYYY-MM-DD> [<YYYY-MM-DD>] - Bash: This is for Linux and Windows. For Windows you may need to download bash and cURL separetely, see links in the README file.
You copy and paste fetchstats and save it under this name. Then, from a bash prompt, you execute (as described in the README file too):
fetchstats <username> <network_id> <YYYY-MM-DD> [<YYYY-MM-DD>]
That should be it! Any more questions please come back with very specific details about what you still do not understand. This forum is not good for a general ICT course...
-
-
rotblitz - Thank you for the additional information. That should be enough to allow me use this utility. I was planning on running it from Windows. I appreciate your help.
Just to be clear, I had read the README file on the website. I went back and read it several more times. I'm sure it had sufficient information to allow you to run the utility. I have more IT experience than 90-95% of the US population and it wasn't sufficient for me. A user forum seems like just the place to ask such a question in hopes of getting a kind and civilized response.
Here is the README file I was looking at. Maybe I was looking in the wrong location: https://raw.github.com/rcrowley/opendns-fetchstats/master/README
-
Ensure that you entered the right numeric network ID too.
And check manually if there are stats available: https://dashboard.opendns.com/stats/<network-id>/topdomains/2014-03-10to2014-03-13/
This is the URL fetchstats is building to retrieve the data. -
Instead of the numeric network ID you can use "all" too.
Related URL: https://dashboard.opendns.com/stats/all/topdomains/2014-03-10to2014-03-13/
Related command line: cscript //NoLogo fetchstats.vbs <username> all 2014-03-10 2014-03-13
-
Thanks for the help. Still getting "Error retrieving data. Date Range may be outside of available data."
I verified the stats are there in https://dashboard.opendns.com/stats/%3Cnetwork-id%3E/topdomains/2014-03-10to2014-03-13/
This is exactly how I am running the script: cscript //NoLogo fetchstats.vbs myemail@gmail.com all 2014-03-10 2014-03-13
Any ideas?
-
I'd like to automate this by creating a batch file and using task scheduler. I think I see where to store the password as discussed here https://forums.opendns.com/comments.php?DiscussionID=13749 but for the batch file how would specify the current date and have it store in a .csv file named currentdate.csv? i.e. cscript //NoLogo fetchstats.vbs <username> <network-id> <currentdate> >currentdate.csv
Any ideas?
-
The command script fetchstats.cmd:
@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 :EOF
Enjoy! -
@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 :EOFI can't get this command script to work, i've added my username and network-id but it will never ask me for my password.
-
So first check if you still get stats at all.
https://dashboard.opendns.com/stats/all/topdomains/If you don't see any, then also fetchstats can't get any.
-
Hi there
I'm trying to figure out how to get stats emailed on my Windows 7 machine.
So far I've done the following:
1. Copy and pasted fetchstats.vbs into a windows notepad file and saved it as fetchstats.vbs.
2. Downloaded Curl 7.43.0.tar.gz
3. I'm unsure how to get Curl to work and how to run it with the VBS script. Could you please give me specific instructions? From Roblitz comment below, I've edited the VBS with my login details, but have not figured out how to run it.
- VBS: This is for Windows. Copy and paste fetchstats.vbs and save it as fetchstats.vbs. Then run it as explained in the same file:
cscript //NoLogo fetchstats.vbs <username> <network-id> <YYYY-MM-DD> [<YYYY-MM-DD>]
- VBS: This is for Windows. Copy and paste fetchstats.vbs and save it as fetchstats.vbs. Then run it as explained in the same file:
-
You don't need cURL to execute fetchstats.vbs. Where did you get that instruction from?
To run fetchstats.vbs, you open a command prompt window and enter
cscript //NoLogo fetchstats.vbs <username> <network-id> <YYYY-MM-DD> [<YYYY-MM-DD>]
(with the right replacements of your username/e-mail address, network ID and dates)Or you create and run the command script fetchstats.cmd as of above.
If you want the resulting CSV file e-mailed, you need to use an SMTP client program, be it Windows' built-in tool PowerShell or another like the one from www.blat.net. You can append the related procedure to the fetchstats.cmd script, of course.
-
Hello,
I'm not able to get this script to work. It keeps giving me a message "Login failed. Check username and password." I've verified my username and password by using it to log into the site. I've hardcoded both variables in the bash script and echoed it out to make sure it was correct. Still getting the same error.
Not sure what the issue is, but I would love to get this working so that I can schedule a cron job to run this regularly.
Thanks!
Please sign in to leave a comment.
Comments
105 comments