Test available internet bandwidth under Linux

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn

It’s 2015 and somehow I think that is a reason to simply have enough bandwidth for upload and download to help me with my digital life style. Cloud is in, and accessing files from everywhere is tempting. As cloud only means to be able to access data from any internet connection, I can host the data also at home. Only thing needed for this is a upload bandwidth that is not too slow. But what is the upload and download rate available in my data plan? I am a NET customer and after a few upgrades over the years I am not at 15 Mbps. This should give me 2 Mbps upload. How to measure this under Linux?

http://www.netcombo.com.br/internet-2

I found an easy tool to measure upload and download bandwidth: speedtest. It is not part of my Raspberry PI Debian Linux OS, so I had to install it first. After this I am able to check the upload rate and it comes close to the announced 2 Mbps.

Download and run

First step is to download speedtest.

Command:
wget -O speedtest-cli https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py

Next is to make the file executable.

Command:
chmod +x speedtest-cli

Final step is to run the tool. It will automatically test the upload and download bandwidth.

Command: ./speedtest-cli

Result:

Download bandwidth is reprted at 14.5 Mbit and upload at 1.86 Mbit.

Is this enough to stream for instance audio? Command bit rate for MP3 is 128, 192 or 256 Kbps. That is Kilobits per second. 2 Mbps is 2 Mbit == 2000 Kilobits. This is way above 192 Kbps. Streaming audio should not be a problem.

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn

Subsonic on Raspberry Pi

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn

About Subsonic

“Subsonic is an open source, web-based media server. It is written in Java, so it can run on any operating system with Java support. Subsonic supports streaming to multiple clients simultaneously, and supports any streamable media.” (Source: Wikipedia)

My first contact with Subsonic was several years ago. If memory serves me right, it was around 2008 when I was looking for a media software that can be accessed from remote. At that time, Subsonic and the internet didn’t serve me well enough in Rio de Janeiro to continue my endeavor with Subsonic. Only in 2015 I came back to it, thanks to Raspberry Pi. This combination gave me a new look at media access. Up to now the experience I have is good enough to make me want to share it with others. If you want to stream your private music collection without spending money on a cloud based server / service, this blog may be for you.

Pre-Requisites

Install Java 8

Subsonic wants Java 8, and Java 8 is available for Raspberry Pi. You can also download it form the Oracle Java website. The version you need is the one compatible with the Raspberry Pi processor: jdk-8-oracle-arm-vfp-hflt. Or you install it using aptitude.

Command: sudo apt-get install oracle-java8-jdk

This downloads the required packages

Afterwards, Java 8 is configured.

To test if Java 8 is available and correctly installed, just call Java.

Command: java –version

The output shows that Java 8 is installed. Congratulations!

Set JAVA_HOME

Java is installed, but for applications to know where to find it, an environment variable is used: JAVA_HOME. This variable points to the install dir of Java. To not have to configure this for each user, the configuration can be made global to all. The above command installed Java 8 at this location: /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt

Command: sudo vim /etc/environment

Insert JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt

Installation

Download SubSonic

Subsonic can be downloaded from the Project homepage: http://www.subsonic.org/pages/download.jsp

Click the link to go to the download page and copy from there the actual download link and use wget to download it from Raspberry Pi.

Command: wget –O http://downloads.sourceforge.net/project/subsonic/subsonic/5.2.1/subsonic-5.2.1.deb

In case the file wasn’t saved as subsonic-5.2.1.deb, rename it. You do not have to, but it makes things easier.

Install Subsonic

The file downloaded above is a deb file. These files are meant to be used by the debian package manager and contain the actual file to be installed and dependencies.

Command: sudo dpkg -i subsonic-5.2.1.deb

This installs and already starts subsonic. To see the output log:

Command: sudo tail /var/subsonic/subsonic_sh.log

Not exactly what we want, as now sSubsonic is already running, but not configured. To stop subsonic:

Command: sudo /etc/init.d/subsonic stop

Subsonic stores its data in default folders. By default, for Debian it is /var/subsonic. Because subsonic was already started, this folder is created and filled with content, using the default subsonic user: root (yep, BAD, very BAD!).

Configuration

Subsonic will be run in the background at start as a service. For this to work, a subsonic user needs to be configured.

Create user

Command: sudo adduser subsonic

