Technical Articles
Build Your Own SCPI Log Reports And Deploy To SAP BTP – CPI IFlows Monitoring Tool
“Having data Is fine,but It’s what you do with the data that really makes a difference”
This blog post will explain how we can create SCPI – Cloud Platform Integration related reports and deploy it to BTP. Once it deployed, BTP will host this application. We can also get real time data into reports.
Many customers are using third party monitoring tools for monitoring SCPI logs / statuses / errors. Etc.. Customer needs to spend additional amount to purchase these tools (or for licenses ). If you already have SAP BTP (Pay as per your usage) then we can easily build your reports as per our KPI’s. This post will exactly explain the same.
Log Reports
“SCPI already has a lot of Logging & Monitoring Capabilities within the application. For example , you can customize your monitoring tiles to view the corresponding KPIs like how many messages have been processed through your CPI tenant in last 1 hour for up to last 30 days or 90 days or even beyond? How many messages have failed or are in processing? Why a message have been failed? How many total artifacts/Iflows have been deployed? ..etc etc ”
Yes , SCPI will provide monitoring capabilities ..But
- Data it provides is more technical .. Need little SCPI experience to see those details.
- We can’t create custom KPI’s (Explained below) . Need to go with existing capabilities
- Graphical reports are not possible.
We can create our own application in BTP with detailed SCPI logs data /our own KPI’s/Graphical reports ..etc
Advantages Of Having Monitoring Tool:
- We can Easily Monitor and Understand all CPI related Integrations.
- Easy Tracking. No need to Login to CPI
- Can easily Monitor performance Bottlenecks over the period.
- Track No.of Times of Each Iflow running over the time and If it is increasing we can take necessary actions by adding required resources.
- Build your own Custom KPI’s easily.
Architecture :
Here we are building an web application using python and python libraries (Dash, Panda, Flask ..ect ). This code we are deploying into cloud foundry environment using CLI interface.
Architecture Diagram of SCPI Log reports in BTP
Step1: Getting Data From SCPI
Two Approaches
- We can directly call SCPI ODATA API’s and get the required KPI data.
- We can create CPI Iflow to get the required KPI data and convert this Iflow as API (Endpoint Call)
Approach#1: Call Direct SCPI ODATA API’s
SCPI provide ODATA API’s and using these API’s we can get required details from CPI tenant. For more details check Link Cloud Integration ODATA API
Ex: Below code directly calls ODATA API and get the required results.
#Calling SCPI Direct ODATA APIs
url = "https://<<CPI>>-tmn.hci.int.sap.eu2.hana.ondemand.com/"
Username=<<username>>
Password=<<password>>
base_url = url+"api/v1/MessageProcessingLogs?$inlinecount=allpages&$filter=Status eq 'FAILED' and LogStart gt datetime'2022-09-01T00:00:00' and LogEnd lt datetime'2022-09-20T00:00:00'"
r = requests.get(base_url , auth=(Username,Password),headers={"Accept":"application/json"})
#print(r.text)
Approach#2: Create CPI IFlow to get the required KPI data and convert this IFlow as API
In this approach we need to create a CPI Iflow to get the required KPI data.
CPI IFlow
We can call this API directly in our code now
# Calling the CPI IFlow End Point
url = "https://<<CPI>>-iflmap.hcisb.int.sap.eu2.hana.ondemand.com/http/CPIREPORT"
Username=<<username>>
Password=<<password>>
data = '{"StartTime": "2022-09-14T15:00:00","EndTime": "2022-09-20T16:00:00"}'
print (data)
r = requests.post(url , data, auth=(Username,Password),headers={"Accept":"application/json"})
#print (r.text)
Step2: Create Your Web Application
Here i used Python language to build my web application..BTP allows to create you application in our other known languages as well.
In my example i am using Python DASH template and creating some reporting tables.
Web Application in Python
Step3: Create Required Files For Deployment
In order to deploy this app to SAP BTP we need 4 other files along with our python files.
- Procfile
- manifest.yaml
- requirements.txt
- runtime.txt
Step4: Deploy Code into BTP Using Cloud Foundry CLI
Now we need to deploy all our code into BTP using Cloud Foundry CLI. In order to deploy we need cloud foundry should be installed in our machine.
Latest version can be found in : Cloud Foundry
Installation Steps: Cloud Foundry Installation
Login Steps: Cloud Foundry Login
Login
Once you login Successfully then Push your application into BTP
Pushing Application Into Cloud Foundry
Step5: Check and Open Your Application In BTP Cockpit
Once the application successfully deployed we can see an entry in BTP with status STARTED
Application Started in BTP Cockpit and Ready to Use
Now our application is Up and Running….
Web Application running in BTP
Below KPI’s are taken as my use cases:
KPI#1: Get Success/ Failure / Discarded count
This Scenario Report we can see Above.
KPI#2: Get Time Taken To Execute IFlows Over The Time
Total Time Taken
KPI#3: Get Failed IFlows With Error Details
Failed IFlows and Error Message
Conclusion:
I covered few KPI’s in this blog but we can create or build many KPI’s by taking Data and these are useful for real time monitoring of your Integrations.
Thanks, for reading it till the end.
- Hope you find that helpful! Let me know your thoughts on this in the comments section.
- Don’t forget to share this article with your friends or colleagues.
- Feel free to connect with me on any of the platforms below!
Well described Siva Selagala !!
Hi Siva Selagala,
thanks for sharing. How do you deal with monitoring needs regarding outages? Isn't external monitoring always superior because you monitor goes down with the service you are monitoring? At least you would need to deploy the app in a different BTP region to cater for that.
I described it this way.
KR
Martin
Hi Martin Pankraz ,
Thank you for your valuable comment. Yes, In an outage scenario neither BTP nor any other applications hosted in BTP won't work.
I can separate outages into 2 ways ..
1. Planned : In planned scenario customers are notified few weeks before
2. UnPlanned : I hope you are talking about this scenario
Outages we can see very rarely in the current cloud world ... Also, SAP fallows proper procedure (Transparent , Faster Communication) in terms of communicating these to customer.
In my opinion this scenario is less priority (but can't avoid..! ).
Thanks
Siva S
Indeed. The post would profit from adding the SAP-Microsoft co-developed materials for your scenario 1. Your colleagues framed it as "intelligent routing" and published as Discovery Center Mission and SAP sample.
I was referring mostly to your scenario 2 yes. Communication is esstential as you said but also concious decisions on HA strategy. Hence I published dedicated posts on this for SAP Cloud Integration. Get started here.
Thanks for your comment!
KR
Martin
Well articulated!
Hello Siva Selagala,
Truly Apprecitaed , thank you for blog post.