Posts By: admin

compare-icon

Syscompare – a tool for comparing repos across HANA instances

compare-icon.png

A couple of weeks ago I was moving code from 1 hana instance to another trying to keep them in sync. However, I thought there might be a better alternative for comparing the contents of the repos across my systems to ensure that the files matched. After doing some digging and not finding a solution, I decided to write a small tool to do just this, called Syscompare. It is a open source HANA app which uses the new File API and compares the files on each system and displays the differences.

You can read more about the application here, and find the files for the HANA app in Github.

 

Features:

- Compare repos across HANA instances

- Display file differences in the application

- Highlights missing files on each instance

Usage:

- Setup the 2 XSHttpDest files

- Specify the source and target systems (using the xshttpdest file names)

- Specify the repo to compare

Once the processing is complete the app will show a summary of differences:

Screen Shot 2015-06-16 at 10.18.20 PM.png

Screen Shot 2015-06-16 at 10.20.12 PM.png

Screen Shot 2015-06-16 at 10.20.51 PM.png

You can checkout the Github/Source code here: paschmann/Syscompare · GitHub

If you prefer to download the Delivery Unit – please click here and provide your email address (this way I can keep you up to date with changes): metric² | Real-time operational intelligence for SAP HANA

Interested in contributing to the project? Please feel free to fork or submit a pull request.


pastedImage_2

Building a Startup – The “big picture” on your road to success

This is part 3 of my blog series called: “Building a start-up in the SAP HANA space“.

What is considered a “Startup”?

“A startup is a company working to solve a problem where the solution is not obvious and success is not guaranteed”

Neil Blumenthal, cofounder and co-CEO of Warby Parker

Startup or Side Project?

To me, the big difference is your expectations. Generally in a side project, you have little or no expectations of financial reward or success, these projects are a labor of love and something which is intended to help a community or yourself to achieve a  goal. Don’t get me wrong, it could also include financial incentive, like getting paid for your time or materials. A startup is not much different, they too are a labor of love, and command a considerable amount of attention and dedication, however, your goal for the venture is some form of success. This goal is to generate revenue in some shape or form, and often it comes with the pressures of operational overhead, tight release schedules and financial burden.

In my opinion, side-projects which evolve into a startup are the best. Why? Generally side projects are bootstraped by your regular employment, and you spend your spare time working on them, but the great part is that you are not *required* to succeed and have a regular income to sustain your “bad habit” As your side-project evolves, you can decide if you have the required income and  reach to “transition” your project to a startup as it grows.

It will also be evident, when the time is right to transition, because you may have some form of revenue being generated, or you feel you and your project is ready for the next evolutionary step. In doing so you are going to find yourself faced with many challenges and rewards, and much like life, the ups, and more specially the downs, are going to decide the fate of the overall success of your startup.

Below is a description of various stages of a startup lifecycle, we will touch on a few of these in some subsequent blogs:

Discovery

During the discovery stage, startups should be focused on validating whether they are solving a meaningful problem and the potential market share, and impact which is possible. During this time a founding team might be formed, customer interviews conducted and a value proposition is defined. A minimal viable product (MVP) is created and this is a great time to consider joining an accelerator or incubator. You may also consider trying to get some financial support from friends and family or a early stage venture capital company to support your team and visions. Also keep in mind that these the opportunity to pitch your idea to various VC’s can be both positive and negative.

Validation

Your startup should be looking to get early validation from customers, if you have to beg, borrow, donate an organ, or steal these, do it . Every one of your validation contacts are worth their weight in gold. Your goal at this stage is to refine core features, try to gain some initial user growth as well as understand  some key KPI’s which you would like to use to define your startups success. During the validation period is a also good opportunity to consider getting some seed funding and considering building out your team. You will also hopefully gain some paying customers and consider pivoting your product to meet their requirements.

Efficiency

During the efficiency stage, a startup should validate their business model and improve the effectiveness of their customer acquisition process, and avoid losing too many customers in the process. Hopefully by now your value proposition is refined, user experienced overhauled, conversion funnel optimized, and a steady growth pattern is being achieved. From my experience, this is where you start feeling like you are starting to succeed, you have a product which is starting to generate some form of revenue and you often start seeing the direct correlation between a marketing or advertising campaign versus the impact on your customer base.

Scale

During the scale phase, startups step on the gas pedal and try to drive growth very aggressively. This could be driven by a large A Round of funding (or hopefully you have enough in your own bank balance) and you focus on customer acquisition through a ramp up in your sales team. During this stage you brace yourself for load by making scalability improvements, support teams or infrastructure to handle the impact. Hopefully by now your revenue stream or funding has some space for some new executive hires, and you shift your focus from developing your core product to defining some processes to support the product and business services in a structured way.

You may also consider establishing departments and teams within your group to handle some of the administration functions. Starting to sound familiar? If so, it might be time to reconsider that you now have a Company, versus a Startup!

Next Up

Sorry for all the non-technical HANA content in this post, but I really think its important to help you understand where you are, and even more importantly what to expect.

In my next blog post we will chat a bit more about MVP’s (Minimum Viable Product) and we will also look into the SAP Startup Focus program and how it can help you get started and on the path to the first stage of “Discovery”.


pastedImage_0

Building a Startup – Your value proposition and elevator pitch

This is part 2 of my blog series called: “Building a start-up in the SAP HANA space“.

Over the past 15 years, I have developed a variety of applications. Web, mobile, some in the startup realm, some just as side projects, customers projects, partner applications, and the list goes on. Although if there is 1 common denominator across all of them, is that I generally started to write code, before I knew *exactly* what I was going to build. Looking back, I realize why I did this, and generally it was because of all the enthusiasm I had for wanting to make something work, bringing something to reality and showing it *is* possible.

metric² was no different, of course I learned a few things over years, but since I was working with a newer technology, I was keen to get my hands dirty and see what was possible. Before I got started, I put together a list of core features, a technology stack, frameworks to be used, and how it should all be integrated. I thought I was doing things “differently” than before, by starting out with a sure fire plan to develop something which was going to win. But I missed one of the most important topics, my “Value Proposition”.

I think that your value prop should be something that gets “sketched” before you write a single line of code, before you decide what tech stack your app or product is going to be governed by, and before you tell your best friend about your big idea. More specifically, it will be *what* you tell your best friend is your big idea. More often than not, and in my case, my ability to write code, without having a goal in mind causes your “code” or product to define your value proposition which is the wrong way around! It was also extremely difficult for me to blurt out what my application actually was (Just ask Mark Finnern and Phil Loewen), because I wasn’t able to clearly define what my application was to someone. So even though I had written a ton of code, was “pitching” my application and felt like my beta was finished, I went back to the drawing board to try and clearly define my value proposition and what it meant to metric².

So what exactly is a “Value Proposition”?

To me, a value proposition defines what benefit you provide, for who, how, and what makes your service unique over the competition.

Nate Gold once told this story:

The story is told of an unannounced visit by John F. Kennedy to the space center at Cape Canaveral in the mid 1960′s. Kennedy toured the complex and met a man in overalls. “What do you do here?” he asked. The man replied, “I’m earning a living.” Kennedy nodded and moved on. He met another man in overalls and asked him the same question. “I clean away all the rubbish,” the man said. Kennedy smiled and strode on until he met another man in overalls and put the same question again. This time a big smile came across the face of the man who replied, “Mr President, I’m helping to put a man on the moon.”

Nate also suggested that this should be a great example of your Value Prop, I like to think of it as the sum of the parts.

What did I do to create metric² value prop, I sat down and went through the “Hows” of what we do, (which is what Nate suggested), I tried to define what the application or product was trying to accomplish and through what means, and I came up with the statement below.

Whats the difference between a “Value Proposition” and a “Elevator Pitch”?

A elevator pitch is better suited to what you would say to someone who you just meet and they ask what you do. You say it with passion and pride, and its probably more focused on why you are doing what you do. It may also include your value proposition and add to it, or elaborate on a specific topic.

 

I created this elevator pitch for m²:

metric² is developing a easy to use web based platform making it quick and simple to build predictive, streaming and real-time dashboards helping enterprises succeed through data-driven decisions.

Why are these 2 statements important?

Once I decided what they were going to be, I put them up on my wall in front of my desk and every time I develop, or ideate something for m², I take into consideration whether they fall into category of helping to make these 2 statements a reality.

While it might seem like a no-brainer, I really believe that these are the “small” things which count to keeping you on track when building a product. (or on any project where you get to define the scope). I also believe now, that these 2 statements drive my development on the project versus the other way around.

Whats next?

In my next post I plan to chat a little bit about what a startup is? Whats the difference between a startup and a side-project? And more importantly why does it matter? We will also look at some of the stages of building a startup.


startup-ideas

Building a Start-up in the SAP HANA space

I have some fond memories of a television series from the BBC called “A Car is Born” a 15 episode show where the presenter, Mark Evans painstakingly builds a AC Cobra replica. The show highlighted his experiences, trials and tribulations of building something from the ground up.

At TechEd 2014 in Las Vegas I gave a presentation on being a part of the SAP HANA startup program, developing a product, and trying to make an impact in the world of SAP HANA. While its been an interesting ride, I really felt that my 45 minutes up at the podium was really not enough to convey the past 2 years of highs, lows, successes and failures. Since that was the case, I thought I would get back to some blogging about my experiences along the road, hoping that I can inspire, dissuade and educate others about my quest, just like the BBC show. If you are a budding entrepreneur, HANA guru or just wanting to gain some life lessons (at someone else cost), I encourage you to read on, and share your experiences through some of your life journeys.


