Translations of this page:

Osmius

Osmius agent for BlueTooth
Agent name: osm_ag_BLUETOOZ Agent code: BLUETOOZ
Subject: User manual Osmius Agent for the detection of BlueTooth devices
Date: 08/04/2010 Revision date: 15/04/2010

General Information

This agent can monitor the number of BlueTooth devices around identifying also how many of them are new to the agent based on a configurable memory in days. It has been tested as a detector using the Broadcom BT device in a Dell laptop and using USB C200 bluetooth. However, we recommend checking its functionality before implanting it in a production environment.

As a use case with this agent, the owner of a Restaurant could keep track of the number of customers in the place (infered by the number of BlueTooth devices) every hour and how many of them are newcomers.This way one can stablish correlations between these numbers and the incomes and check if the business is growing or not.

The Osmius BLUETOOZ agent has been developed using functionalities and enhancements of Osmius framework and ACE libraries, so it is necessary to install the ACE libraries for the proper deployment and operation of agente. See chapter: installation.

The agent uses a SQLite Database (http://sqlite.org/) as the memory of known devices, and that is why if you want to compile it your self, you need to install SQLite developer packages and SQLIteWrapped. Of course BlueTooth libraries are aswell needed (bluetooth and hci).

If you are a “normal” user (not techie) the installation process takes care of these details for you when you are installing this agent via Osmius plugins and the Console.

The BLUETOOZ agent provides 3 events that have been chosen by the Osmius Technical Team as the more relevant ones to this agent.

BlueTooz Instance

As a general rule each Osmius agent can monitor one instance type. If you are not familiar with these concepts check out the glossary. Each instance is individually defined in the configuration file (if you want further information go to agents and instances); depending on agent type is the instance type and depending on instance is the connection info.

CONNECTION_INFO

The connection information or connection_info is data that the agent needs to know to connect to the instance. (See more about the connection_info)

In the particular case of the Osmius agent for BlueTooth devices the connection_info does not need any mandatory parameter. We find two optional parameters:

CONNECTION_INFO=  [-d dev_mac_addr] [-m memory_days]

Donde:

  • dev_mac_addr (optional) Is the device “mac” address we want to use to detect other devices.This is not necessary if you only have one device.The default device is the “hci0” of the computer where the agent is running on.
  • memory_days (optional) Days to store in the database in order to check is a detected device has been around before. Default value is 30 days.

To see our BT devices in a Linux box:

hciconfig -a

Sample:

CONNECTION_INFO = -d "00:22:F7:17:07:54" -m 7

TYPE

The type defines the instance type to be monitored. Every declared instance must be associated with a type as you can see here

BlueTooth devices detection:

TYPE= BLUETOOZ

Event Summary Table

Here is briefly the capabilities of this agent, further down on this page each event is described in more detail.

EVENT DESCRIPTION c w a tseconds Extra parameters / Remarks
BTCOLLEC Detects BlueTooth device and stores them into the DB0 1 1 600 Silent mode ( -s) recommmended
BTNUMDEV Total number of detected devices. 0 999 999 600 BTCOLLEC must be active to use this event
BTNUMNEW Number of NEW detected devices. 0 999 999 600 BTCOLLEC must be active to use this event. The result of this event depends on <memory_days> parameter

BlueTooZ Agent Events

BTCOLLEC

BTCOLLEC detects Bluetooth devices arround and stores the data into the local SQLite database, so it can be queried by BTNUMDEV and BTNUMNEW events. Returns 0 if everything goes fine.

Return values:

VALUE MEANING
<> 0 Error
0 Ok

Recommended parameters:

Comparison type Direct. The higher value the higher severity (-c 0)
Monitoring interval 300 seconds – 1 hour –> depends on instance importance
Warning threshold 1
Alert threshold 1

Parameter setting example:

BTCOLLEC = -t 600 -c 0 -w 1 -a 1 -T "Collecting BT Devices"

Remarks: This event calls BlueTooth drivers.

BTNUMDEV

BTNUMDEV returns the total number of BlueTooth devices detected.

Return values:

VALUE MEANING
-1 Error
N Number of devices

Recommended parameters:

Comparison type Direct. The higher value the higher severity (-c 0)
Monitoring interval 300 seconds – 1 hour –> depends on instance importance
Warning threshold 9999
Alert threshold 9999

Parameter setting example:

BTNUMDEV = -t 600 -c 0 -w 9999 -a 9999 -T "Number of BT Devices detected"

Remarks: This event needs BTCOLLEC to be active in order to work properly.

BTNUMNEW

BTNUMNEW returns the number of BlueTooth devices that are new to the agent taking into account the CONNECTION_INFO parameter <memory_days>.

Return values:

VALUE MEANING
-1 Error
N Number of New devices

Recommended parameters:

Comparison type Direct. The higher value the higher severity (-c 0)
Monitoring interval 300 seconds – 1 hour –> depends on instance importance
Warning threshold 9999
Alert threshold 9999

Parameter setting example:

BTNUMNEW = -t 600 -c 0 -w 9999 -a 9999 -T "Number of NEW BT Devices detected"

Remarks: This event needs BTCOLLEC to be active in order to work properly.

prerequisites BLUETOOZ

In order to compile, this agent requires a set of prerequisites, which are generic to compile any Osmius agent, you can see these prerequisites.

In this case we also need this libraries:

  • SQLite3 (libsqlite3-0, libsqlite3-dev and sqlite3 en Ubuntu).
  • sqlitewrapped (Instructions here: http://www.alhem.net/project/sqlite/)
  • BlueTooth (libbluetooth-dev and bluez en Ubuntu)

Makefiles and Compilation

  • Make Project Creator (MPC) is used by Osmius, so creating Makefiles is a trivial task. If you want to learn more about MPC and Osmius check out the section of Makefiles on Osmius.
  • In order to compile the BLUETOOZ agent we need access in the system to includes and libraries of SQLite and BlueTooz (Ubuntu packages would be: “libsqlite3-dev” , “libbluetooth-dev” and ”libsqlitewrapped.a”).
  • You can generate the Makefile in this way:

From the agent directory using console or terminal.

$ACE_ROOT/bin/mpc.pl -type gnuace osm_ag_bluetooth.mpc
  • Now that you have created the Makefile, agent compiling is extremely simple.
gmake -f GNUmakefile.Osm_Ag_Bluetooth_Osmius

Binaries will be installed in this folder: $(OSM_ROOT)/plugins/BLUETOOZ/bin

Running the agent

The BLUETOOZ agent have the same running features of the other Osmius agents. You can check it out int he section Start and Stop Agents.

To run the without the Osmius web console:

osm_ag_BLUETOOZ -c osm_ag_BLUETOOZ.ini -m MASTERAG -p 1950 -d [>> osm_ag_solaris.log]1)

Running in standalone mode

The Osmius BLUETOOZ agent, like the others Osmius agents, allows the execution in standalone mode. This option may be particularly useful when developing a new agent or to perform specific agent tests.

Basically you have to add a new value, called SNDCMD, to Osmius agent configuration file agente de Osmius (osm_ag_BLUETOOZ.ini) as shown here.

After this you must execute the agent setting Master Agent and communications port to zero, for example:

osm_ag_BLUETOOZ -c osm_ag_BLUETOOZ.ini -m 00000000 -p 0 -d

Tests list

Test performed to agent de Osmius para BlueTooth.

Date: 08/04/2010
Test Result Remarks
Creating an instance with all its events in silent mode OK N/A
Creating an instance with all its events with custom text OK N/A
Creating an instance with all its events but no custom text OK N/A
1 instance and events set to 60 seconds and keep it
running for 48 hours
OK no memory leaks
Declare 2 instances, cause a disconnect and then reconnectNA N/A
Declare 1 instance and test each event OK Results are the expected ones.
Elimination of general parameter and check unbootable OK N/A
Elimination of instance CONN_INFO and check unbootable NA NA
1) Optional, to store agent messages in a file
 
en/agentes/bluetooz.txt · Last modified: 2012/12/12 09:35 by osmius
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki