Yes, I intend to. But I need to get the HTTP POSTs working from a machine
other than localhost where WUPG is running.



                                                                                       
                                                          
                      "Chris Allen"                                                    
                                                          
                      <[EMAIL PROTECTED]>           To:      
"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>          
                      Sent by:                           cc:                           
                                                          
                      [EMAIL PROTECTED]         Subject: RE: [WhatsUp Forum] 
Problem using Perl LWP::UserAgent with WUPG w eb interface 
                      pswitch.com                                                      
                                                          
                                                                                       
                                                          
                                                                                       
                                                          
                      09/27/2002 14:51                                                 
                                                          
                                                                                       
                                                          
                                                                                       
                                                          



Would you be willing to share your script with anyone else? I for one would
like to see what you have done to automate the adding of nodes.

Thanks,
Chris

>  -----Original Message-----
> From:     "Craig Williams"
> <[EMAIL PROTECTED]>@INTERNET@HHC
> Sent:     Friday, September 27, 2002 2:39 PM
> To: [EMAIL PROTECTED]
> Subject:  [WhatsUp Forum] Problem using Perl LWP::UserAgent with WUPG
> web interface
>
>
> I've written a Perl script to automate the addition of nodes to
> WhatsUp. I've developed it primarily on my workstation, running
> both the script and the WhatsUp service on the same machine.
>
> I'm at the point of deploying the script via a GPO startup script,
> so it will be running on one server at a time to add itself to the
> WhatsUp service on another server. As well as any new servers as
> the domain grows.
>
> Big surprise, the code that worked fine when both the script and the
> Whatsup were on the same machine does not work when the 2 are
> on different machines. The GETs work fine, but its the POSTs that are
> failing. They always indicate an "Internal Server Error" when
> I run the script from a node where the WUPG server is not local.
>
> This is one of the POST subroutines:
>
> sub write_to_disk {
>
>     # The map changes are only in memory, until we save it to disk
>
>     my $ua = new LWP::UserAgent;
>     my $req = POST $url."/MapSettingsSave.asp", [ Title            =>
> $_[0].'.wup',
>                                                   Active            =>
> '1',
>                                                   Timer             =>
> '60',
>                                                   Timeout           =>
> '5',
>                                                   WriteMapToDiskNow =>
> '1',
>                                                   map               =>
> $_[0].'.wup',
>                                                   end               =>
> 'end' ];
>     print LOGFILE ("POST writetodisk $_[0]\n");
>     $req->authorization_basic($user, $password);
>     $content = $ua->request($req);
>     return;
> }
>
> When I enable debug, all the GETs indicate:
> LWP::UserAgent::_need_proxy: Not proxied
> LWP::Protocol::http::request: ()
> LWP::Protocol::http::request: reading response
> LWP::Protocol::http::request: HTTP/1.0 200 CREATED
> ---The next line is repeated 6 times---
> LWP::Protocol::http::request: need more header data
> ---The next line repated 73 times with varying byte counts---
> LWP::Protocol::collect: read 63 bytes
> LWP::UserAgent::request: Simple response: OK
>
> While all of the POSTs indicate:
> LWP::UserAgent::_need_proxy: Not proxied
> LWP::Protocol::http::request: ()
> LWP::Protocol::http::request: reading response
> LWP::Protocol::http::request: HTTP/1.0 200 CREATED
> LWP::Protocol::http::request: need more header data
> LWP::UserAgent::request: Simple response: Internal Server Error
>
> I've looked at Netmon captures that were successful and unsuccessful.
> There was some difference between the headers, but I tried adding
> the header info to the script and it did not make a difference.
>
> Another thing I noticed is that POST action from a true browser is
> transferred in a single frame:
> .........\w...E..B.`@[EMAIL PROTECTED]/devicesave.a
> sp.HTTP/1.1..Accept:.image/gif,.image/x-xbitmap,.image/jpeg,.image/pjpeg
> ,.*/*..Referer:.http://10.84.20.144:8000/newdevice.asp?map=10.84.220.0.w
> up..Accept-Language:.en-us..Content-Type:.application/x-www-form-urlenco
> ded..Accept-Encoding:.gzip,.deflate..User-Agent:.Mozilla/4.0.(compatible
> ;.MSIE.5.01;.Windows.NT.5.0)..Host:.10.84.20.144:8000..Content-Length:.3
> 20..Connection:.Keep-Alive..Cache-Control:.no-cache..Authorization:.Basi
> c.YWRtaW46YWRtaW4=....map=10.84.220.0.wup&CreateNewDevice=true&Title=new
> host&HostName=127.0.0.1&IP=127.0.0.1&PollType=ICMP&HostType=Workstation&
> Info1=&Info2=&ReadComm=public&WriteComm=&OID=&Logging=1&Monitoring=1&Sta
> rtTime=0000&EndTime=2400&Sun=1&Mon=1&Tues=1&Wedn=1&Thur=1&Fri=1&Sat=1&Po
> llFreq=1&Timeout=5000&DownDep=0&UpDep=0&Notes=&end=end..
>
> But the POST from the script is transmitted in 2 frames.
> Frame1:
> .........\w...E.....@[EMAIL PROTECTED]/devicesave.a
> sp.HTTP/1.0..Authorization:.Basic.YWRtaW46YWRtaW4=..Host:.ilcsw1.xxxxxx.
> acme.com:8000..User-Agent:.libwww-perl/5.51..Content-Length:.409..Conten
> t-Type:.application/x-www-form-urlencoded....
> Frame2:
> .........\w...E.....@....)[EMAIL PROTECTED]'P...x>..map=10.84.220.0.wu
> p&CreateNewDevice=true&Title=zzzzzzzz&HostName=zzzzzzzz.xx.acme.com&IP=1
> 0.84.220.16&PollTyple=ICMP&HostType=Server&Info1=AD+Domain+Controller+an
> d+DNS&Info2=&Snmp=1&ReadComm=bbbbbbbbbbbbbb&WriteComm=aaaaaaaaaaaa&OID=1
> .3.6.1.4.1.232&Logging=1&Monitoring=1&StartTime=0000&EndTime=2400&Sun=1&
> Mon=1&Tues=1&Wedn=1&Thur=1&Fri=1&Sat=1&PollFreq=1&TimeOut=5000&DownDep=&
> UpDep=1371521537&Notes=&end=end
>
> Either way, there is a HTTP/1.0 200 CREATED after each frame.
> Not really sure if this is a LWP usage issue (my first time working
> with it) or an anomaly in the WhatsUp web server.
>
> Thanks
>
>
>
>
> Please visit http://www.ipswitch.com/support/mailing-lists.html
> to be removed from this list.
>
> An Archive of this list is available at:
> http://www.mail-archive.com/whatsup_forum%40list.ipswitch.com/
>

(See attached file: C.DTF)


Attachment: C.DTF
Description: Binary data

Reply via email to