Add the user to the audio group, in caes you want subsonic to output audio.

Command: sudo adduser subsonic audio

How to make subsonic use that user and run under that user id and not as root? The user information is stored in the default subsonic configuration file: /etc/default/subsonic.

Command: more /etc/default/subsonic

The last line must be changed to: SUBSONIC_USER=subsonic

Permissions

Make user subsonic owner of /var/subsonic

Command: sudo chown subsonic:subsonic /var/subsonic –Rv

Reverse Proxy

Subsonic can now be accessed, but I want to be able to access it through my standard web site (this one). I want to do that without having to do much port forwarding or virtual hosts. The easiest solution is to make use of Apache as a reverse proxy.

Change URL

As subsonic will be run from behind a reverse proxy, the standard URL will be different: the URL used will be /subsonic. Therefore, the configuration of subsonic must be made aware of that. To find out the correct parameter, take a look at which parameters Subsonic supports.

Command: subsonic –help

The parameter is context-path. This parameter must be added to the config file.

Configure Apache Reverse Proxy

Add the following RP rules to the config file of the virtual server:

In my case, it is default-ssl

For reverse proxy to work, the module must be enabled.

Command: a2enmod proxy_http

Restart Apache

Command: sudo apache2ctl restart

That’s it from the Apache as reverse proxy part. Subsonic is already configured to use the new URL and Apache is ready.

Start subsonic

To be able to use Subsonic from the internet, just start it and check that everything is working correctly. Start subsonic:

Command: sudo /etc/init.d/subsonic start

Check pid:

Command: ls -alh /run/subsonic.pid

  • Created as user subsonic

Check process:

Command: ps -ef | grep subsonic

Use Subsonic

Log on to Subsonic.

Advanced features

Transcoding

It may be useful to transcode some music files on the fly. For instance, when the consumed bandwidth is too high, FLAC is used or when the user is accessing Subsonic over a low bandwidth network like 4G in Brazil. Subsonic allows for automatic transcoding of files. This feature can be activated for each user and the sampling limit can also be specified. It is therefore possible to define a user for mobile client usage and specify a max bitrate of 128 Kbps for him. The max bandwidth is defined in the user section of the configuration settings.

User settings

Transcoding settings

The programs ffmpeg and lame are installed automatically when Subsonic was installed via Debian package manager.

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn

Dev_disp in yellow state

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn

Installing a SAP NetWeaver ABAP system is easy, keeping it up and running demands a little bit more. Don’t expect a NetWeaver ABAP system to just work, be prepared to do some additional configuration.

Symptom

After starting the SAP NetWeaver ABAP instance, you are not able to connect to it. SAPGui tries to connect, but never finishes. This indicates that the message server accepts connections, but cannot process them. At the server, the startsap command executed successfully, it shows that ASCS and DI were started. But still, no connection is possible. What happened?

Analysis

Taking a look into the dev_disp log reveals that really a problem is going on.

Log file: dev_disp

It is always a good idea to check the connection to the database (here: MaxDB).

Command:
/usr/sap/GWD/DVEBMGS00/exe/R3load –testconnect

The program hangs and never terminates. Also, no trans.log file is created. This indicates a DB problem. Check if the DB is up and running.

  • DB GWD is up and running.

More information about DBMCLI

To get more information about MaxDB database, dbmcli offers the info command: dmbcli info

Command: dbmcli -d GWD -u control,<password> info LOG

Problem

The above command reveals what is causing the problem. The log area is full:

Used size is 100%. MaxDB cannot write anything anoymore to the log area. The solution is to archive the log area so MaxDB gains more space for the log area and is able to save new entires to it. Another command that can be used to find out if the log area is full is:

Command: dbmcli -d GWD -u control,<password> show active


Solution

The solution is to create a backup medium that MaxDB uses to archive its log area to.

Command: medium_put

Best approach is to ensure that a backup medium for DB and for log area are available for MaxDB to use.

