Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pm2-mysql

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pm2-mysql - npm Package Compare versions

Comparing version 0.0.6 to 1.0.0

lib/actions.js

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);
});

41

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc