LinuxLog is used for Linux based Eagle systems:
The Linux system in the Micronix Eagle is installed on an IDE compatible Flash-based DOM (Disk On Module) with a capacity of at least 8 MB. It is formatted with the ext2 filesystem. The Linux system is based on the following parts:
It has the following servers installed:
The Micronix Eagle system running Linux is based on a PC compatible PC/104 CPU module with a 486-class or faster CPU and at least 16 MB RAM. The CPU has a BIOS setup like in PCs. From the factory it is configured to start the Linux system, but if the configuration for some reason becomes damaged, you may want to access it.
To enter the BIOS setup, you need to connect a VGA monitor to the VGA connector, and a PC keyboard to the keyboard connector. Turn on the system, and press DEL when it says so. The important settings are:
Standard CMOS Setup:
Advanced CMOS Setup:
When booting, it should auto-detect the Disk On Module as an IDE drive, show a LILO prompt ("LILO boot: _"). After 1.5 second it should load and start the Linux system.
The total boot time, from power-on and until all services are running and you have a login prompt, is around 30 seconds.
You need to log into the system and get a Linux prompt when you want to configure the network, configure users and passwords that are allowed to login, and other system maintenance. For such tasks, some experience with Linux is an advantage.
You can log into the system in three different ways: By connecting a VGA monitor and a PC keyboard, through the serial port COM1 (ttyS0), and through Telnet from the network.
When connecting a monitor and a keyboard directly, you will see the login prompt when the system has finished booting.
You can also connect a null-modem cable between the COM1 (ttyS0) port and a PC, and run a serial terminal program on the PC. No handshake signals are necessary. The terminal program should be set to 9600,n,8,1. When the system has finished booting, it shows the login prompt on the connected serial terminal. If you connect it after the system has booted, you can press Enter to make it re-send the login prompt.
You can also connect to the Telnet server in the system from a Telnet client through the network. This requires that the network is configured correctly in the Eagle system. As Telnet client, you can use the Telnet program that comes with Windows (TELNET.EXE). The Windows Telnet client has problems with escape sequences when you use some commands such as ae and less in the Eagle. A Telnet client for Windows where these things work is the free Tera Term Pro.
The login prompt looks something like this:
Micronix Eagle Linux Vx.xx
eagle login: _
Now enter a username and a password. From the factory, the Eagle system accepts the username root with the password root. The user root is the superuser which allowed to do anything. If security is an issue, you should change the password for the root user.
When you are logged in as root, the command prompt is '#'. When you are logged in as another user, the command prompt is '$'. In the following, the '#' in front of commands is the prompt. You should not type the '#' yourself.
To log out from the Linux system, type exit. When using Telnet, this will end the connection. On a serial terminal, and direct VGA + keyboard, this will log out, and redisplay the login prompt.
To see a list of commands available in BusyBox and TinyLogin, type busybox and tinylogin.
Before you turn off an Eagle system, it is a good idea to shut down the Linux system. The shutdown procedure will correctly end all programs and write all unwritten information to disk. To do this, type halt. If you do this from a Telnet login, the Telnet connection will shortly disconnect, and a few seconds later, you may turn off the power. If you do it from a connected keyboard and VGA monitor, you will see various messages, and when it says "The system is halted. Press CTRL-ALT-DEL or turn off power", you may turn off power. Alternatively, you can type reboot, or press Ctrl-Alt-Del on a connected keyboard, and the system will shut down, reboot, and come up again.
If you just turn off power without shutting down, there is a risk that data that have been saved within the last few seconds aren't written to disk, and that disk data structures may be damaged. Each time the system boots, it performs a filesystem check (fsck), where it checks for and attempts to repair such errors.
The network configuration is stored in small text files. When the system boots, it initializes the ethernet interface with values from these files.
The Eagle system can use either a fixed IP address on the TCP/IP network, or it can obtain an IP address from a DHCP server if you have such one on your network.
From the factory, the network is configured like this, unless other agreements have been made:
To change the hostname to e.g. eagle3, type: # echo "eagle3" > /etc/config/hostname To configure the system for using fixed IP address (and not DHCP), type the following. When using fixed IP address, the IP address, netmask, broadcast, and gateway must also be set correctly. # echo "no" > /etc/config/use_dhcp To change the IP address to e.g. 10.0.0.13, type: # echo "10.0.0.13" > /etc/config/ipaddr To change the netmask to e.g. 255.255.0.0, type: # echo "255.255.0.0" > /etc/config/netmask To change the broadcast address to e.g. 10.0.0.255, type: # echo "10.0.0.255" > /etc/config/broadcast To change the gateway address to e.g. 10.0.0.2, type: # echo "10.0.0.2" > /etc/config/gateway To get the IP address configuration from a DHCP server, type: # echo "yes" > /etc/config/use_dhcp The system will then get the IP address, netmask, broadcast, and gateway from a DHCP server. To see which addresses the system got, you can type # ifconfig eth0 and # route
In case of problems, you may want to connect a VGA monitor connected, so you can see any error messages shown during boot.
In the Eagle system, a MySQL server runs. The datalogger program stores the logged data in this database, and you can then fetch the data and then delete them through the network.
To access the database from Windows programs, you can either use it directly from applications that support the MySQL database, or you can use it through an ODBC (Open Database Connectivity) driver. You can download the MyODBC driver from the MySQL download page.
The MySQL server internally has an authentication system where it is defined which MySQL users are allowed to do what. This system of usernames and passwords is not the same as users on the Linux system. From the factory, the database is set up so that the MySQL user 'mysql', with no password, is allowed to do anything from anywhere on the network. If security is an issue, you should configure the MySQL database with users with appropriate permissions. The datalogger program uses the user mysql with no password when it stores logs, so you should at least grant this user access from the local host. Read the MySQL documentation about these subjects.
To administer the MySQL server from a Windows PC, you can use the free third-party MySQL graphical frontend program MySQL-Front. There is also a text-mode program called mysql installed on the Eagle system that you can use when you log into the system:
# mysql -u mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 3.23.35
Type 'help;' or '\h' for help. Type '\c' to clear the buffer
mysql> show databases;
+----------------+
| Database |
+----------------+
| eaglelogconfig |
| eaglelogevents |
| mysql |
| test |
+----------------+
4 rows in set (0.01 sec)
mysql> The directory that holds the data in the eaglelogevents database is a RAM disk (a tmpfs filesystem) with a size that is currently limited to 2 MB. This has the following implications:
To protect the data against power loss, you may want to connect a backup battery to the ME-5120 power supply module.
The data logging is performed by the program linuxlog that is started when the system starts. linuxlog loads the logging configuration from the MySQL database eaglelogconfig, initializes the I/O modules described in the configuration, and continuously samples the inputs, processes the logging rules, and stores the log data according to the rules. When the PC configuration program updates eaglelogconfig with a new configuration, linuxlog rereads it and reinitializes the I/O modules and logging rules.
When linuxlog reads the configuration, i.e. when starting, and when a new configuration is received from the PC, it deletes all data in the eaglelogevents database, and creates new tables. So before updating the configuration in the Eagle, be sure that you have retrieved any logged data of interest. One table is created for each event ID that can be produced. Logs with event ID 1 are stored in the table event1, and so on.
Each table has two fixed fields, timestamp and timestamp_msec, and one additional field for each additional data item that has been defined in the PC configuration program for the event ID. If, for example, you have defined that for event ID 1, the extra data Temperature (an analog input) and Emergency (a digital input) should be logged, the table eaglelogevents.event1 will be created with this layout:
| Field | Type | Null | Key | Default | Extra |
| timestamp | datetime | No | 0000-00-00 00:00:00 | ||
| timestamp_msec | int(11) | No | |||
| Temperature | float | No | |||
| Emergency | tinyint(1) | No |
timestamp is the time the log was stored, with year, month, date, hour, minute, and second.
timestamp_msec is the millisecond part of the timestamp. Since the system has a time resolution of 10 milliseconds, the number in this field is always divisible by ten, and in the range 0 - 990.
The following fields are the additional data for the event ID, if any. They have the names of the corresponding I/Os as defined in the PC configuration program, and these types:
| I/O type | MySQL datatype | Values |
| Digital input | tinyint(1) | 0 or 1 |
| Digital output | tinyint(1) | 0 or 1 |
| Analog voltage input | float | Physical value as specified in the input configuration |
| Analog current input | float | Physical value as specified in the input configuration |
| Analog output | smallint(4) | 0 - 4095 |
| Counter | int unsigned | 0 - 4294967295 |
Normal usage should be that you regularly retrieve the logs, and delete them afterwards from the Eagle system.
If the RAM disk holding the event tables runs full, new logs that should be stored are ignored. When you delete some logs from the tables and make new room, new logs are again stored. (This behaviour may change in a future version of linuxlog.)
linuxlog can show status and error messsages while running. It may be useful while you develop your system. To do this, you should first stop the linuxlog running in the background, and restart it in the foreground. First, see which PID (process ID) the background task has, using the ps command:
# ps
PID Uid Stat Command
1 root S init
2 root S [keventd]
3 root S [ksoftirqd_CPU0]
4 root S [kswapd]
5 root S [bdflush]
6 root S [kupdated]
45 root S [eth0]
76 root S /usr/sbin/routed -q
79 daemon S /sbin/portmap
82 root S /usr/sbin/inetd
87 mysql S /usr/sbin/mysqld -u mysql
90 mysql S /usr/sbin/mysqld -u mysql
91 mysql S /usr/sbin/mysqld -u mysql
95 root S linuxlog
99 root S /sbin/getty -L ttyS0 9600 vt100
100 root S /sbin/getty 38400 tty2
102 mysql S /usr/sbin/mysqld -u mysql
105 root S /sbin/getty 38400 tty1
106 root S in.telnetd
107 root S -sh
108 root R ps Here we see that linuxlog has PID 95. Now stop this process: # kill 95 Running ps again, you should see that linuxlog is no longer running. You can now start linuxlog in the foreground: # linuxlog
Start of linuxlog version 1.00
SQL: Connecting OK
Reading configuration from database... OK
Parsing configuration... 1 IO module, 3 rules, 2 logdata definitions.
Removing old event tables... OK
Creating new event tables... event1 event2 event3 OK
Time: 2002-01-17 11:11:07.87 (day 747, sech 4026787)
IO module 1: ME2019 (208) OK, firmware version 1.01
Press Ctrl-C to terminate.
SqlLogEvent: Logging ID 1, day 747 sech 4026900...
SqlLogEvent: Logging ID 1, day 747 sech 4027000...
SqlLogEvent: Logging ID 1, day 747 sech 4027100...
SqlLogEvent: Logging ID 2, day 747 sech 4027129...
SqlLogEvent: Logging ID 1, day 747 sech 4027200...
SqlCheckReinit: reinit flag set!
Reading configuration from database... OK
Parsing configuration... 1 IO module, 3 rules, 2 logdata definitions.
Removing old event tables... OK
Creating new event tables... event1 event2 event3 OK
IO module 1: ME2019 (208) OK, firmware version 1.01
SqlLogEvent: Logging ID 1, day 747 sech 4027300...
SqlLogEvent: Logging ID 1, day 747 sech 4027400...
SqlLogEvent: Logging ID 1, day 747 sech 4027500...
SqlLogEvent: Logging ID 1, day 747 sech 4027600...
SqlLogEvent: Logging ID 1, day 747 sech 4027700...
SqlLogEvent: Logging ID 1, day 747 sech 4027800...
SqlLogEvent: Logging ID 1, day 747 sech 4027900...
SqlLogEvent: Logging ID 1, day 747 sech 4028000... This example shows that after linuxlog was started, it made five logs, then reinitialized because a new configuration was sent from the PC configuration program, and then it made eight further logs. day and sech are the timestamp stored. day is the absolute day number since 2000-01-01, and sech is the time in 0.01 seconds since midnight. To stop linuxlog in the foreground and restart it in the background, type Ctrl-C and: linuxlog: Caught signal 2, exiting.
End of linuxlog
# daemonize linuxlog > /dev/null linuxlog should now be running again in the background. You can verify this with the ps command.