“You should never underestimate enthusiasm”

Over the past 15 odd years of my life I have developed a myriad of applications, some that succeed, and others which failed miserably, but in every case on my path from taking the product from inception to reality, it has always been done with such optimism and enthusiasm that even if the idea was mediocre, in my eyes it was a clear winner. Sometimes this “fog” can get the better of you, but in most cases its the drive which encourages you to work late and over the weekends with the intention to build something which is going to be a winner.

Working on metric² was no different. I recall spending multiple hours at TechEd/Sapphire hearing about HANA and its opportunity to change the world, wondering what the true benefit of HANA really was, and it was just not evident to me. That was until a few things changed my perception, I was working at a customer site which had 23 different systems being consolidated into a single data mart for a single report which was run daily. People worked tirelessly to ensure 23 different ETL jobs were processed timely, correctly and accurately to produce 1 measly report, and it struck me that this would be a great use-case for HANA. I started to understand and realize more and more of the benefits, technologies like AFL, PAL, XS Engine, Columnar store, In-Memory, etc. are all clear winners to simplify IT at the foundational level. Once I understood the opportunities, the enthusiasm kicked in, and drove me to work tirelessly on metric² through challenges, time constraints and personal issues to deliver something which I *knew* was going to be a success. Yes, by this stage the fog had set-in.


“Getting started”

Since I had started work on the metric² product on .NET/MS SQL (and had 1 customer live) it made a lot of sense for me to switch the infrastructure and re-build it on HANA. It took a bit of a learning curve, but since I had developed multiple web applications in the past, it was simple and straight forward to get up and running with XS. I also went through the OpenSAP course (from Thomas Jung) which gave me some great fundamental understanding of the core technologies and some opportunities to take advantage of. With my new found understanding and development skills I started down the road of developing metric². Sketched napkins, rough architecture drawings and random emails littered my desk describing how metric² should work, but an important I never quite decided was, what and who metric² was really for, what was my target audience and who would ultimately be my end users? Unfortunately, looking back, this was one of my biggest failures in the project and still is a challenge today.

In my next post I will chat about my 1 new requirement which everyone should have before they write a single line of code: Defining your value proposition. PS. This is relevant for any form of project (Internal, external, customer etc.)

 

 

 

 


bg_top

metric² for iPhone and SAP HANA

 

metric² for iPhone lets you monitor your SAP HANA instances from your phone showing you alerts, core resources and important metrics. Wherever you are.

As mentioned in my GitHANA article, developing on the metric² open source project has really provided some interesting use cases for me around SAP HANA. While it might not be as critical as ERP, BW or custom solution, the metric² demo system is used fairly regularly by people wanting to test drive the functionality. I recently had some server troubles and my HANA instances was down without me knowing. This promoted me to develop a small mobile app to monitor and ensure that my instance was available and running optimally. This is when metric² for iPhone was conceived and I started developing the free app.

 

 

The app is currently availble for iPhone, and I have a iPad version getting ready to be submitted to the App store. From a technical perspective the app uses a small XS file called mobileapi.xsjs which will need to be put in a package on your XSEngine instance to serve up the data to the app. You can specify how often you would like the data to be refreshed and specify multiple systems which you may need to monitor. (I have included my demo HANA instance as an example within the app so you can try it out.)

http://metric2.com/img/alerts2.png

 

The app is perfect for anyone running a HANA instance, be dev, test or production. It provides a really easy way to view the status of your system from anywhere using your iPhone. The app also downloads updates in the background and will notify you if any high alerts are experienced on the selected system, this is perfect for any sys admin/dba who will be to anticipate critical outages and be ready for the support calls.

A few features of the app

- View CPU, Disk, Memory consumption
- View open alerts
- Insights into your HANA instance quickly and from anywhere
- Add multiple HANA instances for monitoring
- Clean and simple UI for basic admin functions
- Push notifications for high alerts, when the app is in running background

Click here to find the GitHub project (of the mobileapi.xsjs file) and click here to check out the product page. This includes install instructions.

Technical Details

Building a native iOS (read Obj. C or Swift) which is integrated with SAP HANA is not terribly challenging and you really have 2 options for pulling or pushing data. Via a XSJS type file (like this app) or via a xsOData type of interface. Both have their pro’s and con’s but are fundamentally very similar. Below is a snippet of some of the code from my xsjs file and looks/acts very similar to what a regular AJAX call would use from a native XS app.

One of the biggest challenges for production users, like any intranet based resource, will probably be gaining access to the URL (mobileapi.xsjs) from outside the corporate net and will probably require a network admin to grant you access or configure (or reuse) a reverse proxy or firewall.

