another rancher post …. && Roadmap

The entire guide to draft PoC.

 

another rancher post…. && installing rancher

And finally the last part!! Get rancher working!

# Roadmap  Part 6

And finally the most important task!! Schedule everything!!

Prepare  everything to install rancher

  • Configure certbot to get wildcard
  • Install rancher with helm
  • Deploy app using ingress of rancher

 

# Configure certbot to get wildcard

  • Install cerbot
    • Get wildcard dns using txt registration in your registered domain
      • certbot certonly –manual –preferred-challenges=dns –email your@mail  –server https://acme-v02.api.letsencrypt.org/directory –agree-tos -d *.yourregistereddomain
      • Get certs from letsencrypt directory and save cert and pem(fullchain and privkey)

 

 

#Install rancher with helm

 

  • Deploy certificates in cattle-system namespace
    • createt tls.key
    • create tls.crt
    • export KUBECONFIG=yourkubeconfigfile
    • kubectl create ns cattle-system
    • kubectl -n cattle-system create secret tls tls-rancher-ingress –cert=tls.crt –key=tls.key
    • And because it i s a  PoC
      • kubectl -n default create secret tls tls-rancher-ingress –cert=tls.crt –key=tls.key
  • Read. helm chart just. in case.
  •  Install helm tiller for version2. ( i used  helm v2, but you can use helm v3)
    • Install everything needed for helm v2
    • install and add repo for rancher as documentation
  • Install rancher
    • helm install –name rancher rancher-stable/rancher –namespace cattle-system –set hostname=yourhost.yourdomain –set ingress.tls.source=secret
  • Go to your loadbalancer layer4 and add three private ip of rancher node
    • restart it
    • test curl https://your.fqdn
  • Go to your browser in your laptop and check tour domain
    • set admin passwore

 

# Deploy app using ingress of rancher

 

  • Create  deployment for your first web app
  • Create ingress resource using nginx-controller deployed in rancher
  • deploy everything
  • add the new registry in your  domain
  • curl app.fqdn

 

deployment.yaml

 

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    run: myapp
  name: myapp
  namespace: default
spec:
  replicas: 3
  selector:
    matchLabels:
      run: myapp
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        run: myapp
    spec:
      containers:
      - image: nginx
        imagePullPolicy: Always
        name: myapp
       ports:
       - containerPort: 80
         protocol: TCP


 

ingress.yaml

 

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  labels:
    cattle.io/creator: norman
  name: app
  namespace: default
spec:
  rules:
  - host: helloapp.yourfqdn
    http:
      paths:
      - backend:
          serviceName: helloapp
          servicePort: 80
        path: /
  tls:
  - hosts:
    - helloapp.yourfqdn
    secretName: tls-rancher-ingress

 

service.yaml

apiVersion: v1
kind: Service
metadata:
  labels:
    cattle.io/creator: norman
  name: helloapp
  namespace: default
spec:
  clusterIP: None
  ports:
  - name: default
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    workloadID_helloapp: "true"
  type: ClusterIP

You can go  throw default namespace, and in the service change selector to workload if the web page is not working.

another rancher post…. && configure and create your K8s with RKE

And now install your k8s cluster with rke.

# Roadmap Part 5

And finally the most important task!! Schedule everything!!

Prepare  one jumpshost and install k8s cluster with rke

  • Create a vm jumphost with tools
  • Install kubernetes using rke
  • Test it

 

 

# Create a vm jumphost with tools

  • Create a vm in proxmox
    • Use lan  interface
    • Use any OS where support instalation for
  • Check connectivity to internet and rancherOS

 

# Install K8s using rke

  • Create rke  config file
  • load ssh key with ssh-agent
    • eval `ssh-agent`
    • ssh-add PATH_YOUR_PRIVATE_KEY_RANCHER
  • rke -d up -c cluster.yml
  • Connect to other rancherOS and test everything just in case

cluster.yml

nodes:
  - address: 192.168.1.29
    user: rancher
    role:
      - controlplane
      - etcd
      - worker
   ssh_key_path: /home/dalmine/.ssh/id_rsa
 - address: 192.168.1.30
   user: rancher
   role:
     - controlplane
     - etcd
     - worker
   ssh_key_path: /home/dalmine/.ssh/id_rsa
 - address: 192.168.1.31
   user: rancher
   role:
     - controlplane
     - etcd
     - worker
   ssh_key_path: /home/dalmine/.ssh/id_rsa

services:
  kubelet:
    extra_args:
      volume-plugin-dir: /usr/libexec/kubernetes/kubelet-plugins/volume/exec
   extra_binds:
     - /usr/libexec/kubernetes/kubelet-plugins/volume/exec:/usr/libexec/kubernetes/kubelet-plugins/volume/exec

 

After installation you will get two important files:

  • kube_config_cluster.yml. (you will use with  kubectl )
  • cluster.rkestate (it. is important to save change in the cluster to make updates with rke command. )

# Test it

  • bash test
    • export KUBECONFIG=$HOME/kube_config_cluster.yml.
    • kubectl get nodes

 

 

# New Roadmap

And finally the most important task!! Schedule everything!!

Prepare  everything to install rancher

  • Configure certbot to get wildcard
  • Install rancher with helm
  • Deploy app using ingress of rancher

 

 

another rancher post…. && configure your rancherOS nodes

And now  lets go to  prepare our rancher nodes!!

# Roadmap Part 4

And finally the most important task!! Schedule everything!!

Prepare  all vms   for rancher nodes !

  •  Download rancher  Iso proxmox
  • Create three vm  using internal bridge interface
  • Configure cloud-init file
  • Boot rancherOS
  • Install rancherOS
  • Test it

 

