Categoriearchief: Ted

Monitoring your SAP CF app in SAP Cloud ALM

Introduction

SAP Cloud ALM provides services to perform Real User Monitoring (RUM) which combines data from various sources to see how apps are working and performing. RUM can be enabled using a npm package from SAP to send data to Cloud ALM via a destination.

Setup

Configure SAPUI5

In SAPUI5 you need to add a meta tag to your index.html:

<meta name="sap-ui-fesr" content="/fesr">

This enables SAPUI5 to send OpenTelemetry data to your /fesr endpoint in NodeJS.

OpenTelemetry@SAP

Configure the Approuter

In your xsapp.json you need to point the endpoint to the right destination which is your service api:

"routes": [ { "source": "^/fesr$", "target": "/fesr", "destination": "srv-api", "csrfProtection": false, "authenticationType": "xsuaa" } ]

Setup your Service layer

package.json:

In your service layer you need to add the fesr to otel and xotel-agent packages and configure them. The latest versions of the packages can be found here.

"@sap/fesr-to-otel-js": "https://73555000100200018064.npmsrv.cdn.repositories.cloud.sap/@sap/fesr-to-otel-js/-/fesr-to-otel-js-1.5.6.tgz",

"@sap/xotel-agent-ext-js": "https://73555000100200018064.npmsrv.cdn.repositories.cloud.sap/@sap/xotel-agent-ext-js/-/xotel-agent-ext-js-1.5.15.tgz", },

The start script for your the service layer also needs to be adjusted to use the xotel-agent. This means that the start script needs to be adjusted to:

"start": "node ${NODE_ARGS} ./node_modules/@sap/cds/bin/cds-serve.js",

You also need to add a server.js to your service layer which enables the forwarding of fesr data:

const cds = require("@sap/cds"); const fesr = require("@sap/fesr-to-otel-js"); cds.on("bootstrap", (app) => fesr.registerFesrEndpoint(app)); module.exports = cds.server;

mta.yaml:

In the mta.yaml the following parameters should be set for the service layer:

modules:

  • name: <service module name>

properties:

SAP_CALM_SERVICE_NAME: <application name>

SAP_CALM_SERVICE_TYPE: SAP_CP_CF

OTEL_RESOURCE_ATTRIBUTES: sap.tenancy.tenant_id=<your provider subaccount id>

NODE_ARGS: -r @sap/xotel-agent-ext-js/dist/common/tracer

Create a CALM datacollector Destination

A destination called “CALM_datacollector“ should be present in the subaccount looking like this:

Add a mtaext in Cloud TMS

Because the subaccount id of the OTEL_RESOURCE_ATTRIBUTES property is different for each environment (dev/acc/prd) this property needs to be updated for the ACC and PRD environments via a mtaext file in cTMS and should look like this:

_schema-version: "3.2"
ID: <id-of-your-app>-acc
extends: <id-of-your-app>

modules:

  • name: your-app-srv
    properties:
    OTEL_RESOURCE_ATTRIBUTES: sap.tenancy.tenant_id=<subaccount_id>

This file can be added via cTMS in the transport node configuration per application and version

Usage

After configuring RUM you should be able to see the data in CALM by going to “Operations->Real User Monitoring”. From there you can click through to the requests and see its monitoring data. The data found here combines frontend and service data for specific calls.

Share

Connect a Shelly button to Homekit using MQTT

I bought a Shelli Plus I4 switch which I wanted to use to control my Philips Hue lights using Homebridge. The standard Shelly NG plugin did not work as expected so I started searching for a better solution. I was already using the Homebridge Mqttthing plugin so I investigated if this was capable of getting the right data from the buttons. After some practice I found out that you can create custom scripts in the Shelly which can send the data we need to be able to configure a statelessProgrammableSwitch in Mqttthing.

First I setup all the buttons to be in input mode “button”:

Shelly button Settings input mode set to "button"

Then I enabled MQTT on the Shelly in the “Settings” screen.

After this step I created a script (scripts->add script) in shelly which sends the right payloads to MQTT for Mqttthing to be able to use it:

Shelly.addEventHandler(function(e) {
  if (e.component === "input:0") {
    if (e.info.event === "single_push") {
      MQTT.publish("shelly-slaapkamer/event/input:0", JSON.stringify(0), 0, false);
    }
    else if (e.info.event === "double_push") {
      MQTT.publish("shelly-slaapkamer/event/input:0", JSON.stringify(1), 0, false);
    }
    else if (e.info.event === "long_push") {
      MQTT.publish("shelly-slaapkamer/event/input:0", JSON.stringify(2), 0, false);
    }
  }
  if (e.component === "input:1") {
    if (e.info.event === "single_push") {
      MQTT.publish("shelly-slaapkamer/event/input:1", JSON.stringify(0), 0, false);
    }
    else if (e.info.event === "double_push") {
      MQTT.publish("shelly-slaapkamer/event/input:1", JSON.stringify(1), 0, false);
    }
    else if (e.info.event === "long_push") {
      MQTT.publish("shelly-slaapkamer/event/input:1", JSON.stringify(2), 0, false);
    }
  }
  if (e.component === "input:2") {
    if (e.info.event === "single_push") {
      MQTT.publish("shelly-slaapkamer/event/input:2", JSON.stringify(0), 0, false);
    }
    else if (e.info.event === "double_push") {
      MQTT.publish("shelly-slaapkamer/event/input:2", JSON.stringify(1), 0, false);
    }
    else if (e.info.event === "long_push") {
      MQTT.publish("shelly-slaapkamer/event/input:2", JSON.stringify(2), 0, false);
    }
  }
  if (e.component === "input:3") {
    if (e.info.event === "single_push") {
      MQTT.publish("shelly-slaapkamer/event/input:3", JSON.stringify(0), 0, false);
    }
    else if (e.info.event === "double_push") {
      MQTT.publish("shelly-slaapkamer/event/input:3", JSON.stringify(1), 0, false);
    }
    else if (e.info.event === "long_push") {
      MQTT.publish("shelly-slaapkamer/event/input:3", JSON.stringify(2), 0, false);
    }
  }
});

This enables all data to be sent to MQTT properly.

Afterwards I added the following config to the Homebridge Mqtthing config:

{
    "accessory": "mqttthing",
    "type": "statelessProgrammableSwitch",
    "name": "Slaapkamer schakelaar",
    "logMqtt": true,
    "topics": {
        "getSwitch": [
            {
                "topic": "shelly-slaapkamer/event/input:0"
            },
            {
                "topic": "shelly-slaapkamer/event/input:1"
            },
            {
                "topic": "shelly-slaapkamer/event/input:2"
            },
            {
                "topic": "shelly-slaapkamer/event/input:3"
            }
        ]
    },
    "switchValues": [
        [0,1,2],
        [0,1,2],
        [0,1,2],
        [0,1,2]
    ]
}

This exposes the buttons as buttons in Homekit where you can configure single push, double push and long push for each button:

Shelly switch settings in Homekit
Share

Machine Learning & race cars, toys for boys

Introduction

How can we make machine learning easier to understand for people? This is what Twan, Ronald and I were thinking about. The result is the Anki Overdrive which is controlled by Machine Learning from SAP. It is the first project we created for “Where The Cool Shit Happens” where we are going to post information about innovative projects we did.

Technology

We used bluetooth to communicate with the cars from our iPhone. The iPhone acts as a hub to send car location and lap times to the machine learning engine and to send steering commands to the car from the machine learning engine. The machine learning engine is running on the SAP Cloud Platform.

We also created a SAPUI5 dashboard where you can see how the lap times were over time and information about the state of the current car. Later-on the dashboard might be incorporated into the iOS app.

Share

Machine Learning with BAM, SAP and Expertum

We at Expertum adopted the BAM case in the Run Live Truck, where we used Machine Learning to make the tender handling process much more efficient by finding related tenders in seconds. Old tender documents are analysed and matched to new tender documents using text analysis. BAM can now easily see the potential of a new tender.

Please watch the movie below to see how this was done.

Share

Enabling OData service on SQL Anywhere 17

For a proof of concept I am doing for one of my customers I am installing SQL Anywhere 17 with the OData service enabled to be able to use SAPUI5 on top of the services. After installing SQL Anywhere and following the installation steps I kept running into a very poorly documented error when trying to start the OData service on Linux: “Cannot start OData”

An extensive investigation on internet brought me the following solution:

  1. Add the following environment variables to your .bash_profile:
    SQLANY17=/opt/sqlanywhere17
    export SQLANY17
    JAVA_HOME=/opt/sqlanywhere17/bin64/jre180
    export JAVA_HOME
  2. Create a startscript which first initializes the other environment variables and then starts your server (startsqla.sh):
    . /opt/sqlanywhere17/bin64/sa_config.sh
    dbsrv17 -xs “odata(ServerPort=8080;LogFile=sam_odata.txt;LogVerbosity=2)” equidb.db

This will point your start script to the right SQLA installation and JRE. After doing this I was able to finish the tutorial about using SQLAnywhere with the local Web IDE: http://www.msc-mobile.com/blog/how-to-use-sql-anywhere-as-odata-provider-to-build-a-ui5-app-with-the-local-web-ide

Share

SAP Fiori App uitbreiden? Gebruik Web IDE

Iedereen kent ze inmiddels wel, de standaard SAP Fiori apps. Gratis apps van SAP waarmee processen, zoals facturatie, inkoop en hr self-service, eenvoudig mobiel worden aangeboden. In de praktijk zien wij dat klanten toch vaak net iets anders willen. Dan kom je uit op maatwerk SAPUI5 apps, maar nu is er iets nieuws! Met SAP Web IDE, SAP’s nieuwe ontwikkelomgeving, kunnen standaard Fiori apps eenvoudig worden aangepast of uitgebreid. Met de juiste aanpak voorkom je zelfs problemen na updates.

In mijn blog “SAP Web IDE: de verbinder tussen business en IT” heb ik uitgelegd wat de SAP Web IDE kan en waarom je deze oplossing wil gebruiken. In deze blog leg ik uit hoe de SAP Web IDE gebruikt kan worden om de door SAP geleverde Fiori apps aan te passen naar uw wensen.

Op welke manieren kun je SAP Fiori apps uitbreiden?
De SAP Fiori apps zijn gebaseerd op de standaard SAP functionaliteit. Vaak voldoen deze SAP Fiori apps voor 95% en is er voor de overige 5% maatwerk gemaakt/gewenst?. Stel je hebt een fiori app maar die voldoet niet helemaal aan je wensen. Dan zijn dit je opties:

1. Een kopie maken van de Fiori App en deze aanpassen. Het nadeel is allefen dat toekomstige aanpassingen niet eenvoudig in de aangepaste app kunnen worden toegevoegd.

2. Zelf een app bouwen in SAPUI5. Dit is tijdrovend en de meeste SAP klanten proberen hun omgeving zo standaard mogelijk te houden. Waarom zou je zelf een app schrijven als er een standaard SAP app is die bijna voldoet?

3. Je kijkt of de benodigde extension points beschikbaar zijn voor jouw Fiori app. Bekijk hier de beschikbare extension points. Iedere app heeft een pagina waar de extension points besproken worden, je selecteert daarvoor de betreffende app en vind de info onder “App extensibility”.Extension points zijn speciale plekken in de standaard Fiori apps waar klanten eigen specifieke functionaliteit kunnen toevoegen aan de app. Extension points blijven stabiel wanneer er een update voor je Fiori app komt. Als deze extension points voldoen aan je behoefte kun je de Fiori app hiermee uitbreiden. De SAP Web IDE bevat verschillende hulpmiddelen om deze uitbreidingen eenvoudig te doen.

Wat zijn de mogelijkheden van extension points?
Het is mogelijk om een view en controller aan te passen. Hiervoor zijn verschillende extension points toegevoegd in de Fiori apps. Daar kun je extra functionaliteit aanpassen of bijvoorbeeld een veld verbergen of extra informatie toevoegen. Mocht de standaard OData service niet genoeg informatie bevatten om te tonen dan kan deze vervangen worden door een custom service. Hiermee is het mogelijk om andere data te tonen in je app dan beschikbaar was in de standaard Fiori OData service.

Hoe eenvoudig is het customizen van apps met extension points?
Via de Cloud Connector kan een Fiori applicatie als “Extension” project geladen worden in de Web IDE. Met Cloud Connector kun je vanuit het HANA Cloud Platform (HCP) een connectie maken naar je SAP ABAP systeem. Er is een speciale “Extensibility pane” in de Web IDE waarin je kunt zien welke onderdelen je precies uit kunt breiden.

SAP_Fiori_uitbreiden_SAP_Web_IDE1

 

Wanneer de aanpassing klaar is kan het nieuwe project op de on premise ABAP stack teruggezet worden maar het is ook mogelijk om deze te deployen op het HANA Cloud Platform.

Conclusie
Wanneer de behoeft bestaat om SAPUI5 te gebruiken loont het om eerst te kijken of er een Fiori app bestaat die (voor een groot gedeelte) voldoet aan de requirements. De Fiori apps laten zich eenvoudig aanpassen naar uw wensen. De SAP Web IDE maakt dit nog eenvoudiger door de extra toolset.

Share

SAP Web Dispatcher IP restriction

For a client I was investigating how to apply ip restriction to web services on Netweaver. I found out that ip filtering on webservice level ( in code ) was not an option so I investigated ip restriction on the Web dispatcher. This will only work if the NetWeaver AS Java is only connected to through the web dispatcher.