Screen Shot 2014-08-22 at 1.08.56 PM.png
Screen Shot 2014-08-22 at 1.12.40 PM.png
XCode iOS Pull Data Code
Screen Shot 2014-08-22 at 12.52.08 PM.png
SAP HANA XSJS Code serving data to the iOS app

Git-HANA-Screenshot

Git <> HANA – A free, open-source Github client for SAP HANA

Git-HANA-Screenshot.jpg

Over the last few months, working on the metric² open source project, I have been frequently updating the GitHub repo. As a heavy XS Web IDE user, this entailed exporting or copying the contents of the files from the package into my local GitHub repository for the project and subsequently committing the files from there. Since there is a small disconnect between the source (my HANA packages) and the destination (GitHub) I like to often see what changes which are due to be committed, the differences between the files, or just compare the files between the 2 systems.

Being over dedicated to building solutions to some of my workflow challenges (see here, here and here), I created yet another small HANA native app called Git <> HANA. The application allows you to compare files between your local HANA package and your (or any other) GitHub repo, and it also lets you commit files directly from the UI to GitHub, and vice-versa. If a file does not exists, it will create it for you (on either side). There are a couple other cool features which you can read about below, or watch the little video I created.

If you are a web IDE user it’s quick and convenient to use, and I am convinced it will make your HANA + GitHub integration easier (I am also hoping we will also see more open source native HANA apps on GitHub as a result!!!!)

Features of Git <> HANA

- Compare files between HANA and Github
- Compare inline or side by side
- Commit files from HANA to GitHub
- Commit/activate files from GitHub to HANA
- Repo/branch selection
- Native HANA application
- Easy HANA package installation
- Open source
- handles .xs* (e.g. .xsaccess, .xsapp) files (which your file system probably does not like!)
- Image comparison
- File browsing can be done via the GitHub repo or your HANA package

You can download the app package here (newsletter sign up requested so I can keep you up to date with the app) or check out the source files here.

If you think this would be helpful or would like to see any other features, or would like to contribute to the source … EXCELLENT, please just let me know

Screenshots

  

Use the HANA Package Browser or GitHub repository as a reference.

Push files from HANA to GitHub or from GitHub to your local HANA package.

Compare Files side by side, or inline

Package Install Instructions

