back to notes

passwordless access to Servergraph report



Via these URLs, and the HTML etc. returned by accessing the Servergraph pages:



Login site using cURL

https://unix.stackexchange.com/questions/138669/login-site-using-curl



POSTing Form Data with cURL

https://davidwalsh.name/curl-post-file



Using iconv to convert from UTF-16LE to UTF-8

https://stackoverflow.com/questions/17287713/using-iconv-to-convert-from-utf-16le-to-utf-8



# Login:



$ curl https://sgus2.tectrade.co/sgcgi/launchpad_login.cgi -c cookiefile -d 'sguser=sLD9xAJE&sguser_pwd=VS4p3Q4V'

$ ls -l cookiefile; cat cookiefile

-rw-r--r--+ 1 theskett Domain Users 215 Aug 24 12:35 cookiefile

# Netscape HTTP Cookie File

# https://curl.haxx.se/docs/http-cookies.html

# This file was generated by libcurl! Edit at your own risk.



sgus2.tectrade.co FALSE / FALSE 0 sgsessionid 03972fb3d0423fda4d0215d7dc837929

$ date

24 Aug 2018 12:35:57

$



# Use the cookie to download the file:



$ curl https://sgus2.tectrade.co/archives/dbb_procs.html -b cookiefile --output curl-out.html



% Total % Received % Xferd Average Speed Time Time Time Current

Dload Upload Total Spent Left Speed

100 3972 100 3972 0 0 4934 0 --:--:-- --:--:-- --:--:-- 4928

$ ls -l curl-out.html

-rw-r--r--+ 1 theskett Domain Users 3972 Aug 24 12:36 curl-out.html

$



$ file curl-out.html

curl-out.html: HTML document, Little-endian UTF-16 Unicode text

$



# You may need ASCII rather than UTF-16 (vi is happy, less is unhappy, here)



$ iconv -f UTF-16 -t UTF-8 curl-out.html > new-curl-out.html

$ cat new-curl-out.html

<html><meta http-equiv="content-type" content="text/html; charset=utf-16le"><body ><table border=1><tr><th>Server</th><th>Process Name</th><th>Process ID</th><th>Start</th><th>End</th><th>Status</th></tr>

<tr><td>simspsm2</td><td>Database Backup</td><td>101</td><td>2018-08-22-06.00.08</td><td>2018-08-22-06.01.26</td><td>SUCCESS</td></tr>

<tr><td>isbtsm19</td><td>Database Backup</td><td>211</td><td>2018-08-22-06.00.06</td><td>2018-08-22-06.04.15</td><td>SUCCESS</td></tr>

<tr><td>simspsr1</td><td>Database Backup</td><td>772</td><td>2018-08-22-12.17.14</td><td>2018-08-22-12.33.02</td><td>SUCCESS</td></tr>

<tr><td>simspsr2</td><td>Database Backup</td><td>958</td><td>2018-08-22-12.31.33</td><td>2018-08-22-12.46.37</td><td>SUCCESS</td></tr>

<tr><td>louspsr3</td><td>Database Backup</td><td>856</td><td>2018-08-22-12.30.55</td><td>2018-08-22-12.55.43</td><td>SUCCESS</td></tr>

<tr><td>louspsr4</td><td>Database Backup</td><td>879</td><td>2018-08-22-12.43.53</td><td>2018-08-22-13.08.20</td><td>SUCCESS</td></tr>

<tr><td>isbtsm04</td><td>Database Backup</td><td>311</td><td>2018-08-22-06.00.05</td><td>2018-08-22-14.21.55</td><td>&nbsp;</td></tr>

<tr><td>louspsm1</td><td>Database Backup</td><td>335</td><td>2018-08-23-06.00.16</td><td>2018-08-23-06.01.45</td><td>SUCCESS</td></tr>

<tr><td>isbtsm18</td><td>Database Backup</td><td>277</td><td>2018-08-23-06.00.19</td><td>2018-08-23-06.06.45</td><td>SUCCESS</td></tr>

<tr><td>lousps01</td><td>Database Backup</td><td>3105</td><td>2018-08-23-06.00.08</td><td>2018-08-23-06.21.21</td><td>SUCCESS</td></tr>

<tr><td>lousps02</td><td>Database Backup</td><td>4333</td><td>2018-08-23-06.00.05</td><td>2018-08-23-06.23.29</td><td>SUCCESS</td></tr>

<tr><td>simsps04</td><td>Database Backup</td><td>3579</td><td>2018-08-23-09.19.02</td><td>2018-08-23-09.37.08</td><td>SUCCESS</td></tr>

<tr><td>simsps03</td><td>Database Backup</td><td>3233</td><td>2018-08-23-09.31.42</td><td>2018-08-23-09.49.42</td><td>SUCCESS</td></tr>

</table></body></html>


last updated december 2018