Cheshire Cat Computing

Software support and information
It is currently Fri May 24, 2013 9:02 am

All times are UTC + 12 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Jul 16, 2008 3:23 am 
Offline
User

Joined: Wed Jul 16, 2008 2:57 am
Posts: 2
Hi Steve,

Great stuff your doing here,
I have a requirement for the company that I'm working for to have a Unix shell script automatically generate the export.csv file that is generated from your perl app. I tried to invoke the link that is attached to the Export button using the unix wget command but it obviously didn't work. I don't believe the wget utility can invoike cgi scripts.

The ultimate goal would be to export the file for a specific graph and transfer it to a remote location where another application would parse it, then perform calculations on specific values and then place the required values into a mysql database.

If you know how I can get that export file generated or perhaps a simpler way to achieve my goal described above it would be greatly appreciated.

Thank you very much for your help in advance.
Jason Chechik


Top
 Profile  
 
PostPosted: Wed Jul 16, 2008 11:51 am 
Offline
Site Admin

Joined: Tue Jul 29, 2003 11:42 am
Posts: 2921
Location: Auckland, New Zealand
There are two ways to achieve this.

1. You can use wget, it does work. You need to pass the correct parameters, and if you have an authenticated system then the authentication as well. If you are using routers2 internal authentication, though, this will not work.

2. You can call routers2 from the command line on the MRTG server, it has special command line options to allow you to pass the device -D, target -T, style -s and type -t. You can also pass the authenticated username this way if you have authenication enabled. Older versions have a bug that still outputs the HTML header in this case, so watch out for this one.

Authentication can mess things up as routers2 will not hand over the csv if it thinks you're not entitled to it.

Code:
[root@seta etc]# /u01/www/cgi-bin/routers2.cgi -D hosts-mail/groucho.cfg -T groucho-load -C -U sshi052
"Hostname","Target","Sample Date YMD","Sample Time HHMM","Count in seconds","Load average","Peak load average"
"hosts-mail/groucho.cfg","Load Average",2008/07/15,10:35,1216074900,1.3,1.3
"hosts-mail/groucho.cfg","Load Average",2008/07/15,10:40,1216075200,0.8,0.8

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile  
 
PostPosted: Thu Jul 17, 2008 7:29 am 
Offline
User

Joined: Wed Jul 16, 2008 2:57 am
Posts: 2
Thanks Steve very much for your help it very much appreciated.
I got it to work using wget using the get parameters that you stated above.
This is very helpful and I truely do appreciate your timely response.


Top
 Profile  
 
PostPosted: Tue Jan 26, 2010 7:39 pm 
Offline
User

Joined: Fri Jan 22, 2010 7:39 pm
Posts: 6
Hi Steve, sorry I am new to wget. Can you show me how to use it to get the CSV file? Thanks


Top
 Profile  
 
PostPosted: Wed Jan 27, 2010 9:52 am 
Offline
Site Admin

Joined: Tue Jul 29, 2003 11:42 am
Posts: 2921
Location: Auckland, New Zealand
1. Use the web browser to find the appropriate URL to obtain the CSV you're after.
2. Pass this URL to wget -- you may also need to include authentication information if you're running with web server authentication.

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 12 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group