NZBGet MySQL Plugin
This Plugin for NZBGet inserts a record into a user specified MySQL database. It only requires these configuration options:
- the hostname of the mysql database server
- the port mysql is listening on (optional)
- the mysql username
- the mysql password
- the name of the mysql database
- the table to insert the records into
This script is written in python and it requires the installation of the pymsql module: sudo pip install pymysql
The purpose of this script is to allow you to create a dashboard or other reporting around your downloads. You can use Grafana or write your own frontend to create neat glanceboards.
Fell free to create a Pull Request (PR) and submit improvements. I'm new to Python and there are a lot of areas for improvement in this plugin.
Installation:
Download and copy the Mysql-Log.py file from this repo into your NZBGet/scripts
directory. Alternatively, you can clone this repo directly into the /scripts/ directory:
# This directory will be where YOUR NZBGet installation is (/opt/nzbget/ in this example)
cd /opt/nzbget/scripts
git clone https://github.com/chrisbergeron/nzbget-mysql.git
mv nzbget-mysql/Mysql-Log.py .
MySQL / MariaDB Configuration
You can use the included SQL file to create the mysql database and table. You can customize the mysql database and table names. Create them with:
mysql -u username -p -h db-hostname database_name < create-database.sql.txt
Enter password:
Alternatively, you can create the database manually:
mysql> CREATE DATABASE nzbs;
mysql> CREATE TABLE `mynzbs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nzb` varchar(255) DEFAULT NULL,
`entry_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
);
mysql> quit
The end result should be a table with 3 columns:
+------------+--------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+-------------------+-----------------------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| nzb | varchar(255) | YES | | NULL | |
| entry_date | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
+------------+--------------+------+-----+-------------------+-----------------------------+
NZBGet-MySQL Configuration
In NZBGet go to Settings
and at the bottom left you should see MYSQL-LOG
:
Add the hostname of your MySQL instance and the Port number it's listening on (default is 3306).
If configured properly, you'll see lines like this in your NZBGet Messages
:
Roadmap:
- Separate Show Name, Episode Name, Season and Episode info, Quality and Crew into separate rows
- Log NZBGet status codes
Questions / Comments?
- Mysql-Log.py forum post - conversation about this script/plugin
- My Blog Post - introductory post
- Home page (nzbget.net) - for first time visitors, learn more about NZBGet
- Forum - get support, share your ideas, extension scripts, etc