Skip to Content
Technical Articles
Author's profile photo Raffael Herrmann

Alerting for SAP CPI and more – an update of RealCore’s CPI Dashboard

I’m happy to announce that from now on version 1.0.3 of the RealCore CPI Dashboard is available. I not just worked “under the hood” but also implemented a new feature – an own Alerting engine. If you’re wondering what the RealCore CPI dashboard is about, I’d recommend a look at the introduction blog post, because this article is only about the changes and new innovations.

The article is split into the following sections:

  • Changes and new Features
    • Alerting Engine
    • Auto-refresh functionality
    • Improvements
  • How to install / upgrade
  • Feedback and Summary

Changes and new Features

The current release (1.0.3) brings two new features as also some improvements and bug fixes with it. Let’s start with the biggest one…

Alerting Engine

The new release of the RealCore CPI Dashboard comes with its own alerting engine. You can configure alert rules via the dashboard and the dashboard’s alerting engine then will check the CPI in a regular interval for those rules. In case of a matching rule (=error) the alerting engine will send out an e-mail to the person(s) who are configured in the respecting alert rules.

When setting up alerting rules, you can choose between rules for messages which filter for specific message criteria or rules for certificates, which can check the validity of keystore entries.

The following screenshot shows the alert rule section of the dashboard. From here on you can either edit or delete existing rules or create new ones.

Clicking on the “Add alerting rule” or “Edit” button will bring up the alert rule editor. The editor displays different fields and filters depending on whether a rule for messages or a rule for certificates should be created. (By the way – you can click the screenshots to enlarge them.)

For message-based rules you can use the message status (failed, retry, completed, …), the sender- and receiver-system name as also the artifact id (it’s the id – not to be confused with the display name of an IFlow!). For sender, receiver and artifact id you can use * as wildcard operator. (Multiple usage of * is possible.) If you don’t enter a value (=empty string), the rule will ignore the filter field.

For certificate-based rules you can filter by name as well as the number of days from which you are warned. (For example, if you set the value to 7, you will be alerted one week before the matching certificates expire.)

Changes in the alert rules will be handled immediately without any deployments, etc.

Alerting – how does it work technically?

You might wonder how this works. Let me give you a short and a detailed answer.

Short version:
Alert rules, configured in the web-frontend of the dashboard, will be send via a webservice to an endpoint of the dashboard-IFlow. The IFlow then saves the alert configuration as JSON file in the CPI’s data store. Another integration process of the dashboard’s IFlow runs regularly, trigger via a timer, reads the alert configuration, then queries the CPI’s apis for messages and keystore entries and compares the results with the given alert rules. If a message or a certificate matches a rule an e-mail will be generated and send out to the receiver defined in the rules.

The alert engine integration process remembers the time of its last run and always queries the delta between the last and the current run. (Only for the very first run, it just checks for the last hour, because there’s no value for “last run date”.) By configuring the timer object, you can define how often the alert engine should do its checks and send out mails.

Detailed answer:
The RealCore CPI dashboard is open source. You can inspect the code and items to the last detail. Feel free to deep dive into our Github repository.

Auto-refresh feature

A second new feature is the “auto-refresh” mode. On the upper right corner (near to the “Print” button) you will find a new button to activate the auto-refresh mode. When activated, the dashboard data will be refreshed automatically every x seconds. The refresh interval can be configured via the small input box right to the auto-refresh button.

Note: There is one restriction for auto-refresh feature. Since this isn’t a real page refresh after some time the session cookie (which stores the credentials you entered when accessing the dashboard) looses its validity. From that point on you will be greeted by a messagebox showing an “401 unauthorized” error. Simply reload the website (F5 key) to re-logon. If you have an idea to bypass this “problem” let me know. Nevertheless, I think its a useful feature, when you want to tightly monitor some of the resource values for a couple of minutes.

Improvements

Besides the above mentioned new features there are some minor changes “under the hood” which I want to share with you.

  1. OAuth handling: The OAuth handling for accessing the SAP CPI OData api was changed from a custom one to the standard solution (via OAuth credential in the HTTP receiver channels). Thus, I hope for a more efficient token handling. (Some users reported OAuth token end of life errors for the last version of the dashboard.)
  2. The code to retrieve usernames/passwords (aka security material) was improved. In the last version it could come to crashes when there were security materials with empty passwords.
  3. The overall error handling was improved. (Even if I hope you never get in touch with errors in the dashboard, in case they occur, they should be shown in a readable manner now.)

How to install / upgrade

Let’s head over to the topic installation/configuration. If you’ve never used the dashboard, you can just follow the installation manual in this blog post.

If you already use the dashboard and want to upgrade, let me summarize the main changes in configuration:

  • Upload the new IFlow from the Github release page
  • Reconfigure the receiver for receiver system “SAP CPI” (the installation manual, linked above, points out the differences)
  • Setup the new mail receiver
  • Set the alert sender address in the “More” tab
  • Configure the alert engine timer in the “Timer” tab

