Comparing version 0.0.6 to 1.0.0
15
index.js
@@ -8,5 +8,8 @@ /** | ||
var pmx = require('pmx'); | ||
var mysqlClientFactory = require('./lib/clientFactory.js'); | ||
var mysqlStats = require('./lib/stats.js'); | ||
var mysqlActions = require('./lib/actions.js'); | ||
// Initialize the module | ||
var conf = pmx.initModule({ | ||
pmx.initModule({ | ||
@@ -58,3 +61,3 @@ pid : pmx.resolvePidPaths(['/var/run/mysqld/mysqld.pid', | ||
// Name of custom metrics to be displayed as a "major metrics" | ||
main_probes : ['questions/s', 'connections/s', 'Total Processes', 'Threads Running', 'Pending Reads', 'Buffer Read'] | ||
main_probes : ['questions/s', 'Open Tables', 'Total Processes', 'IO Read kb/s', 'Row Lock Waits', '% Max Used Connections'] | ||
}, | ||
@@ -67,3 +70,9 @@ }, | ||
}, function(err, conf) { | ||
var queries = require('./lib/queries'); | ||
var mysqlClient = mysqlClientFactory.build(conf); | ||
// Init metrics refresh loop | ||
mysqlStats.init(mysqlClient); | ||
// Init actions | ||
mysqlActions.init(mysqlClient); | ||
}); |
{ | ||
"name": "pm2-mysql", | ||
"version": "0.0.6", | ||
"description": "Mysql module", | ||
"version": "1.0.0", | ||
"description": "Mysql module", | ||
"dependencies": { | ||
"pmx" : "*", | ||
"mysql" : "*" | ||
"hwmon": "https://github.com/didil/node-hwmon#274445c1d7cbd8158f3549ef711d1bd6f565e828", | ||
"mysql": "^2.12.0", | ||
"pmx": "*", | ||
"shell-escape": "^0.2.0", | ||
"shelljs": "^0.7.5" | ||
}, | ||
"config": { | ||
"host" : "localhost", | ||
"port" : 3306, | ||
"user" : "root", | ||
"password" : "" | ||
"config": { | ||
"host": "localhost", | ||
"port": 3306, | ||
"user": "root", | ||
"password": "", | ||
"refreshRate": 1000, | ||
"dbDiskName": "sda", | ||
"slowQueriesLog": "/var/log/mysql/slow-queries.log", | ||
"generalLog": "/var/log/mysql/general.log", | ||
"lastQueriesSize": 100, | ||
"errorLog": "/var/log/mysql/error.log", | ||
"lastErrorsSize": 100 | ||
}, | ||
"apps" : [{ | ||
"merge_logs" : true, | ||
"max_memory_restart" : "200M", | ||
"script" : "index.js" | ||
}], | ||
"apps": [ | ||
{ | ||
"merge_logs": true, | ||
"script": "index.js" | ||
} | ||
], | ||
"author": "Keymetrics Inc.", | ||
"license": "MIT" | ||
"license": "MIT" | ||
} |
@@ -9,2 +9,24 @@ ## Description | ||
## Requirements | ||
This module requires a MySQL install (tested against v5.6). Optionally, to monitor the DB disk Read/Write you will need `iostat` located in the `sysstat` package. | ||
### Slow Queries | ||
To be able to display Slow Queries you first need to activate slow_query_log in MySQL via : | ||
Edit /etc/mysql/my.cnf and add : | ||
slow_query_log = '1' | ||
and you need to set the log file path to a file your pm2 user has read access to : | ||
slow_query_log_file = '/var/log/mysql/slow-queries.log' | ||
### General Query Log | ||
To be able to display the last queries, you need to enable the General Query Log via : | ||
general_log = '1' | ||
and you need to set the log file path to a file your pm2 user has read access to : | ||
general_log_file = '/var/log/mysql/general.log' | ||
## Configure | ||
@@ -16,2 +38,9 @@ | ||
- `password` (Defaults to `none`): Set the password of your mysql server | ||
- `refreshRate` (Defaults to 1000): Set the stats refresh rate (in milliseconds) | ||
- `dbDiskName` (Defaults to "sda"): Sets the name of the disk used by the database (used to fetch io stats) | ||
- `slowQueriesLog` (Defaults to "/var/log/mysql/slow-queries.log"): log file to fetch slow queries from | ||
- `generalLog` (Defaults to "/var/log/mysql/general.log"): log file to fetch last queries from | ||
- `lastQueriesSize` (Defaults to 100): number of lines to fetch from general log for last queries display | ||
- `errorLog` (Defaults to "/var/log/mysql/error.log"): error log file | ||
- `lastErrorsSize` (Defaults to 100): number of lines to fetch from error log for last errors display | ||
@@ -29,2 +58,2 @@ #### How to set these values ? | ||
`pm2 uninstall pm2-mysql` | ||
`pm2 uninstall pm2-mysql` |
Sorry, the diff of this file is not supported yet
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
15588
12
2
379
1
2
57
5
1
2
+ Addedhwmon@https://github.com/didil/node-hwmon#274445c1d7cbd8158f3549ef711d1bd6f565e828
+ Addedshell-escape@^0.2.0
+ Addedshelljs@^0.7.5
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinterpret@1.4.0(transitive)
+ Addedis-core-module@2.16.1(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedrechoir@0.6.2(transitive)
+ Addedresolve@1.22.10(transitive)
+ Addedshell-escape@0.2.0(transitive)
+ Addedshelljs@0.7.8(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedwrappy@1.0.2(transitive)
Updatedmysql@^2.12.0