Application Perf Mgmt (BAC / BSM) Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

sitescope api to read particular monitor status

Occasional Advisor

sitescope api to read particular monitor status

 
9 REPLIES
Super Advisor

Re: sitescope api to read particular monitor status

[ Edited ]

Hello ! REST API option will be:

URL:

http://<sitescope_host_name>:<sitescope_port>/SiteScope/api/monitors/snapshots?fullPathsToMonitors=<child folder name in SiS tree below SiS root folder>_sis_path_delimiter_<next child folder>_sis_path_delimiter_<next child folder>_sis_path_delimiter_<monitor name>

example:
http://myhostname:8080/SiteScope/api/monitors/snapshots?fullPathsToMonitors=My first test folder_sis_path_delimiter_My second test folder_sis_path_delimiter_My third test folder_sis_path_delimiter_My test monitor name

Headers:
authorization: Basic <encrypted username and password here>
accept: application/json

 

And result looks like this:

Raw result:
{"My first test folder_sis_path_delimiter_My second test folder_sis_path_delimiter_My third test folder_sis_path_delimiter_My monitor name":{"runtime_snapshot":{"summary":"LastStatus=0, LastStatusValues=true","availability_description":"Data Collected","availability":"true","status":"Good"},"configuration_snapshot":{"associated_alerts_disable_end_time":"","target_name":"<target host name>","associated_alerts_disable_description":"","description":"Application","is_disabled_permanently":"false","type":"Script","disable_end_Time":"","is_associated_alerts_disabled":"false","disable_start_time":"","target_display_name":"SiteScope Server","target_ip":"","name":"My monitor name","acknowledgment_comment":"","updated_date":"1492651212342","full_path":"My first test folder_sis_path_delimiter_My second test folder_sis_path_delimiter_My third test folder_sis_path_delimiter_My monitor name","disable_description":"","associated_alerts_disable_start_time":""}}}

JSON result:
{
"My first test folder_sis_path_delimiter_My second test folder_sis_path_delimiter_My third test folder_sis_path_delimiter_My monitor name": {
"runtime_snapshot": {
"summary": "LastStatus=0, LastStatusValues=true",
"availability_description": "Data Collected",
"availability": "true",
"status": "Good"
},
"configuration_snapshot": {
"associated_alerts_disable_end_time": "",
"target_name": "<target host name>",
"associated_alerts_disable_description": "",
"description": "Application",
"is_disabled_permanently": "false",
"type": "Script",
"disable_end_Time": "",
"is_associated_alerts_disabled": "false",
"disable_start_time": "",
"target_display_name": "SiteScope Server",
"target_ip": "",
"name": "My monitor name",
"acknowledgment_comment": "",
"updated_date": "1492651212342",
"full_path": "My first test folder_sis_path_delimiter_My second test folder_sis_path_delimiter_My third test folder_sis_path_delimiter_My monitor name",
"disable_description": "",
"associated_alerts_disable_start_time": ""
}
}
}

Hope this helps.

Best regards,
Alexey
Occasional Advisor

Re: sitescope api to read particular monitor status

Thanks Alexey,

But I am getting an error saying ....

 