- Download the package
- Open Lifecycle manager (http://<HANA_SERVER>:PORT/sap/hana/xs/lm/)
- Click on Import/Export menu
- Click Import from File
- Browse to the downloaded file
- Edit the index.html file and specify your github username/password (or leave it blank and enter these details using the settings)


pastedImage_0

Hacking SAP HANA Web Sockets

Disclaimer: This is not a production or documented feature – its also more of a hijack than a hack 

 

I have been hoping for the inclusion of Websocket support on the HANA DB platform for a while now, and I was a little disappointed it was not packaged in the SPS08 release. My goal when building apps (or products) is to make use of the core platform its running on as much as possible, I firmly believe that when convincing an IT department, or company, to implement a product or app, the first question is: “How much infrastructure does this need?”. This can often be a deal breaker and why I am such a big proponent of the HANA’s DB + XS App Server integration – it consolidates the requirements into a single investment. Having a Websocket technology built directly in XS can be an additional selling point which developers are starting to expect these days.

A little while ago I wrote a blog post on building a dashboard using the awesome Node.js package from Holger Koser, however I have really been wanting to use Websockets in the metric² platform since the get go. Some comments here and here are prime examples of my long lasting hope of seeing the technology being included in the XS Engine platform sooner rather than later. I recently had a little nudge again from John Patterson to dig back into the topic and did manage to hack something together. The most interesting part of this was that once I had it working, I was left wanting just a little more …

Firstly a little bit about Websockets and why I feel they important to the app/web development world …

Real-time: In the age of having blazingly fast DB’s, we need a UI & server side (In our case XSJS files) integration layer which can display the data to user with as little over head as possible. Web Sockets supports this by providing a low-latency, near real-time connection between a client and the server.

Light Weight: Currently we need to do multiple AJAX calls to our backend server (to the XSJS files) to either perform some complex logic or DML against our database. This is slow and also fairly network intensive as each request (and response) requires additional handshakes and the packet size is considerably larger than just the intended content inside the package. In Web sockets, the requests and responses are really just the content themselves.

Duplexity: Web Sockets by nature are Full-duplex, implying that we can send and receive data at the same time for multiple requests.

Persistence: Web sockets provide a “open” connection between the server and client after the initial upgraded HTTP request handshake has been made. This lets us perform multiple server side requests using the same connection. This also lets the server initiate a response without needing a request from the client side.

The importance of these 4 factors to the web development world and to HANA XS specifically is that this is the missing link for us to take Web applications to the next level.

[Cross-domain support is another great feature!] In this example I was able to successfully have the HTML + JS file local to my PC and execute it against my HANA XSWS service (via a public URL).

– 07/25/2014 — Chris Paine made a good point on potential Cross-domain security issues (see below). Keep in mind that these files are secured just like any of the XS content files, e.g. as long as your folder has a authentication requirement it will persist to this XSWS file as well.

So onto the more interesting HANA specific parts …

 

I initially realized that HANA XS was using Web Sockets in SPS06, when for some reason the XS Engine debugger was not loading correctly due to my user missing some permissions. After searching through the XS code I came across the folder where the debugger was saved and it included a interesting file with the suffix of xsws i.e. XSWebService. After doing more digging I found that Websockets were being loaded in the WebDispatcher config file and I was confident I could find a way to start using it for app development.

After spending some time trying to create my own HANA package with these file extension types I realized that the name is somehow being filtered and only this file, and more specifically, in this location can be executed, otherwise the XS Engine passes back a 403 (forbidden) – I was a little disappointed but it didn’t discourage me … and I decided I would simply re-purpose my Debugger.xsws file for my own needs After a quick backup, I was ready to do some coding …

Essentially, a xsws file is just like any xsjs file, with the exception that it has some socket code returning the responses versus your regular xsjs file. You can do things like $.import for additional libraries as well as perform $.sql functions. Here is a small snippet from the code over on Github.

Debugger.xsws

  1. $.ws.onmessage = function (evt){
  2.     handleIncomingRequest(evt);
  3. }
  4. $.ws.onerror = function (evt) {
  5.     $.trace.debug(“error on connection: “ + evt.message);
  6.     throw new Error(evt.message);
  7. }
  8. $.ws.onclose = function (evt) {
  9.     $.trace.debug(“connection closed, disabling debugger”);
  10.     debugObject.enabled = false;
  11.     throw new Error(“Close status “ + evt.code + “:” + evt.reason);
  12. }

 

 

And this is some of our Client side code making calls the xsws service:

App.js

  1. // Create a new WebSocket. This works fine
  2.   var socket = new WebSocket(‘ws://<ENTER YOUR HANA SERVER HERE>/sap/hana/xs/debugger/api/Debugger.xsws’‘xsCrossfire’);
  3.   // Handle any errors that occur.
  4.   socket.onerror = function(error) {
  5.     console.log(‘WebSocket Error: ‘ + error);
  6.   };
  7. // Send the message through the WebSocket.
  8. socket.send(message);

As you can see – the code and requests are very simple and straight forward, in fact to me they are a little easier than jQuery + AJAX.

One caveat I did find was connection persistence in the event you have an error on the server side, the socket connection can break, in this case you would need a error handling state that attempted a reconnect before submitting any new requests.

A quick screenshot of the running test app i developed and how the server is sending persistence frames pings/pongs to validate the open connection along with the client request and server response.

If you are interested in trying this out on your test or dev instance I have posted the code on Github. Follow these simple instructions to get up and running …

1.) Using the Web IDE, open SAP -> HANA -> XS -> Debugger

2.) Make a backup of the Debugger.xsws file or simply comment out the contents.

3.) Paste the code into the file from Github

4.) Create the Websocket.html file and paste the contents of the Github file

4.) Create the app.js file and paste the contents of the Github file

5.) Open the Websocket.html file and enter any SQL statement

(Be sure you have the debugger security role)

As you can see from the files, the required methods for web sockets are really at a minimum and barely get in your way at all.

Conclusion

At the start of the article I mentioned I was left wanting a little more … this was mainly because since I have been wanting Web Sockets for such a long time, I realized that using it , alone its not really enough. In order for us to really take XS Engine to the next level, we also need to consider a “Publish/Subscribe” feature and a server side timer feature.

The Pub-Sub approach would essentially allow us to push data from the server side, on a specific occurrence of an event, much like a DB trigger. If a new row gets inserted, push the new inserted record to the registered subscriber.

The server side timer feature would allow us to create a server side timer (similar to a xsjob) which would persist and execute the server side function every x secs/mins/hours.

Overall I am pretty impressed with the opportunities Web sockets will bring to the XS Engine. I am hoping they will be included in the next release.


office14

metric² v2.0 release

After releasing metric² at TechEd Las Vegas last year it has had well over a hundred downloads, and has a couple loyal followers always offering advice and feedback (which I am truly thankful for). Last week we released version 2.0 of the free and open source app and subsequently put it onto GitHub under the MIT license which you can find here.

The biggest changes of the new version of metric² include:

  • A new UI (Twitter bootstrap based)
  • The ability for users to create their own account
  • A few new metrics
  • No longer uses SAPUI5 (a blog post in itself!)
  • The biggest change was the front-end/UI and the code has been refactored and split up into multiple library files (XSJSLib) and is simplified for easier reading.

