opendns-fetchstats

Comments

105 comments

  • Avatar
    rotblitz

    "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...

    0
    Comment actions Permalink
  • Avatar
    ereedy

    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

    0
    Comment actions Permalink
  • Avatar
    Brian Hartvigsen

    The VBS version is documented in the file itself.  The README has not been updated with the difference between the 2 versions or instructions on how to run the VBS version.

    0
    Comment actions Permalink
  • Avatar
    nzi

    I'm a newbie with VBS can anyone walk me through or direct me to a guide for what portions of the script I need to replace with username/password?

    0
    Comment actions Permalink
  • Avatar
    rotblitz

    You don't need to amend the script.  You just run it has I have described above.

    Copying it down to here for your convenience:

           cscript //NoLogo fetchstats.vbs <username> <network-id> <YYYY-MM-DD> [<YYYY-MM-DD>]

    0
    Comment actions Permalink
  • Avatar
    nzi

    Excellent. Thanks for the help rotblitz.

    0
    Comment actions Permalink
  • Avatar
    613nj

    I keep getting "Error retrieving data. Date Range may be outside of available data." I'm entering as 2014-03-10 2014-03-13. Can someone advise if this is the correct way to enter?

    0
    Comment actions Permalink
  • Avatar
    rotblitz

    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.

    0
    Comment actions Permalink
  • Avatar
    rotblitz

    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

    0
    Comment actions Permalink
  • Avatar
    613nj

    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?

     

    0
    Comment actions Permalink
  • Avatar
    Permanently deleted user

    I was unsuccessful using "all" as my network-id.  However, by copying the ID from the URL when I look at my stats, I was able to pull it down.

    0
    Comment actions Permalink
  • Avatar
    613nj

    Awesome. Using the ID in the URL did the trick. Thanks!

    0
    Comment actions Permalink
  • Avatar
    hultet

    I am running the script: cscript //NoLogo fetchstats.vbs <username> <network-id> <YYYY-MM-DD> [<YYYY-MM-DD>

    and it fetches all data but how do i save it to a .csv file

    0
    Comment actions Permalink
  • Avatar
    Permanently deleted user

    at the end of your command, add the following:

     > file.csv

    0
    Comment actions Permalink
  • Avatar
    nzi

    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?

    0
    Comment actions Permalink
  • Avatar
    rotblitz

    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!

    0
    Comment actions Permalink
  • Avatar
    nzi

    Excellent, works great. Thanks again rotblitz.

    0
    Comment actions Permalink
  • Avatar
    hultet

    @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

     

    I 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.

    0
    Comment actions Permalink
  • Avatar
    613nj

    You have to replace the OpenDNS_Password variable with your password in the script.

    0
    Comment actions Permalink
  • Avatar
    hultet

    Like this?

    echo MYPASSWORD|cscript //NoLogo fetchstats.vbs <username> <network-id> %@yy%-%@mm%-%@dd% > %@yy%%@mm%%@dd%.csv

    0
    Comment actions Permalink
  • Avatar
    613nj

    Yes

    0
    Comment actions Permalink
  • Avatar
    hultet

    Ok, i have to try it at home, my work firewall won't let the script fetch data.

    0
    Comment actions Permalink
  • Avatar
    hultet

    Has fetchstats stopped working? I don't receive any history when i run the script.

    0
    Comment actions Permalink
  • Avatar
    rotblitz

    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.

    0
    Comment actions Permalink
  • Avatar
    Permanently deleted user
    Note that the format of the dashboard has changed slightly, and so the script was updated. Download the newest version and see if that fixes it.
    0
    Comment actions Permalink
  • Avatar
    etharp

    I had the toughest time getting valid results until I noticed that the URL have a org-XXXX for the network id. Use this as the network id for fetchstats and it worked. Thanks all!

    0
    Comment actions Permalink
  • Avatar
    roddy8

    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>]
    0
    Comment actions Permalink
  • Avatar
    rotblitz

    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.

    0
    Comment actions Permalink
  • Avatar
    danjcarrington

    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!

    0
    Comment actions Permalink
  • Avatar
    rotblitz

    Ensure that your password does not contain special chacters being reserved for URL encoding.

    0
    Comment actions Permalink

Please sign in to leave a comment.