Search the web
Sign In
New User? Sign Up
ploticus · ploticus software support
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Howto use ploticus CGI with ASP/VBS   Message List  
Reply | Forward Message #1358 of 2233 |
Saw a post for someone looking how to do this a couple weeks ago.
Most of the examples with the doc are for Perl, so I wanted to share this.
Follow the basic CGI instructions from the Ploticus doc, such as creating a cgi-bin dir, copying ploticus to that dir, and then read on...
 
If using Server2003, enable pl.exe as a CGI extension in the IIS MMC.
Create a global.asa file in the root of the virtual web root (contents at end of post).
Don't overwrite any existing global.asa. Make a new virtual web root.
Copy the graph.asp (contents at end of post) to your virtual web root.
Make a directory called temp in your virtual web root.
This is the directory where the numeric data for the plot will be temporarily stored.
If using windows integrated security, grant the Group change access to the temp dir.
If using anonymous, grant IUSR_SERVERNAME change access to the temp dir.
For either, also grant the Creator group change access to the temp dir.
Construct/Modify the page where you want to link to the graphs.
 
This example includes 3 files:
global.asa - Global Application Settings file - creates a session variable used to store a list of the temp files created
graph.asp - Link to this from another page, and pass it the parameters of what you would like graphed.
There will be a 3rd file that I won't go into here. Mine is custom to my application, and would not be of benefit. You simply need a page that contains a link such as:
ID and Path are used to define that data will be selected for the graph through SQL.
Label, Server are passed to pl.exe to be included as labels in the graph.
The app I wrote this for is graphing some disk usage data.
 
Graphs will be created dynamically on the server. The global.asa file defines a session timeout of 1 minute, after which the numeric graph data file will be deleted.
This example uses the cron prefab, adjust per your needs. There's also some SQL going on to retrieve the numeric graph data. Adjust depending on how and where you need to retrieve your data.
 
*****BEGIN FILE: GRAPH.ASP*****
<%
sDBserver = "Server"
sDBname = "Database"
sConnStr = "Provider=SQLOLEDB;Server=" & sDBserver &_
      ";Database=" & sDBname &_
      ";Integrated Security=SSPI"
'Create and open the Connection object.
Set oADOconn = Server.CreateObject("ADODB.Connection")
oADOconn.Open  sConnStr
oADOconn.CommandTimeout = 0
%>
<HTML>
<BODY>
<%
sID = Request.QueryString("ID")
sPath = Request.QueryString("Path")
sTitle = Request.QueryString("Server")
sLabel = Request.QueryString("Label")
SQLQuery = "SELECT Date, Used FROM tblHist WHERE ID='" & sID & "' AND Path='" & sPath & "' ORDER BY Date ASC"
Set oRS = oADOconn.Execute(SQLQuery) 
' Get a temporary filename to save chart in that file
sTempFile = "temp/" & Session("FSO").GetTempName
Set oTempFile = Session("FSO").CreateTextFile(Server.MapPath(sTempFile), True)
Do While Not oRS.EOF
 oTempFile.WriteLine oRS("Date") & vbTab & Round(oRS("Used")/1024, 1)
 oRS.MoveNext
Loop
oTempFile.Close
oRS.Close
oADOconn.Close
Set oRS = Nothing
Set oADOconn = Nothing
' Invoke the CGI and pass it the path to the data file
' &-debug
Response.Write "<IMG SRC='/cgi-bin/pl.exe?cgi=1&-prefab&chron&x=1&y=2&xgrid=yes&ygrid=yes" &_
 "&title=" & sTitle &_
 "&name=" & Left(sPath, 2) & " " & sLabel &_
 "&data=" & Server.MapPath(sTempFile) & "'>"
' Store the file with its path in the session object for cleanup
Session("sTempFile" & Session("n")) = Server.MapPath(sTempFile)
' Increment the number of files
Session("n") = Session("n") + 1
%>
</BODY>
</HTML>
*****END FILE: GRAPH.ASP*****
 
*****BEGIN FILE: GLOBAL.ASA*****
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Session_OnStart
 ' Create a FileSystemObject to provide files in the script
 Set Session("FSO") = CreateObject("Scripting.FileSystemObject")
 ' Create a variable that has the number of files created in this session
 Session("n") = 0
 ' Set timeout to be 1 minute
 Session.Timeout = 1
End Sub
Sub Session_OnEnd
 ' Delete the files created in this session
 Dim x
 For x = 0 to Session("n")-1
  Session("FSO").DeleteFile Session("sTempFile" & x), True
 Next
End Sub
</SCRIPT>
*****END FILE: GLOBAL.ASA*****
 


Mon Jan 31, 2005 12:04 am

sleet71-ploticus@...
Send Email Send Email

Forward
Message #1358 of 2233 |
Expand Messages Author Sort by Date

Saw a post for someone looking how to do this a couple weeks ago. Most of the examples with the doc are for Perl, so I wanted to share this. Follow the basic...
Craig Williams
sleet71-ploticus@...
Send Email
Jan 31, 2005
12:04 am

Hi, Is there some equivalent to the command line arg -csmap that I can use in #proc page? According to the docs no. My problem is that the pl.exe invocation is...
Jamie Echlin
jechlin@...
Send Email
Feb 3, 2005
11:13 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help