Create backup mediums

  1. Log on to MaxDB with dbmcli.
  2. Command: dbmcli –d <DBSID> -u control,<password>

  3. Create medium for data backup

    Command: backup_template_create backup_data_1 to FILE /sap/sapdb/<DBSID>/backup/DAT0001 CONTENT DATA

  4. Create medium for log area backup
  5. Command:backup_template_create backup_log_1 to FILE /sap/sapdb/GWD/backup/LOG CONTENT LOG

  6. Start backup. For this, an open db connection must be established. If you are not already logged on to MaxDB via dbmcli, connect!
  7. Command: db_connect
  8. Backup of data

    Command: backup_start backup_data_1

  9. Backup log area

    Command: backup_start backup_log_1

    *You do the data backup first because this for the log area backup to be executed, a data backup must be run at least once before.

After these steps, a backup for the data content and for the log area was created.

To ensure that the log area is automatically backed up and is not reaching its limit again, activate auto backup.

To get a list of configured mediums available in MaxDB, issue the command medium_getall

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn

SAPControl error. ASCS won’t start

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn

It happened. SAP NetWeaver ABAP instance won’t start anymore. The DB gets up, but the CS simply won’t start. The log file startsap_ASCS01.log show a 401 error.

What happened? SAPstartsrv will start the instance and to do so, it needs to communicate with sapcontrol. To make this communication work a stream is going to be used. For make this work, sapcontrol uses a file located at /tmp. If now this file was deleted while sapcontrol was running, or the owner changed, sapcontrol will have problems in using these file to communicate. A solution to the problem can be found at SAP Note 1565645 – SAP composite note: sapcontrol and and SCN Wiki.

The basic solution is simple: Stop the service, delete any stream file in /tmp and the start the service again. Issue the following commands:

  • sapcontrol -nr 01 -function StopService -user gwdadm <password>
  • rm /tmp/.sapstream*
  • sapcontrol -nr 01 -function StartService <SID>

This creates the sapstream files again:

Important: These files need to be owned by <sid>adm and have the super user bit set.

To see if these three simple commands solved the startup problem of ASCS, run startsap and check the output. In case everything is back to normal, the output will show that the instance is started without error.

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn

Prepare flight data example

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn

Each SAP NetWeaver ABAP system comes with a built-in sample application that allows developers to learn how to use SAP technology. More information about flight sample can be found at SAP Help. Let see how to set up the flight sample and to test it. By default, the ABAP code is installed, but no data is provided. Therefore, the ABAP applications are of no use. First step is to set up the flight data!

Generate flight sample data

  • Transaction: SE38
  • Program: SAPBC_DATA_GENERATOR

Execute the program: . Next screen: select data to be generated.

Execute: . A dialog will pop up, warning that old data will be deleted. Confirm with yes.

Check status at bottom of screen:

Test if data was created

Table data

  • Transaction: SE16
  • Table name: SFLIGHT

Insert no criteria to get a list of all table entries.

Execute. The table entries are returned. If nothing is returned, something went wrong during the data generation step.

Function Module

  • Transaction: SE37
  • Function Module: BAPI_FLIGHT_GETLIST

  • Import parameter: Airline: LH

Execute. The result screen is shown.

The table FLIGHT_LIST needs to contain some values. Select the table to see the returned values.

In case the flight sample data was successfully generated and the user has the permission to execute the BAPI, both the table and the BAPI return valid data.

Trouble shooting

In case the BAPI is not returning any data, but an authorization error, check if the user has the permission to run the BAPI.

Symptom

Table FLIGHT_LIST is empty and RETURN table contains two entries.

Value of table RETURN:

  • No authorization

Root cause

Check missing authorization with transaction SU53.

  • Missing authorization S_FLBOOK

Solution

Assign authorization S_FLBOOK to user.

  1. Create a role with the authorization

  2. Click on Single Role
  3. Create role GUI is shown

  4. Click on tab Authorizations

  5. Click on Change Authorization Data

  6. Add the missing role manually

  7. Insert S_FLBOOK

  8. The role is added, but marked yellow.

  9. Click on the yellow icon. A dialog opens

  10. Confirm.
  11. Now everything is green

  12. Generate the role:
  13. A new dialog opens.

  14. Nothing needs to be done here, just confirm the information.
  15. Status in SAPGui:
  16. Exit the transaction.

  17. Generate

Back in PFCG, select tab user

Assign user to the newly created profile.

Click on User Comparison. A popup is shown, confirm by saving role.

Select complete comparison

Close dialog.

Done. The user has now access to call the BAPI.

Let the world know ...Tweet about this on TwitterShare on Google+Share on FacebookEmail this to someoneShare on LinkedIn