# Download rancher iso

Now we need to download our iso to proxmox host.  (I used 1.5.4 ,. it was the latest one at this moment)

root@virt /var/lib/vz/template/iso # pwd
/var/lib/vz/template/iso
root@virt /var/lib/vz/template/iso # ls
CentOS-8-x86_64-1905-boot.iso debian-10.1.0-amd64-netinst.iso rancheros-proxmoxve-autoformat.iso
CentOS-8-x86_64-1905-dvd1.iso install66.iso rancheros-proxmoxve.iso
root@virt /var/lib/vz/template/iso #

 

# Create three vm

  • Create three vm in proxmox dashboard
    • Use bridge internal lan (vmrb1. in my case)
    • At least 1GB memory per machine
    • 10Gb of disk

# Configure cloud-init.yaml

Now we need to create a file to use when we need to instal rancherOS, they are several way to do it, we just create a file a copy it to each one of our three vm.

 

#cloud-config
ssh_authorized_keys:
 - ssh-rsa yourkey
 - ssh-rsa your another other key 
rancher:
 network:
   interfaces:
     eth0:
       dhcp: true




They are several examples and documentation if you need something more complicated.

 

 

# Boot RancherOS

  • Add the image iso to rancher vm
  • Wait prompt to start using rancher
  • Test internet connectivity
  • sudo dhcpd (test if. internal dhcp is working)

 

# Install RancherOS

  • Copy the cloud-init.yaml file
  • run –> ros install -c cloud-init.yaml -d /dev/sda
  • Reboot
  • Repeat for each vm

