Reply to Message

Reply to Message

View discussion in a popup

Replying to:
MHL2
1 Nickel

Re: Powershell scripts for VPlex performance monitoring

C# code

ServicePointManager.ServerCertificateValidationCallback= ValidateServerCertificate;

            Uriaddress = newUri("https://IP/vplex/cluster configdump");

            HttpWebRequestrequest = HttpWebRequest.Create(address) asHttpWebRequest;

            //request.Headers.Add("Content-Type","application/json");

            request.Headers.Add("username", "service");

            request.Headers.Add("password", "Pass");

            //stringparamData = "{\"args\":\"cluster configdump\"}";

            stringparamData = "{\"args\":\"-ccluster-1\"}"; ;           

            request.Credentials = newNetworkCredential("service", "Pass");

            request.Method = "POST";         

            Encodingencoding = Encoding.UTF8;           

            byte[]postData = encoding.GetBytes(paramData);

            request.ContentLength =postData.Length;

            StreamrequestStream = request.GetRequestStream();

            requestStream.Write(postData, 0,postData.Length);

            using(HttpWebResponse response =request.GetResponse() asHttpWebResponse)

            {

                StreamReaderreader = newStreamReader(response.GetResponseStream());

               Response.Write(reader.ReadToEnd());

                Response.End();

            }