ehrnst / System-Center-Operations-Manager-API

Microsoft System Center Operations Manager (SCOM) Web API
http://adatum.no/operationsmanager/web-api-for-scom
MIT License
41 stars 6 forks source link

Unable to get Performance data of server #21

Closed HarishAP88 closed 5 years ago

HarishAP88 commented 6 years ago

I am facing the below issue while trying to get the performance data for windows servers.

Please help me to fix the issue { "Message": "No HTTP resource was found that matches the request URI 'http://10.174.180.179/API/Perf/hourly/4b7c21f1-4870-6eb6-8d7d-384cd9b12769?counterName=Percent Memory Used'." }

ehrnst commented 6 years ago

I believe the counter is 'PercentMemoryUsed' without blank spaces. Please reopen if that's not the case

HarishAP88 commented 6 years ago

Hi Ehrnst I have tried without spaces as well still same error.

"Message": "No HTTP resource was found that matches the request URI 'http://10.174.180.179/API/Perf/hourly/8a83570f-1ea0-0fd0-d9d7-7474d886b05e?counterName=PercentMemoryUsed&startDate=2018-04-06 01:00:00.000&endDate=2018-04-07 01:00:00.000

HarishAP88 commented 6 years ago

Can u share me the document what all needs to be enabled on SCOM and DW server so that i will try it once.

I am able to get Alerts .Computers and Objects . Only for Perf i am getting the above Error.

ehrnst commented 6 years ago

Sorry for my very late response. You are sure that your Id is correct? If the user has access to read dB and delegation us in place this should work (assuming different dw server from api)

HarishAP88 commented 6 years ago

user has full access to data base . i have enabled delegation in delegation to db server AD.

ehrnst commented 6 years ago

I am terribly sorry for not responding here. I assume delegation works unconstrained with out issues. Can you confirm the manged entity is correct by using the windows computer endpoint with computername to retrieve the ID, and use it at the performance endpoints?

HarishAP88 commented 6 years ago

HI Ehrnst

I have passed the ID of the computer in the managed entity still facing the same issue. I have attached the screenshot of computer ID.

http://10.134.180.179/API/Perf/5784e71b-fec4-055e-0b2f-052c6757bb01?counterName=PercentMemoryUsed&startDate=2018-04-06 01:00:00.000&endDate=2018-04-07 01:00:00.000 postman

computerid

ehrnst commented 6 years ago

This is very strange. Are you using the latest version? Is the same thing happening with the hourly/daily? just tried my self https://url/API/Perf/2f164b6c-b972-025a-47d5-8c1cc249b27b?counterName=PercentMemoryUsed&startDate=2018-01-15T02%3A00%3A00&endDate=2018-05-16T02%3A00%3A00

HarishAP88 commented 6 years ago

Yes .. I am using the latest version and also tried old version as well but facing the same issue for perf controller for all hourly/daily/monthly..

Can u check and provide the solution ..

HarishAP88 commented 6 years ago

Are u facing the same issue ??

ehrnst commented 6 years ago

No, I'm not, but I will try to install a new instance and check that.

ehrnst commented 6 years ago

I cannot reproduce this. Anyone else who experience this issue, please chime in. Just to be clear, you have the same issue if you don't specify start/end date, right? What does swagger say?

HarishAP88 commented 6 years ago

I am using postman and didn'ttry without startdate adnd enddate.. Let me try once

HarishAP88 commented 6 years ago

Hi Ehrnst,

i found the below while testing in postman

System.Data.SqlClient.SqlException (0x80131904): Cannot open database "OperationsManagerDW" requested by the login. The login failed.

In my env , DW databasename is OperationsManager_ADAPTORDW and i have updated the same in SCOMPerfcontroller.cs file but didnt work amd still it is pointing to OperationsManagerDW database.

Please suggest me where to change it to make it work.

ehrnst commented 6 years ago

Hi,

Of course. I should have taken that in to consideration. Many use different db names. I don't remember putting db config in any other places than that controller and the servername you can set in web.config.

HarishAP88 commented 6 years ago

Thanks Ehrnst. Wen can we get latest API.

As of now i have made the changes in the SCOMperfcontroller.cs and tested it in scom 2012 , its working fine and giving the proper data.

Also when i am trying to test the same in SCOM 2016 instance , it is giving null output ([] )and not throwing any error. I have made the same changes which i have done for 2012 but When i execute the SQl query , it has data for that server.

ehrnst commented 6 years ago

Unfortunately, I don't have any spare time in the coming months to make the dB name configurable. When it comes to 2016 we use that in all our environments, without issues