# Test it

  • Wait vm up and running
  • Test login using key configured from another host in the same network (you can prepare another host or just use openbsd host.
  • ip a s eth0
  • docker ps
  • sudo system-docker ps
  • sudo ros service list

 

 

# New Roadmap

And finally the most important task!! Schedule everything!!

Prepare  one jumpshost and install k8s cluster with rke

  • Create a vm jumphost with tools
  • Install kubernetes using rke
  • Test it

 

another rancher post…. && configure your dns/dchp/loadbalancer

And now in the third part …

# Roadmap Part 3

And finally the most important task!! Schedule everything!!

Prepare  the first VM with Services!!

  •  Download openbsd ISO
  • Install openbsd
  • Configure dhcp
  • Configure Public IP
  • Configure internal interface
  • Configure nsd
  • Configure layer4 balancer

# Download Openbsd

Just go to official openbsd page and choose your iso.

 

#  Install openbsd

I created a server vm in the proxmox environment with:

  • 1 internal LAN
  • 1 bridge interface in public network of Proxmox
    • I bougth an new public IP address for second interface.

–> Instalation:

Just make default instalation as VM in proxmox adding two interfaces, one for public and the other for internal.

 # Configure Public IP

just use the second ip in robot cloud in hetzner,  remember to enable the mac part.  Because if you use bridge interface from host.

 

restaurador# cat /etc/hostname.em0
inet IPV4 NETMASK
restaurador#

 

 # Configure internal interface

Remember you set the internal LAN based in your dhcp where we configure then and of course the internal interface must be aligned with the vmbr1 of host where uses same network of lan.

 

restaurador# cat /etc/hostname.em1
inet 192.168.1.2 255.255.255.0
restaurador#

#  Configure dhcpd

In order to configure dhcpd in openbsd with at least default values we need to edit this file.

 

restaurador# cat /etc/dhcpd.conf
shared-network rancher {
default-lease-time 604800;
option domain-name “mydomain.tld”;
option domain-name-servers 8.8.8.8;
subnet 192.168.1.0 netmask 255.255.255.0 {
#specify the subnet again (see below NB***)
option subnet-mask 255.255.255.0;
#specify the broadcast address for the subnet
option broadcast-address 192.168.1.255;
#specify the gateway to use
option routers 192.168.1.1;

#specify the range of IPaddresses to lease
range 192.168.1.20 192.168.1.40;
}
}
restaurador#

 

Remember it was a test stage everything done here will be secured and reinstall, it was a PoC.

 

# Configure NSD

In this part i had already configured a master NSD in other server and this one i configured as slave. Also you must have a domain registered and make the transfer to your server with your ip. You can use external  authorative dns if you want, this step is necessary in order to create wildcard certs with cert-bot.

 

  • go to /var/nsd/etc
  • run nsd-control-setup
  • create new file nsd.conf, backup the other one.
  • nsd-checkconf nsd.conf
  • nsd-checkzone yourzoneregistered …/zones/slave/your.zone
  • rcctl-enable nsd
  • rcctl restart nsd

 

NSD.CONF

# cat nsd.conf  |grep -v '#'
server: hide-version: yes verbosity: 2
        logfile: "/var/log/nsd.log"
        ip-address: PUBLIC_IP
        minimal-responses: yes

remote-control: control-enable: yes 
  control-interface: /var/run/nsd.sock    
  server-key-file: "/etc/nsd/nsd_server.key"   
  server-cert-file: "/etc/nsd/nsd_server.pem" 
  control-key-file: "/etc/nsd/nsd_control.key"   
  control-cert-file: "/etc/nsd/nsd_control.pem"

key: name: "nameOFkey."
 algorithm: hmac-sha256
 secret: "HASH"

zone: name: "yourzoneregistered"
 zonefile: "slave/your.zone"
 allow-notify: PUBLIC_UP_MASTER FQDN_SLAVE.   
 request-xfr: PUBLIC_UP_MASTER FQDN_SLAVE.

 

your.zone

restaurador# cat your.zone
; zone yourzoneregistered written by NSD 4.2.2 on Mon Dec 23 15:05:03 2019
; received update to serial 2018122301 at 2019-12-23T14:07:13 from PUBLIC_IP_MASTER TSIG verified with key nameOFkey
$ORIGIN com.ar.
yourregistered 3600 IN SOA ns.yourregistered. ns.yourregistereded. ( 2018122301 1440 3600 604800 300 ) 
300 IN NS ns.yourregistered. 
300 IN NS ns2.yourregistereded.
$ORIGIN registered.
caca 300 IN A 1.2.3.4
ns 300 IN A PUBLIC_IP_MASTER 
300 IN AAAA PUBLIC_IPV6_MASTER
ns2 300 IN A PUBLIC_IP_SLAVE
rancher 300 IN A PUBLIC_IP_SLAVE

 

I had my master nsd in other nsd server and te zone was transfered from master.

 

# Configure tcp layer 4

 

Now they are several way to configure your layer4 balancer. (all with tls termination at rancher ingress)

Just copy and paste the configuration of rancher web page, replace the ip address with ip address of your nodes of rancher k8s. Remember install nginx  stream module.

 

# New Roadmap

And finally the most important task!! Schedule everything!!

Prepare  all vms   for rancher nodes !

  •  Download rancher  Iso proxmox
  • Create three vm  using internal bridge interface
  • Configure cloud-init file
  • Boot rancherOS
  • Install rancherOS
  • Test it

Another rancher post … && Proxmox Way

# Roadmap

  1. Rent a baremetal server in hetzner !!  look something cheap and good!! patient!
    1. Install proxmox
    2. Buy another IP
    3. Configure interfaces (private and bridge)
    4. Configure ssh

 

# Install Proxmox

 

# Buy another IP

Buy in the robot dashboard an ip address and use separate mac address, we will use it then.

# Configure interfaces

Configure two interfaces, one in bridge using the Public IP configured and provided by default in proxmox box, and another internal lan.

 

auto lo
iface lo inet loopback
auto enp4s0
iface enp4s0 inet static

auto vmbr0
iface vmbr0 inet static
address MAIN_PUBLIC_IP
netmask 255.255.255.255
pointopoint GW_IP
gateway GW_IP
bridge_ports enp4s0
bridge_stp off
bridge_fd 1
bridge_hello 2
bridge_maxage 12

auto vmbr1
iface vmbr1 inet static
address 192.168.1.1
netmask 24
bridge-ports none
bridge-stp off
bridge-fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s ‘192.168.1.0/24’ -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s ‘192.168.1.0/24’ -o vmbr0 -j MASQUERADE

You will see the same in proxmox dashboard.

# Configure ssh

Configure ssh in port xxxx and reload it.

# New Roadmap

And finally the most important task!! Schedule everything!!

Prepare  the first VM with Services!!

  •  Download openbsd ISO
  • Install openbsd
  • Configure dhcp
  • Configure Public IP
  • Configure internal interface
  • Configure nsd
  • Configure ssh
  • Configure layer4 balancer

Another rancher post … ( ALERT unsecured post steps do not repeat at home ) && Requirements and ideas

The following lines are only a resume of some labs , test and maybe some unuseful way to configure nonprod rancher in baremetal.

 

 

# Scenario

I have my baremetal server with proxmox in hetzner so i want to have a k8s cluster and I decided to deploy it with RKE using RancherOS and then install rancher. The main goal is to have a basic place to work with rancherUI and  use their ingress to deploy my services a start testing my own services in my personal cluster.  Those requirements or way to do everything are not the best way to do everything just only are another way to do test stuff, not so easy no so hard no so performant, just i did for play and I enjoyed a lot!

 

# Requirements

  • Baremetal Server in Proxmox(6)
    • 32gb ram
    • 8 threads (Xeon)
    • Internal disk with hardware raid
    • power supply redundant
    • 1 Gbit Nic
    • A very cheap server for 29euros per month
    • Checks ofers!!
    • 2 Ip. (1 for baremetal, 1 for load balancer)
    • bridge interface
    • private lan interface
  • VM1
    • Openbsd
    • Nginx,gobetween, relayd. (layer4  balancer)
    • cerbot (in order to create wildcard o another certs)
    • nsd (dns authorative)
    • dhpcd (dhcp for vms)
    • 1 Public Ip in bridge of proxmox baremetal interface
    • 1 private lan interface
  • VM2
  • Buy a domain
    • nic.ar
    • set my delegation to my own dns server
  • RancherOS(three vms)
    • Download ISO
    • will be three roles in one each node (controlplane,etcd,worker)
    • 1 interface in private lan
  • Certs
    • wildcard of your domain

 

# Roadmap

And finally the most important task!! Schedule everything!!

 

  1. Rent a baremetal server in hetzner !!  look something cheap and good!! patient!
    1. Install proxmox
    2. Buy another IP
    3. Configure interfaces (private and bridge)
    4. Configure ssh

Those are next step to show you in the new incoming post !!

 

 

 

 

Adding Openbsd to stats repository

Here we are !!

We are in the battle of powerpc arch, thanks to OpenBSD I have working some MacMini and other old powerpc arch!!

You can download this –> https://pkgstat-openbsd.perso.pw/?utm_source=discoverbsd


```
bash-4.4$ cat send_stats.sh
#!/bin/sh

# https://pkgstat-openbsd.perso.pw/receive.php
STATHOST=pkgstat-openbsd.perso.pw
STATPATH=/receive.php

OS=$(uname -s)
if [ ! "$OS" = "OpenBSD" ]
then
printf "$OS isn't supported\n"
exit 2
fi

MACHINE_ID=$((mount -v | sed -ne 's,.* (\(.*\)) on / .*,\1,p'; \
sysctl hw.uuid; hostname) | sha256)
ARCH=$(uname -p)
VERSION=$(sysctl -n kern.version | awk '/^OpenBSD/ { print $2 }')

# Package list with categories and flavors
PKG_LIST=$(pkg_info -q -P)

DATA="uuid=$MACHINE_ID&arch=$ARCH&osversion=$VERSION&pkglist=$PKG_LIST"
# SENDING DATAAAAAAAA !
printf '%s\r\n' \
"POST $STATPATH HTTP/1.1" \
"Host: $STATHOST" \
'User-Agent: sendstats' \
'Accept: */*' \
"Content-length: ${#DATA}" \
'Content-Type: application/x-www-form-urlencoded' \
'' \
"$DATA" \
| nc -w 1 -c "$STATHOST" 443

# Did it work ?
if [ $? -ne 0 ]
then
printf 'Could not send data\n'
exit 3
fi
```

And then you can run it !


bash-4.4$ ./send_stats.sh
sysctl: hw.uuid: value is not available
HTTP/1.1 200 OK
Connection: keep-alive
Content-type: text/html; charset=UTF-8
Date: Sat, 26 Jan 2019 15:55:18 GMT
Server: OpenBSD httpd
Transfer-Encoding: chunked
X-Powered-By: PHP/7.0.32

21
Hello ! You are new ! Welcome :)

