HPE 3PAR StoreServ Storage
1821912 Members
3109 Online
109638 Solutions
New Discussion юеВ

OPManager - HP 3PAR API

 
SOLVED
Go to solution
Ceciliok
Occasional Contributor

OPManager - HP 3PAR API

We are setting up a Capacity Monitoring Tool called OPManager which is using an API template to integrate with the HP 3PAR. I have enabled wsapi from the command-line but the API URL is not accessible, it is returning an error as show

{"code":9,"desc":"unsupported operation for the resource"}

Kindly assist on how to resolve this

2 REPLIES 2
Dardan
Trusted Contributor
Solution

Re: OPManager - HP 3PAR API

Hi,

What port are you using to connect to 3PAR API? From my experience I've seen that 3PAR API listens on port 8080 even when using a security certificate. On the other hand, Primera arrays listen on port 443.

You might want to start troubleshooting by connecting to 3PAR API using Powershell. See below some lines that can help you:

# 3PAR array information
$username = "your_username"
$password = "your_password"
$APIurl = "https://3PAR_AliasOrIP:8080/api/v1"

# Connect to 3PAR WSAPI
$postParams = @{user=$username; password=$password} | ConvertTo-Json
$headers = @{}
$headers["Accept"] = "application/json"
$credentialdata = Invoke-WebRequest -Uri "$APIurl/credentials" -Body $postParams -ContentType "application/json" -Headers $headers -Method POST -UseBasicParsing
$key = ($credentialdata.Content | ConvertFrom-Json).key

# Poll 3PAR System vvolsset
$headers = @{}
$headers["Accept"] = "application/*"
$headers["Accept-Language"] = "en"
$headers["X-HP3PAR-WSAPI-SessionKey"] = $key
$WSAPIdata = Invoke-WebRequest -Uri тАЬ$APIurl/volumesets/тАЭ -ContentType тАЬapplication/*тАЭ -Headers $headers -Method GET -UseBasicParsing

I assume further that WSAPI is enabled and in active state

3PARarray cli% showwsapi
-Service- -State- -HTTP_State- HTTP_Port -HTTPS_State- HTTPS_Port -Version- ----------------API_URL----------------
Enabled Active Disabled 8008 Enabled 8080 1.6.5 https://3PARarray:8080/api/v1

Restarting WSAPI service (stopwsapi & startwsapi) doesn't do any harm if not in use.

Cheers,
Dardan

___________
Hit the Kudo's button to show appreciation or mark as solution if your question was answered.
Ceciliok
Occasional Contributor

Re: OPManager - HP 3PAR API

@Dardan 

Thank you Dardan,

i was able to create a session using the below out put 

#Credentials
>> $username = "username"
>> $password = "Password"
>>
>> #IP of the 3PAR device
>> $IP = "..........................."
>> #API URL
>> $APIurl = "https://devicename or IP:8080/api/v1"#avoid issues with an invalid (self-signed) certificate, try avoid tabs/spaces as this might mess up the string block
>> #http://stackoverflow.com/questions/11696944/powershell-v3-invoke-webrequest-https-error
>> add-type @"
>> using System.Net;
>> using System.Security.Cryptography.X509Certificates;
>> public class TrustAllCertsPolicy : ICertificatePolicy {
>> public bool CheckValidationResult(
>> ServicePoint srvPoint, X509Certificate certificate,
>> WebRequest request, int certificateProblem) {
>> return true;
>> }
>> }
>> "@
>> [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
>>
>>
>> $postParams = @{user=$username;password=$password} | ConvertTo-Json
>> $headers = @{}
>> $headers["Accept"] = "application/json"
>> $credentialdata = Invoke-WebRequest -Uri "$APIurl/credentials" -Body $postParams -ContentType "application/json" -Headers $headers -Method POST -UseBasicParsing
>> $key = ($credentialdata.Content | ConvertFrom-Json).key

 

However i was unable to connect it to OPmanager because the WSAPI is low version and the device is end of life. 

Cheers

Cecilio.