You can download the source code over at Github or you can download the HANA Delivery unit file (tgz) here.

The primary goal of the app is, and always has been to try and visualize your big data. Along with providing a self service tool to monitor and provide insights on the data you have in, and around your HANA system, while using it to the fullest.

Short Survey

I am in the process of trying to understand where to take the app in terms of use and direction and if you are interested in helping guide the discussion, if you have downloaded, used or seen the app I would greatly appreciate if you took 1 minute to complete a short 5 question, multiple choice survey here.

(Read further below for Future updates and the mobile app) ,,,

Below are a few screenshots of the new version (2.0):

Screen Shot 2014-07-06 at 9.11.31 PM.png Screenshot2.png

Mobile App

If you are a HANA admin, or are simply managing your own dev instance for learning HANA, a new iOS app called metric2 – Admin will be in the app store within the next month, it will be a free app with some pretty basic core metrics centered around HANA performance/availability. Below are a few screenshots of the upcoming mobile app:

Screen Shot 2014-07-15 at 3.37.38 PM.png

Next Release

A couple of new features for the upcoming release (v2.1) are centered around some new metrics, including support for iBeacon devices (upload a map, designate regions and you can monitor and track from the live dashboards). Another metric in the process of being developed is around quickly and easily showing twitter sentiment using your HANA instance. Using HANA Live views will also be included as a data source option for the metrics allowing you to make use of the predefined SAP designed views. From a code perspective I am in the process of pulling out widgets to be independent, upgradable and customizable without touching the core code.

As usual if you are using the app in your environment I am always looking for ways to improve it and the feedback provided so far is invaluable. Feel free to leave a comment or reach out to me at paschmann@metric2.com


pastedImage_0

XSOData Service Browser

Introduction

I was recently working on developing a couple of XSOData services for Metric² when I realized that it would be pretty helpful to have a way to develop, test, explore services and queries. I wrote a similar tool for SAP Netweaver Gateway and the iPad a couple years ago, and decided to model it with some similarities, but having the ability to build it directly into HANA using XS, would add some nice integration benefits.

About the App

Some selectable options:

Generated Query:

 

App Design

I figured I would create the app as a web page (Non-MVC) using some UI5 components, and a small open source JS app from Microsoft called OData Query Browser. Since majority of the work is being done by the external js class, to rewrite it into UI5 MVC seemed like overkill

I also made use of a small class I wrote a while back for the SAP Innojam event called HANATalk. (Its a *very* basic synchronous class for HANA in HTML).

HANA Integration

Scouring the _SYS.REPO Schema I found a list of where all the XS objects reside, and filtered out the XSOData services using this query:

  1. SELECT ‘/’ || REPLACE(package_id, ‘.’, ‘/’) || ‘/’ || object_name || ‘.xsodata’ AS url
    FROM _SYS_REPO.runtime_objects WHERE object_suffix = ‘xsodatart’

 

Download

You can find the Github source here, or you can download the complete Delivery Unit Package here.

 

Feedback

As usual, please free to try the app out and let me know what you think and if it could use any improvements.


pastedImage_15

Node.js dashboard for SAP HANA

This is what we will be developing in this blog …

Over the past few years Node.js has really caught my attention. The simplicity of Javascript with server side processing, Non-blocking-IO, Event Driven, and simple integration always intrigued me as a great combination for enterprise applications. (Somehow it sounds similar to HANA XS Engine)
A couple months ago I ran into a similar problem to Jon-Paul Boyd (HANA Forum Post) in which I wanted to use XS Engine for websocket/persistant connections to my HANA Instance, but due to the support not being included in SPS6, I decided to look elsewhere, and ended up using Node.js to fulfill this requirement.In the past, while developing HANA/Node apps, I resorted to creating a XSJS App which really just acted as a middleware layer to push and pull data from my HANA DB, until recently I noticed a great blog post from Ingo Sauerzapf which piqued my interest. The blog mentioned that Holger Koser had created a HANA DB Client for Node making life extremely easy to connect to HANA directly from Node. I thought it would be good share the small project I developed using Node.js and this new client with the community in the hopes that others will share their experiences with the technology.This blog is not necessarily an introduction to Node.js development as there are some nice tutorials and examples out there from Tobias Hoffman and Alessandro Spadoni. The blog is intended to cover a small app developed in Node.js and shows the development process behind it, taking it from conception through to reality. I encourage you to download a few of these components, and also the example out. This app, similar to another app I developed called Metric² (which you can read about here), it is a web based widget showing some friendly KPI’s on the performance of your HANA Instance. The app gets streaming data from our HANA backend displaying this in a friendly, simple dashboard. The dashboard is designed to be shown on a large format monitor in a Ops or IT center and can also very easily be modified to show any KPI’s relevant to your business or needs.

Requirements:

SAP HANA Instance (e.g. AWS Developer Image)

Node.js installed (this does not need to be on the HANA box but same network with access to the HANA port – normally 30015).

Node Dependencies

We will also use a couple of helpful dependencies from the node community including Socket.io, Express and obviously hdb. Installing these packages is as simple as running “npm install hdb”. Once you have the dependencies installed we can start creating our app.

https://nodei.co/npm/hdb.png?compact=true

App Design

For me, I always start mocking up in my favorite Image IDE (Photoshop), I used this image as inspiration for my app. I liked the simplicity, clean layout with focus on the numbers at the bottom. In our case, we will add a small chart in the center, giving us a basic visual representation of the numbers being displayed:

 

Photoshop HTML Mockup
Download the PSD

App Development

Index.html

In this case I decided to use Twitter Bootstrap to help with some of the layout/formatting of the page as well as some mundane tasks like Modal popups. From a coding perspective I started out developing the Single paged “index.html” file, doing my best to stick with my mockup which I previously created. I was sure to “id” all of my elements on this page as we will be updating these values from our node.js backend. This aspect of node development is strictly “traditional” web based development. No need to work with Node or any server for that matter. Once you have your page rendering the way you want, we can move on.

<html>

<head>

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<meta charset="UTF-8"/>

<meta name="viewport" content="width=device-width, maximum-scale=1.0" />

<title>Metric&#178;</title>

<!-- jQuery -->

<script src="https://code.jquery.com/jquery.js"></script>

<!-- Socket.IO -->

<script src='/socket.io/socket.io.js'></script>

<!-- Peity - a lightweight sparkline package for jQuery -->

<script src='js/jquery.peity.min.js'></script>

<!-- Client side code needed -->

<script src='js/client.js'></script>

<!-- Bootstrap CSS -->

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">

<!-- Latest compiled and minified JavaScript -->

<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>

<!-- CSS -->

<link rel="stylesheet" href="css/style.css">

</head>

<body>

<div id="top">

<div>

<div>

<div>

<table>

<tr>

<td rowspan="2" style="text-align: center; width: 10%;" >

<img id="statusicon" src="img/OKIcon.png"/>

</td>

<td style="vertical-align: top;">

<h1><span id="info-name">SAP HANA Instance</span>

<button data-toggle="modal" data-target="#myModal">

<span></span>

</button>

</h1>

</td>

</tr>

<tr>

<td style="padding-top: 20px;">

<span style="margin-left: 0px;" /></span><span id="info-alerts">0</span> Alerts

<span></span><span id="info-version">1.0</span>

<span></span><span id="info-detail">Server Location</span>

</td>

</tr>

</table>

</div>

<div>

<span>0</span>

</div>

<div>

<table>

<tr>

<td id="infoUSERS" onClick="setChart('USERS');">

<!-- The ID of each of our <SPAN> tags is important for updating the data being returned from the server -->

<span id="info-users">0</span><br />

<span>Users</span>

</td>

<td> </td>

<td id="infoDISK" onClick="setChart('DISK');">

<span id="info-disk">0</span> <sup>GB</sup><br />

<span>Free Disk</span>

</td>

<td id="infoMEM" onClick="setChart('MEM');">

<span id="info-mem">0</span> <sup>GB</sup><br />

<span>Free Memory</span>

</td>

<td id="infoCPU" onClick="setChart('CPU');">

<span id="info-cpu">0</span> <sup>%</sup><br />

<span>CPU</span>

</td>

</tr>

</table>

</div> <!-- /.containerfooter -->

</div> <!-- /.container -->

</div> <!-- /.centercontainer -->

</div> <!-- /.top -->

<!-- Modal -->

<div id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

<div>

<div>

<div>

<button type="button" data-dismiss="modal" aria-hidden="true">&times;</button>

<h4 id="myModalLabel">Settings</h4>

</div>

<div>

<form id="modalbox" role="form">

<div>

<label for="servername">Name</label>

<input type="text" id="servername" placeholder="Enter a reference server name">

</div>

<div>

<label for="serverdetail">Location</label>

<input type="text" id="serverdetail" placeholder="Description, Location or Other Information">

</div>

<div>

<label for="bg">Background</label><br />

<label>

<input type="radio" name="bg" value="../img/bg1.jpg" checked> Background 1

</label>

<label>

<input type="radio" name="bg" value="../img/bg2.jpg"> Background 2

</label>

<label>

<input type="radio" name="bg" value="../img/bg3.jpg"> Background 3

</label>

<label>

<input type="radio" name="bg" value="none;"> None

</label>

</div>

<div>

<label for="colorscheme">Color Scheme</label><br />

<label>

<input type="radio" name="colorscheme" value="Dark" checked> Dark

</label>

