Publishing ISA Reports on your Sharepoint site

Here’s the problem. You want to look at your firewall reports regularly. You have gone so far as to set up ISA to publish the daily and monthly reports to a directory on the server but getting to yesterday’s report is a real pain in the butt. It would be nice to send the report via email as a pdf like Trend does or to have it appear on the home page of your sharepoint site. Although I may do the email option in the nearby future I have already completed the second option. Here is how I did it.

  1. Publish the ISA reports you are interested in to a directory if you have not already done it.
  2. Add a virtual directory to your default web site and point it at your report directory. For this example I will use srv1 as the server name and isa as the virtual directory name. This virtual directory points to my ISA reports directory located at h:\reports. To get to the Daily report for 4/25/2007 I would use the following URL, http://srv1/isa/Daily_(4.25.2007-4.25.2007)/report.htm. As you can see entering this URL can get pretty tedious.
  3. To solve this problem I created a small web page with some javascript that calculates the URL to yesterday’s ISA report and then redirects you there. I called that page, daily.htm, and put it in the Reports directory. So if I wanted to see yesterday’s ISA report, I would enter the following URL into my browser, http://srv1/isa/daily.htm, and the latest ISA daily report would pop up.
  4. Now since we have a URL that will always point to the latest ISA daily report, the Page Viewer Web Part becomes a simple solution to the problem. The Page Viewer Web Part gives me a peak at the Daily report and it makes it easy for me to browse the rest of the report. I created a similar web page that produces Monthly report. I put links to both pages and the directory in my Sharepoint Links list and My Favorites.

Although I used this technique for looking at firewall reports it could be easily modified to show a web page with key business indicators that you create daily, weekly, or monthly.

Here is the code for the daily.htm web page.

< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta name="generator" content="HTML Tidy" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script type="text/javascript">
//< !&#91;CDATA&#91;
function getRptDate()
{
var now = new Date();
var ydate = new Date(now.getTime() - 86400000);
var yday = ydate.getDate();
var ymon = ydate.getMonth() + 1;
var yyear = ydate.getFullYear();
var datetext = ymon + '.' + yday + '.' + yyear + '-' + ymon + '.' + yday + '.' + yyear;
return datetext;
}
//&#93;&#93;>
</script>
</head>
<body>
<script type="text/javascript">
<!--
var d = getRptDate();
var path = 'http://srv1/isa/';
window.location = path +'Daily_(' + d + ')/report.htm';
//-->
</script>
</body>
</html>

10 thoughts on “Publishing ISA Reports on your Sharepoint site”

  1. Here is the code for the monthly report. Enjoy!


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
    <head>
    <meta name="generator" content="HTML Tidy, see www.w3.org" />
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <script type="text/javascript">
    //<![CDATA[
    function getRptDate()
    {
    var now = new Date();
    var yday = now.getDate();
    <!-- Calculate the last day of last month -->
    var ydate = new Date(now.getTime() - yday * 86400000);
    var yday = ydate.getDate();
    var ymon = ydate.getMonth() + 1;
    var yyear = ydate.getFullYear();
    var datetext = ymon + '.1.' + yyear + '-' + ymon + '.' + yday + '.' + yyear;
    return datetext;
    }
    //]]>
    </script>
    </head>
    <body>
    <script type="text/javascript">
    <!--
    var d = getRptDate();
    var path = 'http://srv1/isa/';
    <!-- document.write(d); -->
    window.location = path +'Monthly_(' + d + ')/report.htm';
    //-->
    </script>
    </body>
    </html>

  2. Hi Bill, could you post the weekly script too, I’m using the daily and monthly scripts and they are working perfectly.

    Thanks a lot.

  3. Here is the code for the weekly report. Enjoy!

    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd“>
    <html xmlns=”http://www.w3.org/1999/xhtml“ xml:lang=”en_US” lang=”en_US”>
    <head>
    <meta name=”generator” content=”HTML Tidy, see http://www.w3.org” />
    <meta http-equiv=”content-type” content=”text/html; charset=UTF-8″ />
    <!–<meta http-equiv=”refresh” content=”1;URL=http://srv1/isa/Daily_(4.25.2007-4.25.2007)/report.htm“ / –>
    <script type=”text/javascript”>
    //<![CDATA[
    function getRptDate()
    {
    var now = new Date();
    var yday = now.getDay() + 1;
    <!– Calculate the ending day of last week( Saturday)  –>
    var ydate = new Date(now.getTime() – yday * 86400000);
    var yday = ydate.getDate();
    var ymon = ydate.getMonth() + 1;
    var yyear = ydate.getFullYear();
    <!– Calculate the beginning day of last week( Monday)  –>
    var yday1 = now.getDay() + 7;
    var ydate1 = new Date(now.getTime() – yday1 * 86400000);
    var yday1 = ydate1.getDate();
    var ymon1 = ydate1.getMonth() + 1;
    var yyear1 = ydate1.getFullYear();
    var datetext = ymon1 + ‘.’ + yday1 + ‘.’ + yyear1 + ‘-‘ + ymon + ‘.’ + yday + ‘.’ + yyear;
    return datetext;
    }
    //]]>
    </script>
    </head>
    <body>
    <script type=”text/javascript”>
    <!–
    var d = getRptDate();
    var path = ‘http://srv1/isa/‘;
    <!– document.write(d);  –>
    window.location = path +’Weekly_(‘ + d + ‘)/report.htm’;
    //–>
    </script>
    </body>
    </html>

  4. Great little pages, except for one thing. I am in Australia, and our date format is dd/mm/yyyy, the ISA reports all come out with a folder date of mm/dd/yyyy.

    Any idea how to resolve (without changing the regional settings on my servers?)

  5. If I understand you correctly the fix is simple. Just edit the daily.htm webpage and change line 16 to:

    var datetext = ymon + '.' + yday + '.' + yyear + '-' + yday + '.' + ymon + '.' + yyear;

  6. Hi Bill

    Thanks for the response, I didn’t need to edit anything in the htm for the date to work. But one other question – the Daily.htm works a treat for me, but the weekly and monthly do not. Are they looking for reports to be run on a specific day? I do my weekly on the Sunday and my monthly on the 1st of every month.

    Thanks for any help you can provide.

  7. It should work but let me go over the algorithm and maybe you will find a flaw. The function getday() returns the day of the week(i.e. 0-6) for when you run the report. When you add one to this value and multiply it by 86400000 (the number of milliseconds in 1 day)you get the number of milliseconds since Saturday. You can then subtract that value from the date-time value for today to get the date-time value for Saturday. A similar procedure is performed for last Monday. With both of these date-time values you can then use other JavaScript date functions to format the dates used in the file name for the last weekly report.

    To debug the problem you need to see the dates JavaScript has calculated. I would uncomment the document.write (d) line and comment out the next line. That should display a page with the URL of the report you are trying to display. Tell me what you see.

    Good Luck!

  8. I did what you suggested – and I just get a blank page…. here is the last few lines of code

    <!–
    var d = getRptDate();
    var path = ‘http://svrsbs1/isareports/‘;
    document.write(d);

    //–>

  9. Hi ! This code is just what I’m looking for. However I can’t get it to work. I keep getting a syntax error line 23 Char 1 Code 0.

    Can anyone help me with this please. I’d really love to get this to work.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.