As always – if you have any questions, don’t hesitate to ask me/write a comment.

Feedback and Summary

Round about one and a half month ago I released the initial version of the RealCore CPI dashboard and the feedback since then was overwhelming. I never thought that there would be so much interest in this small tool. Thanks for all your comments, your valuable input, your Github issues reports and the new contacts I made. By delivering this update I hope to give back some of the positive energy to the community.

As written in the last articles – I really appreciate your feedback, ideas and comments. So please let me know what you think about the new version. If you struggle to set it up – write a comment – together we can make it!

Assigned Tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Jonathan Prow
      Jonathan Prow

      Raffael,

       

      Installed and tested alerting, well done.  Great update, thank you for continuing to enhance.

       

      -Jon

      Author's profile photo Jonathan Prow
      Jonathan Prow

      Noticed line 42 in alertCalculateAlerts.groovy has the following - <a href=\"https://p0401-tmn.hci.eu1.hana.ondemand.com/itspaces/shell/monitoring/Messages/%7B%22artifact%22:%22${rule.artifact_id}%22%7D\">

      Author's profile photo Raffael Herrmann
      Raffael Herrmann
      Blog Post Author

      Hi Jon,

      hereby I name you the boss bughunter honorary! This error just didn't pop-up while testing, because it simply worked for me... (I have to become better at this point.)

      I delivered a fix in this Git commit: https://github.com/codebude/cpi-dashboard/commit/a60cc80df53ab8f6735ccb52283c9d764aa4cc99

      In addition I bundled an updated version 1.0.3 with the changes: https://github.com/codebude/cpi-dashboard/releases

      Thank you again for your feedback.

       

      Author's profile photo R. Dingemans
      R. Dingemans

      Thanks for this new and improved version of the awesome CPI Dashboard!

      Author's profile photo Pavel Luginets
      Pavel Luginets

      Hi Raffael,

      Great tool! Thank you.

      One question: Sender and Receiver system in Alert configuration, what is it? is it name of the system in the IFlow? like this one:

      I tried to set Sender system = *CSV* , but it does not work. For the Receiver – the same story.

      It works only for Artifact ID.

      Is it my fault or bug? ?

       

      Thanks in advance.

      Pavel

      Author's profile photo Raffael Herrmann
      Raffael Herrmann
      Blog Post Author

      Hi Pavel Luginets ,

      the answer is: “neither”. The alerting is based on the MessageProcessingLog-webservice (=MPL service). The MPL contains information on the message handling. Parts of the MPL are sender/receiver information.

      The “problem” is the following: There are multiple places in CPI where you can set sender and receiver name. One place is within the IFlow editor, as shown in your screenshots. Unfortunately this names are mainly used for the IFlow diagram. Another place is the IFlow’s metadata dialog as shown in the following screenshot:

      (Edited 2019-11-14)
      This also isn't the place which is used in the MessaProcessingLog. To get values in the MPL, you have to set the message headers "SAP_Sender" and "SAP_Receiver" in your interface.

      Regards,
      Raffael

      Author's profile photo Pavel Luginets
      Pavel Luginets

      Hallo Raffael,

      My IFlow has these settings:

      And in the rule I set so:

       

      But I don't get any mails for this rule.

      Other rule without sender or receiver settings works fine:

       

      Any ideas?

      Gruss, Pavel

      Author's profile photo Raffael Herrmann
      Raffael Herrmann
      Blog Post Author

      Hi Pavel,

      this is strange. To find out the actual values, you could do the following:

      1. Go to https://api.sap.com/api/MessageProcessingLogs/resource
      2. Log on with your S-User if not logged in (upper right corner)
      3. Click on "Configure Environments" and setup your CPI (use the OAuth credentials you configured in the dashboard for CPI access). Save.
      4. Select the newly configured environment in the API environment dropdown
      5. Click on the "Try out" button and query for messages.
      6. Search for a message of your interface in the API response and check the values in the fields "sender" and "receiver"

      If you decide to try the steps explained above, let me know the results. I really like to know, why it isn't working for you.

      Author's profile photo Raffael Herrmann
      Raffael Herrmann
      Blog Post Author

      Hi Pavel Luginets ,

      I figured it out. To “push” the sender-/receiver name to the MessageProcessingLog (and thus make it searchable for the alert tool), you have to define the headers “SAP_Sender” and “SAP_Receiver” in your IFlow. Either do it in a Groovy script like…

      message.setHeader("SAP_Sender", "SoapUI")
      message.setHeader("SAP_Receiver", "Postman")

      …or use a Content Modifier.

      The positive side-effect of setting this headers is that the names are also shown in CPIs standard message monitor like shown in the screenshot below:

      Regards,
      Raffael

      Author's profile photo Pavel Luginets
      Pavel Luginets

      Hi Raffael,

      Yeees. It works now!

      Thanks a lot!

       

      Best regards,

      Pavel