plugin_mysql

MySQL plugin

This plugin allows execute SQL queries into a MySQL server. MySQL is a multithreaded, multi-user, SQL (Structured Query Language) relational database server (RDBS).

Currently, MySQL plugin only supports retrieving the server status, retrieving the first row/column of a query and the number of rows returned by a query.


MySQL::count(query)return the number of rows returned by <query>
MySQL::query(query)return a string containing the first value of the row.
MySQL::status()return a string containing the current server status: Uptime in seconds, number of running threads, questions, reloads, and open tables.

—-

Plugin MySQL {
        server 'www.myserver.foo'
        port 3306
        user 'admin'
        password 'topsecret'
        database 'shop'
}

If server entry is missing, localhost will be assumed.\

If port entry is missing, MySQL default's one will be used.\

If user entry is missing, LCD4Linux unix owner will be assumed.\

If password entry is missing, empty password will be used.\

database entry is required.


Widget CustomersOnline {
        class 'Text'
        expression MySQL::count('SELECT DISTINCT ip_address FROM whos_online')
        width 2
        align 'R'
        update 30000
}
Widget NewOrders {
        class 'Text'
        expression MySQL::query('SELECT id FROM orders WHERE status = 1')
        width 14
        align 'R'
        prefix 'New Orders:'
        update 30000
}
Widget MySqlLastOnline {
        class 'Text'
        expression MySQL::query('SELECT ip_address FROM whos_online order by timestamp DESC limit 1')
        width 10
        align 'R'
        update 3000
}

  • plugin_mysql.txt
  • Last modified: 2020/07/17 18:33
  • (external edit)