Getting snapshot...SiteScope_sis_path_delimiter_Testing_sis_path_delimiter_test
Snapshot of test
error_message = Invalid path to group. Group could not be found : [Ljava.lang.String;@4eacfd32
error_code = 55200
Snapshot of SiteScope
error_message = Invalid path to group. Group could not be found : [Ljava.lang.String;@6031549c
error_code = 55200
Snapshot of Testing
error_message = Invalid path to group. Group could not be found : [Ljava.lang.String;@7ce69b4f
error_code = 55200

EntitySiteScope_sis_path_delimiter_Testing_sis_path_delimiter_test snapshot was succesfully fetched

 

Command which i am using....

get_monitor_snapshots.bat -host xxxxxxx.com -port 8080 -useSSL false -login admin -password admin -fullPathsToMonitors "Mypath1_sis_path_delimiter_Testing_sis_path_delimiter_test" >test.txt

Super Advisor

Re: sitescope api to read particular monitor status

Hi,

I noticed that you are using full path including root: SiteScope_sis_path_delimiter_Testing_sis_path_delimiter_test

Try this path: Testing_sis_path_delimiter_test

Best regards,
Alexey
Occasional Advisor

Re: sitescope api to read particular monitor status

Hi ALexey,

I tried using Test_sis_path_delimiter_test...

But then also i am getting same result...

 


Getting snapshot...Testing_sis_path_delimiter_test
Snapshot of test
error_message = Invalid path to group. Group could not be found : [Ljava.lang.String;@660a06c8
error_code = 55200
Snapshot of Testing
error_message = Invalid path to group. Group could not be found : [Ljava.lang.String;@1bae6280
error_code = 55200

EntityTesting_sis_path_delimiter_test snapshot was succesfully fetched

 

Command which i am usingg.

get_monitor_snapshots.bat -host xxxxxxxx.xxxxx.com -port 8080 useSSL false -login admin -password admin -fullPathsToMonitors Testing_sis_path_delimiter_test..

Thanks & Regards,

OBAID9469...

Highlighted
HPE Expert

Re: sitescope api to read particular monitor status

Hi OBAID9469,

give it a try with
<SiteScope>\examples\integrations\api\bin\search_entities.bat -host <SIS_hostname> -port <SIS_port> -useSSL false -login <user> -password <password> -name CPU -entityType monitor -maxNumOfResults 100

(assuming that you do have at least one CPU monitor configured),

this will return a list of the first 100 CPU monitors, like below

entity_type = monitor
name = CPU
Here are the results that match your search criterions

Health of my Diag systems/sov02bac29.eu.hpecorp.net Windows/CPU sov02bac29.eu.hpecorp.net = Monitor
WebServer Farm/WebServer Farm CPU Util = Monitor
Health of my Diag systems/sov02bac22.eu.hpecorp.net Windows/CPU sov02bac22.eu.hpecorp.net = Monitor
Health of my Diag systems/sov02bac19.eu.hpecorp.net Windows/CPU sov02bac19.eu.hpecorp.net = Monitor
Health of my Diag systems/sov02bac25.eu.hpecorp.net Windows/CPU sov02bac25.eu.hpecorp.net = Monitor

from there you can take out the path, in my case
"Health of my Diag systems/sov02bac29.eu.hpecorp.net Windows/CPU sov02bac29.eu.hpecorp.net"
or in SiteScope API talk:
"Health of my Diag systems_sis_path_delimiter_sov02bac29.eu.hpecorp.net Windows_sis_path_delimiter_CPU sov02bac29.eu.hpecorp.net"

To check out if the path works, try again, this time using the path and not the name,
so report all monitors under the group "Health of my Diag systems":

search_entities.bat -host <SIS_hostname> -port <SIS_port> -useSSL false -login <user> -password <password> -path "Health of my Diag systems_sis_path_delimiter_" -entityType monitor -maxNumOfResults 100

path = Health of my Diag systems_sis_path_delimiter_
..
Health of my Diag systems/sov02bac22.eu.hpecorp.net Windows/Memory sov02bac22.eu.hpecorp.net = Monitor
Health of my Diag systems/sov02bac19.eu.hpecorp.net Windows/Memory sov02bac19.eu.hpecorp.net = Monitor
..

BTW, this API call works exactly the same wy when using the "normal" path, so using a "/" instead of "_sis_path_delimiter_" as delimiter:

search_entities.bat -host <SIS_hostname> -port <SIS_port> -useSSL false -login <user> -password <password> -path "Health of my Diag systems/" -entityType monitor -maxNumOfResults 100

..
path = Health of my Diag systems_sis_path_delimiter_

entity_type = monitor
Here are the results that match your search criterions

Health of my Diag systems/sov02bac22.eu.hpecorp.net Windows/Memory sov02bac22.eu.hpecorp.net = Monitor
Health of my Diag systems/sov02bac19.eu.hpecorp.net Windows/Memory sov02bac19.eu.hpecorp.net = Monitor
..

and then proceed from there.

I actually recall an issue where the API reported
error_message = Invalid path to group. Group could not be found : [Ljava.lang.String;@1bae6280
error_code = 55200
but it was not at all related to the paht.

BTW, if you really used the command below

get_monitor_snapshots.bat -fullPathsToMonitors Testing_sis_path_delimiter_test..
then I think you need to change it to
"Testing_sis_path_delimiter_test_sis_path_delimiter_"
the path always has to end with a delimiter.

Greetings
Siggi

HPE Support

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
Occasional Advisor

Re: sitescope api to read particular monitor status

Hello,

Thanks for you reply Siggi,

But still i m getting same error...

Using search_entities.bat i am able to get those monitors But when i will call them using get_monitor_snapshots its pinging an alert saying invalid path..

I tried giving "Testing_sis_path_delimiter_test_sis_path_delimiter_".

but still the error remains the same....

Thanks and regards,

OBAID9469...

HPE Expert

Re: sitescope api to read particular monitor status

Hi OBAID9469,

after looking at this in more details, I think the example file get_monitor_snapshots doesn't work as expected.
I didn't try it earlier, but no matter what parameters I use I cannot get it working:

get_monitor_snapshots.bat -host localhost -port 8080 -useSSL false -login admin -password admin
"full_path:Health of my Diag systems_sis_path_delimiter_"

Wrong parameters : full_path:Health of my Diag systems_sis_path_delimiter_
Properties to filter. Each key stored in map will be filtered and not included in returned snapshot.
Allowed filter values:
name, full_path, type, target_ip, target_name, target_display_name, updated_date ...

I assume that I simply cannot provide via command line the map the API call expects in a proper format.

When I use Soap UI, it works like a charm:

screenshot.jpg

Did you already try anything else than just the command line?

BTW, when I use the SOAP UI and don't specify any parameters I also get

{"": {
"error_message": "Invalid path to group. Group could not be found : [Ljava.lang.String;@24d097cb",
"error_code": "55200"
}}

Greetings
Siggi

HPE Support

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
HPE Expert

Re: sitescope api to read particular monitor status

To give me a good feeling for the way to the weekend:

here is another really easy way by using a powershell script:
the script:

$acctname = 'admin'
$password = 'admin'
$url = 'http://sov02bac19.eu.hpecorp.net:8080/SiteScope/api/monitors/snapshots'
$mybody = @{
fullPathsToMonitors = 'Health of my Diag systems_sis_path_delimiter_sov02bac22.eu.hpecorp.net Windows_sis_path_delimiter_Memory sov02bac22.eu.hpecorp.net_sis_path_delimiter_'
}

$params = @{uri = $url;
Method = 'GET'
Headers = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($acctname):$($password)"));
}
}
invoke-restmethod @params -body $mybody | ConvertTo-Json

Executing the script:

C:\Temp>powershell -file sg_example_4_2.ps1

The result:

{
"Health of my Diag systems_sis_path_delimiter_sov02bac22.eu.hpecorp.net Windows_sis_path_delimiter_Memory sov02bac22.eu.hpecorp.net_sis_path_delimiter_":
{
"runtime_snapshot": {
"summary": "82% virtual memory used, 1742MB virtual memory free, 116.40322 pages/sec",
"availability_description": "Data Collected",
"availability": "true",
"status": "Warning"
},

"configuration_snapshot": {
"associated_alerts_disable_end_time": "",
"target_name": "sov02bac22.eu.hpecorp.net",
"associated_alerts_disable_description": "",
"description": "",
"is_disabled_permanently": "false",
"type": "Memory",
"disable_end_Time": "",
"is_associated_alerts_disabled": "false",
"disable_start_time": "",
"target_display_name": "sov02bac22.eu.hpecorp.net Windows",
"target_ip": "",
"name": "Memory sov02bac22.eu.hpecorp.net"
"acknowledgment_comment": "",
"updated_date": "1492787419087",
"full_path": "Health of my Diag systems_sis_path_delimiter_sov02bac22.eu.hpecorp.net Windows_sis_path_delimiter_Memory sov02bac22.eu.hpecorp.net",
"disable_description": "",
"associated_alerts_disable_start_time": ""
}
}
}

Greetings
Siggi

HPE Support

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
Occasional Advisor

Re: sitescope api to read particular monitor status

Hi Siggi,

Thanks for your reply. I am very new to SiteScope and their APIs can you please guide me through SOAP. I read the basic stuff of it and understood theory part of it. But can u guide me how to implement it.

Thanks & Regards,

OBAID9469...

//Add this to "OnDomLoad" event