<label>

<input type="radio" name="colorscheme" value="Light"> Light

</label>

<label>

<input type="radio" name="colorscheme" value="Fiori"> Fiori

</label>

</div>

<div>

<button type="button" data-dismiss="modal">Close</button>

<button type="button" id="modalSave" onClick="saveSettings();">Save changes</button>

</div>

</div><!-- /.modal-content -->

</div><!-- /.modal-dialog -->

</div><!-- /.modal -->

</body>

</html>

App.js

Next we develop the app.js file which is the brains of our operation. This file is firstly going to act as our web server for our web site, and secondly provide the data from our HANA server to the web page, pushing the data via web sockets.

Below is the app.js code, here you can see how we process each request based on the type and subsequently respond with the requested data. You can also see how simple it is to call the HANA DB and respond with the results.

 

var express = require('express'),

http = require('http'),

hdb = require('hdb');

try {

var app = express();

var server = http.createServer(app);

server.listen(3000);

var io = require('socket.io').listen(server);

app.use(express.static(__dirname + '/'));

// development only

if ('development' == app.get('env')) {

app.use(express.errorHandler());

}

var client = hdb.createClient({

host     : 'Your HANA IP Address or DNS Name',

port     : 30015,

user     : 'username',

password : 'password'

});

client.connect(function (err) {

if (err) {

console.error('Connect Error:', err);

} else {

console.log('Connected to server');

}

});

process.on('uncaughtException', function (err) {

console.log('Caught exception: ' + err);

});

strContent = '';

io.sockets.on('connection', function (socket) {

socket.on('request', function (data) {

// Handle Service Requests

switch (data.service) {

case 'CPU':

client.exec("SELECT ABS(SUM(PROCESS_CPU)) as CPU from SYS.M_SERVICE_STATISTICS", function(err, rows) {

if (err) {

console.error('Error:', err);

} else {

socket.emit('response', {service: 'CPU', response: rows[0].CPU});

}

});

break;

case 'MEM':

client.exec("select TO_VARCHAR(ROUND((FREE_PHYSICAL_MEMORY) /1024/1024/1024, 2)) AS FREEMEM

from PUBLIC.M_HOST_RESOURCE_UTILIZATION", function(err, rows) {

if (err) {

console.error('Error:', err);

} else {

socket.emit('response', {service: data.service, response: rows[0].FREEMEM});

}

});

break;

case 'INFO':

client.exec("SELECT VALUE FROM SYS.M_SYSTEM_OVERVIEW WHERE NAME = 'Version'", function(err, rows) {

if (err) {

console.error('Error:', err);

} else {

socket.emit('response', {service: data.service, response: rows[0].VALUE});

}

});

break;

case 'DISK':

client.exec("select TO_VARCHAR((ROUND(d.total_size/1024/1024/1024, 2) - ROUND(d.used_size/1024/1024/1024,2))) as FREESPACE

from ( ( m_volumes as v1 join M_VOLUME_SIZES as v2 on v1.volume_id = v2.volume_id ) right outer join m_disks as d on d.disk_id = v2.disk_id )

where d.usage_type = 'DATA' group by v1.host, d.usage_type, d.total_size,    d.device_id, d.path, d.used_size", function(err, rows) {

if (err) {

console.error('Error:', err);

} else {

socket.emit('response', {service: data.service, response: rows[0].FREESPACE});

}

});

break;

case 'USERS':

client.exec("SELECT COUNT(CONNECTION_ID) as STATUS FROM SYS.M_CONNECTIONS

WHERE CONNECTION_STATUS = 'RUNNING'", function(err, rows) {

if (err) {

console.error('Error:', err);

} else {

socket.emit('response', {service: data.service, response: rows[0].STATUS});

}

});

break;

case 'ALERTS':

client.exec("SELECT COUNT(ALERT_DETAILS) as ALERTCOUNT FROM _SYS_STATISTICS.STATISTICS_CURRENT_ALERTS", function(err, rows) {

if (err) {

console.error('Error:', err);

} else {

socket.emit('response', {service: data.service, response: rows[0].ALERTCOUNT});

}

});

break;

}

});

});

} catch(err) {

console.log(err);

}

 

The App does have a couple of different themes which will hopefully make it fit with your office decor

Below you can see a couple of images of the app running and showing the output. You can obviously very easily modify the code to show anything relevant to your business case as well. The Node-hdb package for node.js really makes developing HANA connected Node apps a breeze! Thanks Holger!

Fiori Styled
Light Theme
Image5.png
Dark Theme
Image6.png
As usual – please feel free to comment on your experience with Node.js and if you feel like this type of technology is a good fit in the enterprise? Do you have any suggestions on what I could have done differently?You can download the app here: Metric² for Node
Credits: The Bokeh backgrounds are from devientArt