0

bash-4.4$

Just wait to see my packaged added there !

Analyzing Kura Logs in CloudService MQTT

This note is about how to understand basic action in kura logs so I asume you have installed kura and mqtt working in your IoT stuff.

BeaconScanner Item

The beaconScanner is a openSource project and you can use the default code or tune your code , in this example we use the default.

The beaconScanner use the bluetooth device so we have this process running maybe it depends hardware.

 

root@rg-10-20-s0:~# ps auxww|grep -i hcidump |grep -v grep
root 12136 0.0 0.0 2132 432 ? S 22:25 0:00 hcidump -i hci0 -R -w /dev/fd/3
root@rg-10-20-s0:~#

Then you can start your BeaconScanner

018-06-10 22:35:23,923 [qtp3671452-143] WARN o.e.k.n.a.v.l.WpaSupplicantConfigReader - WPA in client mode is not configured
2018-06-10 22:35:23,930 [qtp3671452-143] WARN o.e.k.n.a.v.l.PppConfigReader - getModemConfig() :: PPPD peer file does not exist - /etc/ppp/peers/HE910-D_2-1.5
2018-06-10 22:35:24,144 [qtp3671452-143] INFO o.e.k.c.c.ConfigurationServiceImpl - Loading init configurations from: 1528669870428...
2018-06-10 22:35:24,552 [qtp3671452-143] INFO o.e.k.c.c.ConfigurationServiceImpl - Merging configuration for pid: org.eclipse.kura.example.beacon.scanner.BeaconScannerExample
2018-06-10 22:35:24,561 [qtp3671452-143] INFO o.e.k.c.c.ConfigurationServiceImpl - Updating Configuration of ConfigurableComponent org.eclipse.kura.example.beacon.scanner.BeaconScannerExample ... Done.
2018-06-10 22:35:24,597 [Component Resolve Thread (Bundle 6)] INFO o.e.k.l.b.l.BluetoothLeScanner - Starting bluetooth le beacon scan...
2018-06-10 22:35:24,788 [qtp3671452-143] INFO o.e.k.c.c.ConfigurationServiceImpl - Writing snapshot - Saving /opt/eurotech/esf/data/snapshots/snapshot_1528670124562.xml...
2018-06-10 22:35:25,372 [qtp3671452-143] INFO o.e.k.c.c.ConfigurationServiceImpl - Writing snapshot - Saving /opt/eurotech/esf/data/snapshots/snapshot_1528670124562.xml... Done.
2018-06-10 22:35:25,375 [qtp3671452-143] INFO o.e.k.c.c.ConfigurationServiceImpl - Snapshots Garbage Collector. Deleting /opt/eurotech/esf/data/snapshots/snapshot_1528665378674.xml
2018-06-10 22:35:25,839 [qtp3671452-147] WARN o.e.k.n.a.v.l.WpaSupplicantConfigReader - WPA in client mode is not configured
2018-06-10 22:35:25,845 [qtp3671452-147] WARN o.e.k.n.a.v.l.PppConfigReader - getModemConfig() :: PPPD peer file does not exist - /etc/ppp/peers/HE910-D_2-1.5
2018-06-10 22:35:26,062 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Storing message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 22:35:26,068 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Stored message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 22:35:26,081 [DataServiceImpl:Submit] INFO o.e.k.c.d.DataServiceImpl - DataPublisherService not connecte
d

The bold text show you the most important stuff, where the messages is stored, two first bold messages, then try to connect to cloud service (mqtt broker)
The third bold messages is about cloud service, from now is off.

#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 This is the TOPIC, the two first level are set in the kura dashboard the other one are set in the beaconScanner code.

Then after start beaconScanner two new process appear in order to use bluetooth command.
root 13218 0.0 0.0 1588 160 ? S 22:35 0:00 hcitool -i hci0 lescan-passive --duplicates
root 13220 0.0 0.2 2896 1184 ? S 22:35 0:00 /bin/bash /tmp/BluetoothUtil.btsnoopdump.sh hci0
root 13222 0.0 0.0 2132 432 ? S 22:35 0:00 hcidump -i hci0 -R -w /dev/fd/3

If we stop the beaconScanner now, those process must be killed.

2018-06-10 22:48:41,896 [Component Resolve Thread (Bundle 6)] INFO o.e.k.l.b.l.BluetoothLeScanner - Killing hcitool...
2018-06-10 22:48:41,956 [Component Resolve Thread (Bundle 6)] INFO o.e.k.l.b.l.BluetoothLeScanner - Killing btdump...
2018-06-10 22:48:41,956 [Component Resolve Thread (Bundle 6)] INFO o.e.k.l.b.u.BluetoothProcess - Closing streams and killing...

Then just only appear…

root 13222 0.0 0.0 2132 432 ? S 22:35 0:00 hcidump -i hci0 -R -w /dev/fd/3

So if you start the beaconScanner then you remove battery the logs show do not show you anymore this Beacon or if you move this beacon so far away from the scanner.

CLOUDSERVICE
This is thew way where you connect to a broker, using different protocols or services, in this case I m using the same broker created in previous post.
Let start to connect our cloud service from your kura dashboard and then checks logs.(remember we have beaconscanner running but no one beacon are on or near my scanner).

2018-06-10 22:54:20,096 [qtp3671452-42] INFO o.e.k.c.d.DataServiceImpl - Reconnect task running. Stopping it
2018-06-10 22:54:20,097 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - Creating a new client instance
2018-06-10 22:54:20,098 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - Using memory persistence for in-flight messages
2018-06-10 22:54:20,099 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - # ------------------------------------------------------------
2018-06-10 22:54:20,100 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - # Connection Properties
2018-06-10 22:54:20,101 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - # broker = ws://www.itrestauracion.com.ar:9001
2018-06-10 22:54:20,102 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - # clientId = baticueva
2018-06-10 22:54:20,103 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - # username = batman
2018-06-10 22:54:20,103 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - # password = XXXXXXXXXXXXXX
2018-06-10 22:54:20,104 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - # keepAlive = 30
2018-06-10 22:54:20,105 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - # timeout = 20
2018-06-10 22:54:20,105 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - # cleanSession = true
2018-06-10 22:54:20,106 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - # MQTT version = 3.1.1
2018-06-10 22:54:20,106 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - # willDestination = dc/batman/baticueva
2018-06-10 22:54:20,107 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - # willMessage =
2018-06-10 22:54:20,108 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - #
2018-06-10 22:54:20,109 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - # Connecting...
2018-06-10 22:54:21,206 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - # Connected!
2018-06-10 22:54:21,206 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - # ------------------------------------------------------------
2018-06-10 22:54:21,207 [qtp3671452-42] INFO o.e.k.c.d.DataServiceImpl - Notified connected
2018-06-10 22:54:21,207 [qtp3671452-42] INFO o.e.k.c.d.DataServiceImpl - New session established. Unpublishing all in-flight messages. Disregarding the QoS level, this may cause duplicate messages.
2018-06-10 22:54:21,217 [qtp3671452-42] INFO o.e.k.c.d.t.m.MqttDataTransport - Subscribing to topic: dc/dc/batman/baticueva/# with QoS: 1
2018-06-10 22:54:21,609 [qtp3671452-42] INFO o.e.k.c.Cloudlet - Cloud Client Connection Restored
2018-06-10 22:54:21,610 [qtp3671452-42] INFO o.e.k.c.Cloudlet - Cloud Client Connection Restored
2018-06-10 22:54:21,611 [qtp3671452-42] INFO o.e.k.c.Cloudlet - Cloud Client Connection Restored
2018-06-10 22:54:21,612 [qtp3671452-42] INFO o.e.k.c.Cloudlet - Cloud Client Connection Restored
2018-06-10 22:54:21,612 [qtp3671452-42] INFO o.e.k.c.Cloudlet - Cloud Client Connection Restored
2018-06-10 22:54:21,613 [qtp3671452-42] INFO o.e.k.c.Cloudlet - Cloud Client Connection Restored
2018-06-10 22:54:21,614 [qtp3671452-42] INFO o.e.k.c.p.ProvisioningServiceImpl - onConnectionEstablished
2018-06-10 22:54:21,614 [qtp3671452-42] INFO o.e.k.c.Cloudlet - Cloud Client Connection Restored
2018-06-10 22:54:21,615 [qtp3671452-42] INFO c.e.f.d.i.DiagnosticsServiceImpl - Connection established
2018-06-10 22:54:21,615 [qtp3671452-42] INFO c.e.f.d.i.DiagnosticsServiceImpl - Connection established

Here we have in the top the main data of where are you doing your connection, so you can see a lot of stuff where you set before in your dashboard.
o.e.k.c.d.t.m.MqttDataTransport – Subscribing to topic: dc/dc/batman/baticueva/# with QoS: 1 With this we are acting as subscriber so the mqtt broker are ready to receive any data scanned by our beaconScanner app. And then a lot of services to check connections.

How many messages you see in publishing depends in how you did your configuration in cloud service for kura services and a lot of values like, QoS,etc,etc.Now lets start to put battery to our beacon device.

2018-06-10 23:04:14,568 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Storing message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:04:14,574 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Stored message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:04:14,577 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:04:26,382 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Storing message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:04:26,385 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Stored message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:04:26,388 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0

1528671854: Received PUBLISH from baticueva (d0, q0, r0, m0, ‘dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6’, … (129 bytes))
1528671866: Received PUBLISH from baticueva (d0, q0, r0, m0, ‘dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6’, … (128 bytes))

Yo can see now that our beaconScanner detect and publish your messages.

Here we established a connection wit mqttlen client form MacOSX

Those logs are from mqtt docker logs, you can check how mqtt broker send and receive data.
1528671933: New client connected from 45.232.92.159 as maquina (c1, k120, u'batman').
1528671933: Sending CONNACK to maquina (0, 0)
1528671947: Received SUBSCRIBE from maquina
1528671947: dc/batman/baticueva/# (QoS 0)
1528671947: maquina 0 dc/batman/baticueva/#
1528671947: Sending SUBACK to maquina