The following configuration has to be done on the webdispatcher to enable ip restriction:

1. Add the following line to your web dispatcher profile:
icm/HTTP/auth_0 = PREFIX=/,PERMFILE=permissions.txt

2. Create a permissions.txt file with the following format:
#P/D/S <URI pattern$gt; <USER> <GROUP> <CLIENT IP> <SERVER IP>

EXAMPLE
P /irj/* * * * *
P /webdynpro/* * * * *
P /wsnavigator/* * * * *
P /RestictedWebService/* * * 172.20.161.61 *
P /sap/wdisp/admin/* * * * 127.0.0.1
D /* * * * *

Share

Using AWStats with the SAP Web Dispatcher

It is very easy to get statistical data from the WebDispather log files. For this example I use AWStats which gives you some basic information about the usage of your portal.

The following steps have to be performed to be able to use AWStats from the WebDispatcher administration console:

1. configure logging in webdispatcher, add the following line to your configuration:

icm/HTTP/logging_0 = PREFIX=/, LOGFILE=access_%y-%m%-%d.log, SWITCHTF=day, LOGFORMAT=%h %l %u %t “%r” %s %b “%{referer}i” “%{user-agent}i”

2. download and install perl

3. download and configure awstats:
LogFile=”C:/SAP/webdispatcher/access_%YYYY-%MM%DD.log”
LogFormat = “%host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot”
DirIcons=”/sap/wdisp/admin/icon”

4. copy files to webdispatcher admin area (C:\SAP\webdispatcher\admin\awstats)
awstats.pl
awstats..conf
awstats_buildstaticpages.pl
lang folder
lib folder
plugins folder

5. copy icon folder to C:\SAP\webdispatcher\admin

6. create update script for static pages:
perl awstats.pl -config= -update
perl awstats_buildstaticpages.pl -config=

7. update nav.icp for navigation integration

<!–Added awstats functionality –>
<tr>
<td valign=”top”>
<table cellspacing=”0″ cellpadding=”0″ border=”0″>
<tr>
<td>
<img src=”images/1×1.gif” width=”0″ height=”1″ border=”0″>
</td>
<td nowrap>
<img src=”images/treeview/expander_open.gif” width=”16″ height=”11″ border=”0″>
</td>
<td nowrap width=”100%”>
<span nowrap class=”sapTreNoDsbl” style=”cursor:default;”>Statistics</span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign=”top” class=”sapTreNl2″>
<table cellspacing=”0″ cellpadding=”0″ border=”0″>
<tr>
<td>
<img src=”images/1×1.gif” width=”16″ height=”1″ border=”0″>
</td>
<td nowrap>
<img src=”images/treeview/treeleaf.gif” width=”16″ height=”16″ border=”0″>
</td>
<td nowrap width=”100%”>
<span nowrap class=”sapTreNoDsbl” style=”cursor:default;”>
<a href=”awstats/awstats.<configname>.html” target=”main” class=”sapLnk”>AWStats</a>
</span>
</td>
</tr>
</table>
</td>
</tr>
<!–End of added awstats functionality –>

8. When everything is working correctly, the update script created in step 6 can be scheduled to run frequently and your AWStats data can be selected from the Webdispatcher administration console navigation tree.

Share

Volvo V40 carkit problemen na upgrade naar IOS 8 opgelost!

Nadat ik mijn iphone 5s heb geupgrade naar IOS 8 kon ik niet meer bellen via de carkit in mijn volvo V40. Wanneer ik een bluetooth connectie maakte gaf de carkit aan dat ik aan het bellen was terwijl dat niet zo was. Ik kon niet meer ophangen en ook geen muziek meer draaien.

Na wat speurwerk op internet en een aantal oplossingen geprobeerd te hebben kwam ik bij de volgende oplossing die voor mij werkte:

1) Log out of icloud on the iPhone – SETTINGS, ICLOUD, SIGN OUT (AT BOTTOM)
2) Delete car/headset from iphone – SETTINGS, BLUETOOTH, SELECT DEVICE, FORGET THIS DEVICE
3) Reset network connections – SETTINGS, GENERAL, RESET, RESET NETWORK SETTINGS
4) Delete iphone from car memory
5) Restart phone
6) Pair to car/headset as normal
7) Log back into icloud to use icloud features

Geleend van: http://forum.iculture.nl/f28/iphone/f32/iphone-algemeen/158344-bluetooth-problemen-ios8.html#post975342

Share