Now you can check we have the client maquina that is my machine that works as subscriber getting al messages that my IOT device send to my mqtt broker.
So we have two subscriber, my broker and my client.
The beacon scanner detect the beacon and send it to my IOT that subscribe all incoming beacon detection and my client maquina connect to the broker only to specific topic, so it is the reason why we have received and sending in each cases.

1528671956: Received PINGREQ from baticueva
1528671956: Sending PINGRESP to baticueva
1528671970: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (129 bytes))
1528671970: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (129 bytes))

We detect the second beacon, store wit topic and store message and then send topic to brocker, The process housekeeper delete all confirmed messages.

2018-06-10 23:06:10,629 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Storing message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:06:10,632 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Stored message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:06:10,635 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:09:04,357 [HouseKeeperTask] INFO o.e.k.c.d.s.HouseKeeperTask - HouseKeeperTask started.
2018-06-10 23:09:04,357 [HouseKeeperTask] INFO o.e.k.c.d.s.HouseKeeperTask - HouseKeeperTask: Delete confirmed messages...
2018-06-10 23:09:04,441 [HouseKeeperTask] INFO o.e.k.c.d.s.HouseKeeperTask - HouseKeeperTask ended.

Now we can put the battery again and just wait a while in order to publish hundred of messages….
After that test, try to remove battery or go far away with your beacon and the logs will stop, then go back with beacon and stop cloud service in order to scan beacon and store it.

2018-06-10 23:24:42,546 [qtp3671452-147] WARN o.e.k.n.a.v.l.WpaSupplicantConfigReader - WPA in client mode is not configured
2018-06-10 23:24:42,551 [qtp3671452-147] WARN o.e.k.n.a.v.l.PppConfigReader - getModemConfig() :: PPPD peer file does not exist - /etc/ppp/peers/HE910-D_2-1.5
2018-06-10 23:24:42,770 [qtp3671452-147] INFO o.e.k.c.c.ConfigurationServiceImpl - Loading init configurations from: 1528671660393...
2018-06-10 23:24:43,181 [qtp3671452-147] INFO o.e.k.c.c.ConfigurationServiceImpl - Merging configuration for pid: org.eclipse.kura.data.DataService
2018-06-10 23:24:43,192 [qtp3671452-147] INFO o.e.k.c.c.ConfigurationServiceImpl - Updating Configuration of ConfigurableComponent org.eclipse.kura.data.DataService ... Done.
2018-06-10 23:24:43,210 [Component Resolve Thread (Bundle 6)] INFO o.e.k.c.d.DataServiceImpl - Updating org.eclipse.kura.data.DataService...
2018-06-10 23:24:43,211 [Component Resolve Thread (Bundle 6)] INFO o.e.k.c.d.DataServiceImpl - Get Throttle with burst length 3 and send a message every 3000 millis
2018-06-10 23:24:43,448 [qtp3671452-147] INFO o.e.k.c.c.ConfigurationServiceImpl - Writing snapshot - Saving /opt/eurotech/esf/data/snapshots/snapshot_1528673083193.xml...
2018-06-10 23:24:43,770 [qtp3671452-147] INFO o.e.k.c.c.ConfigurationServiceImpl - Writing snapshot - Saving /opt/eurotech/esf/data/snapshots/snapshot_1528673083193.xml... Done.
2018-06-10 23:24:43,773 [qtp3671452-147] INFO o.e.k.c.c.ConfigurationServiceImpl - Snapshots Garbage Collector. Deleting /opt/eurotech/esf/data/snapshots/snapshot_1528669530806.xml
2018-06-10 23:24:44,216 [HouseKeeperTask] INFO o.e.k.c.d.s.HouseKeeperTask - HouseKeeperTask started.
2018-06-10 23:24:44,216 [HouseKeeperTask] INFO o.e.k.c.d.s.HouseKeeperTask - HouseKeeperTask: Delete confirmed messages...
2018-06-10 23:24:44,219 [HouseKeeperTask] INFO o.e.k.c.d.s.HouseKeeperTask - HouseKeeperTask ended.
2018-06-10 23:24:51,165 [qtp3671452-146] INFO o.e.k.c.d.t.m.MqttDataTransport - Disconnecting...
2018-06-10 23:24:51,166 [qtp3671452-146] INFO o.e.k.c.d.DataServiceImpl - Notified disconnecting

Stopped CloudService and deactivate te auto start.

we can see now a lot of messages like this.

2018-06-10 23:25:15,886 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Storing message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:25:15,889 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Stored message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:25:15,890 [DataServiceImpl:Submit] INFO o.e.k.c.d.DataServiceImpl - DataPublisherService not connected
2018-06-10 23:25:26,711 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Storing message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:25:26,714 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Stored message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:25:26,715 [DataServiceImpl:Submit] INFO o.e.k.c.d.DataServiceImpl - DataPublisherService not connected
2018-06-10 23:25:37,533 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Storing message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:25:37,536 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Stored message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:25:37,536 [DataServiceImpl:Submit] INFO o.e.k.c.d.DataServiceImpl - DataPublisherService not connected

It is because the beacon is there but the cloud service is inactive.Lets wait to store a some of then and stop beacon scanner.

2018-06-10 23:28:04,818 [Component Resolve Thread (Bundle 6)] INFO o.e.k.l.b.l.BluetoothLeScanner - Killing hcitool...
2018-06-10 23:28:04,884 [Component Resolve Thread (Bundle 6)] INFO o.e.k.l.b.l.BluetoothLeScanner - Killing btdump...
2018-06-10 23:28:04,884 [Component Resolve Thread (Bundle 6)] INFO o.e.k.l.b.u.BluetoothProcess - Closing streams and killing...

Now lets go to connect cloud service again.

So old stored messages are there
2018-06-10 23:28:49,972 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:28:52,972 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:28:55,973 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:28:58,972 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:29:01,972 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:29:04,972 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:29:07,972 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:29:10,972 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:29:13,972 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:29:16,972 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:29:19,972 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:29:22,972 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:

and we can check that are recived by broker.
1528673328: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673328: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673329: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673329: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673329: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673329: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673330: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673330: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673333: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (129 bytes))
1528673333: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (129 bytes))
1528673336: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (128 bytes))
1528673336: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (128 bytes))
1528673339: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (129 bytes))
1528673339: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (129 bytes))
1528673342: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673342: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673345: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673345: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673348: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673348: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673351: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673351: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673354: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673354: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673357: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673357: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673360: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673360: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673363: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673363: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673366: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673366: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673369: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673369: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673374: Received PINGREQ from maquina

And then after a while they stop , because no more messages are in the queue .

And when we start again beaconscanner start again to detect and publish.
2018-06-10 23:31:17,121 [Component Resolve Thread (Bundle 6)] INFO o.e.k.l.b.l.BluetoothLeScanner - Starting bluetooth le beacon scan...
2018-06-10 23:31:17,315 [qtp3671452-147] INFO o.e.k.c.c.ConfigurationServiceImpl - Writing snapshot - Saving /opt/eurotech/esf/data/snapshots/snapshot_1528673477084.xml...
2018-06-10 23:31:17,575 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Storing message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:31:17,581 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Stored message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:31:17,583 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0

Now, the messages are there in broker.

1528673477: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673477: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673490: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673490: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673494: Received PINGREQ from maquina

Disconnect the cloud service from broker, lets try to store messages and check what happen after change the option in kura dashboard where show you
1528673949: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673949: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673960: Received PUBLISH from baticueva (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673960: Sending PUBLISH to maquina (d0, q0, r0, m0, 'dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6', ... (130 bytes))
1528673964: Received DISCONNECT from baticueva
1528673965: Client baticueva disconnected.

Messages still apearing and sending all of them…

2018-06-10 23:44:46,860 [DataServiceImpl:ReconnectTask] INFO o.e.k.c.d.t.m.MqttDataTransport - # Connected!
2018-06-10 23:44:46,860 [DataServiceImpl:ReconnectTask] INFO o.e.k.c.d.t.m.MqttDataTransport - # ------------------------------------------------------------
2018-06-10 23:44:46,860 [DataServiceImpl:ReconnectTask] INFO o.e.k.c.d.DataServiceImpl - Notified connected
2018-06-10 23:44:46,861 [DataServiceImpl:ReconnectTask] INFO o.e.k.c.d.DataServiceImpl - New session established. Dropping all in-flight messages.
2018-06-10 23:44:46,863 [DataServiceImpl:ReconnectTask] INFO o.e.k.c.d.t.m.MqttDataTransport - Subscribing to topic: dc/dc/batman/baticueva/# with QoS: 1
2018-06-10 23:44:47,240 [DataServiceImpl:ReconnectTask] INFO o.e.k.c.Cloudlet - Cloud Client Connection Restored
2018-06-10 23:44:47,241 [DataServiceImpl:ReconnectTask] INFO o.e.k.c.Cloudlet - Cloud Client Connection Restored
2018-06-10 23:44:47,241 [DataServiceImpl:ReconnectTask] INFO o.e.k.c.Cloudlet - Cloud Client Connection Restored
2018-06-10 23:44:47,242 [DataServiceImpl:ReconnectTask] INFO o.e.k.c.Cloudlet - Cloud Client Connection Restored
2018-06-10 23:44:47,242 [DataServiceImpl:ReconnectTask] INFO o.e.k.c.Cloudlet - Cloud Client Connection Restored
2018-06-10 23:44:47,243 [DataServiceImpl:ReconnectTask] INFO o.e.k.c.Cloudlet - Cloud Client Connection Restored
2018-06-10 23:44:47,243 [DataServiceImpl:ReconnectTask] INFO o.e.k.c.p.ProvisioningServiceImpl - onConnectionEstablished
2018-06-10 23:44:47,244 [DataServiceImpl:ReconnectTask] INFO o.e.k.c.Cloudlet - Cloud Client Connection Restored
2018-06-10 23:44:47,244 [DataServiceImpl:ReconnectTask] INFO c.e.f.d.i.DiagnosticsServiceImpl - Connection established
2018-06-10 23:44:47,245 [DataServiceImpl:ReconnectTask] INFO c.e.f.d.i.DiagnosticsServiceImpl - Connection established
2018-06-10 23:44:47,255 [DataServiceImpl:ReconnectTask] INFO o.e.k.c.d.DataServiceImpl - Connected. Reconnect task will be terminated.
2018-06-10 23:44:47,264 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:44:47,286 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:44:47,290 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:44:47,613 [qtp3671452-143] WARN o.e.k.n.a.v.l.WpaSupplicantConfigReader - WPA in client mode is not configured
2018-06-10 23:44:47,619 [qtp3671452-143] WARN o.e.k.n.a.v.l.PppConfigReader - getModemConfig() :: PPPD peer file does not exist - /etc/ppp/peers/HE910-D_2-1.5
2018-06-10 23:44:48,238 [qtp3671452-110] WARN o.e.k.n.a.v.l.WpaSupplicantConfigReader - WPA in client mode is not configured
2018-06-10 23:44:48,244 [qtp3671452-110] WARN o.e.k.n.a.v.l.PppConfigReader - getModemConfig() :: PPPD peer file does not exist - /etc/ppp/peers/HE910-D_2-1.5
2018-06-10 23:44:48,448 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Storing message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:44:48,463 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Stored message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:44:48,602 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:44:51,603 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:44:54,602 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:44:57,602 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:44:59,267 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Storing message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:44:59,279 [BluetoothProcess BTSnoop Gobbler] INFO o.e.k.c.d.DataServiceImpl - Stored message on topic :#account-name/#client-id/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6, priority: 5
2018-06-10 23:45:00,602 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0
2018-06-10 23:45:03,603 [DataServiceImpl:Submit] INFO o.e.k.c.d.t.m.MqttDataTransport - Publishing message on topic: dc/batman/baticueva/BeaconScannerExample/beacons/AC:23:3F:24:9A:C6 with QoS: 0

So, let try to read and read and test to understand why this is happening …

Run Basic Mosquitto Broker in Docker

Steps to run a mosquitto broker in a docker:

1- Create two files:

First one mosquitto.conf where you have the basic configuration for your broker. We explain the mosquitto passwd file later.

[dalmine@rosas mosquitto]$ cat mosquitto.conf
listener 9001
protocol websockets
allow_anonymous false
password_file /mosquitto/config/passwd
[dalmine@rosas mosquitto]$

Then create an empty passwd file.

[dalmine@rosas mosquitto]$touch passwd

 

The first line of mosquitto.conf is about listener, 9001 is the default for websocket, I choose it because you can build or code other client with a lot of languages using webscoket, also you have mqtt 1883, mitts 8883 or random port as you wish , but you need to choose the protocol.

2- Set password to login

/ # mosquitto_passwd passwd alliot
Error: Empty password.
Password: / #

/ # cat passwd
batman:$6$3qbtsdsdfsdfsdfsfdsdfshdflsjdfjlksdfhskdjfh==
/ # ls

We have the command mosquitto_passwd it is part of mosquitto packages.

 

3- Run Docker

Then we need to run docker command with a lot parameter we want to avoid configuration with any provisioning tools like compose,k8s,etc,etc,etc…

 

[dalmine@rosas mosquitto]$ sudo docker run -it -p 9001:9001 -v $(pwd)/mosquitto.conf:/mosquitto/config/mosquitto.conf -v $(pwd)/passwd:/mosquitto/config/passwd -d –name mosquitto eclipse-mosquitto
91652c904c86220f43ad6d7de2402f54c30f438bd3f59b217ef6fb7e4c61127e

The command is (ONE LINE) –> docker run -it -p 9001:9001 -v $(pwd)/mosquitto.conf:/mosquitto/config/mosquitto.conf -v $(pwd)/passwd:/mosquitto/config/passwd -d –name mosquitto eclipse-mosquitto

 

4-Check logs:

[dalmine@rosas mosquitto]$ docker logs -f mosquitto
1528666018: mosquitto version 1.4.12 (build date 2017-06-01 13:03:46+0000) starting
1528666018: Config loaded from /mosquitto/config/mosquitto.conf.
1528666018: Opening websockets listen socket on port 9001.

 

We are open to receive new connections. Now we can use the mosquitto client command  line or any web/app client.

1528667142: New client connected from 45.232.92.159 as lens_HJ9OowTbqNS11toqxXxt4eFnFew (c1, k120, u’alliot’).1528667142: New client connected from 45.232.92.159 as lens_HJ9OowTbqNS11toqxXxt4eFnFew (c1, k120, u’batman’).1528667142: Sending CONNACK to lens_HJ9OowTbqNS11toqxXxt4eFnFew (0, 0)

1528667150: Received PUBLISH from lens_HJ9OowTbqNS11toqxXxt4eFnFew (d0, q0, r0, m0, ‘dc/batman/test’, … (4 bytes))1528667155: Received SUBSCRIBE from lens_HJ9OowTbqNS11toqxXxt4eFnFew1528667155: dc/batman/test (QoS 0)1528667155: lens_HJ9OowTbqNS11toqxXxt4eFnFew 0 dc/batman/test1528667155: Sending SUBACK to lens_HJ9OowTbqNS11toqxXxt4eFnFew1528667159: Received PUBLISH from lens_HJ9OowTbqNS11toqxXxt4eFnFew (d0, q0, r0, m0, ‘dc/batman/test’, … (4 bytes))1528667159: Sending PUBLISH to lens_HJ9OowTbqNS11toqxXxt4eFnFew (d0, q0, r0, m0, ‘dc/batman/test’, … (4 bytes))1528667160: New client connected from 45.232.92.159 as baticueva (c1, k30, u’alliot’).1528667160: Sending CONNACK to baticueva (0, 0)1528667160: Received SUBSCRIBE from baticueva1528667160: dc/dc/batman/baticueva/# (QoS 1)1528667160: baticueva 1 dc/dc/batman/baticueva/#1528667160: Sending SUBACK to baticueva

1528667160: Sending SUBACK to baticueva
1528667190: Received PINGREQ from baticueva
1528667190: Sending PINGRESP to baticueva
1528667220: Received PINGREQ from baticueva
1528667220: Sending PINGRESP to baticueva

The logs depends in what kind of action are you doing with broker, you hace two main action, PUBLISH  where you send a message to the broker, and the other is SUBSCRIBE.

With any client you can set be a publisher or a subscriber. Keep in mind you have QoS , quality of service where determine how you can confirm your messages.

You can now connect to your mosquitto broker with your favorite client.

 

 

 

Links

WS Mosquito

Mosquitto ECLIPSE DOCS

Mosquitto docker file

MOsquitto Password Config