Initial commit

master v0.1.0
Excitable Aardvark 6 years ago
commit 9c57f6f233

@ -0,0 +1,13 @@
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
indent_size = 4
trim_trailing_whitespace = false

@ -0,0 +1 @@
extends: standard

1
.gitignore vendored

@ -0,0 +1 @@
node_modules/

@ -0,0 +1,11 @@
Copyright 2018 Excitable Aardvark <excitableaardvark@tutanota.de>
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

@ -0,0 +1,18 @@
# monerod_exporter
> Monero Prometheus exporter
### Environment Variables
* `DAEMON_HOST` - monerod host, example: `http://localhost:18081`
* `PORT` - port to expose metrics on
### Metrics Exported
* `monerod_connections_incoming` - Number of incoming connections
* `monerod_connections_outgoing` - Number of outgoing connections
* `monerod_mempool_size` - Number of transactions in the mempool
### License
Released under the terms of the 3-Clause BSD License. See `LICENSE` for more
information.

@ -0,0 +1,37 @@
/*
* Copyright 2018 Excitable Aardvark <excitableaardvark@tutanota.de>
*
* Licensed under the 3-Clause BSD license. See LICENSE in the project root for
* more information.
*/
const Daemon = require('monero-rpc').Daemon
const express = require('express')
const prometheus = require('prom-client')
const DAEMON_HOST = process.env.DAEMON_HOST || 'http://localhost:18081'
const PORT = process.env.PORT || 3000
const Gauge = prometheus.Gauge
const app = express()
const daemon = new Daemon(DAEMON_HOST)
const incomingConnections = new Gauge({ name: 'monerod_connections_incoming', help: 'Number of incoming connections' })
const outgoingConnections = new Gauge({ name: 'monerod_connections_outgoing', help: 'Number of outgoing connections' })
const mempoolSize = new Gauge({ name: 'monerod_mempool_size', help: 'Number of transactions in the mempool' })
app.get('/metrics', (req, res) => {
console.log('.')
daemon.getInfo((err, info) => {
if (err) return console.log(err)
incomingConnections.set(Number(info.incoming_connections_count))
outgoingConnections.set(Number(info.outgoing_connections_count))
mempoolSize.set(Number(info.tx_pool_size))
res.end(prometheus.register.metrics())
})
})
app.listen(PORT, () => console.log(`Listening on :${PORT}`))

2194
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,37 @@
{
"name": "monerod_exporter",
"version": "0.1.0",
"description": "Monero Prometheus exporter",
"main": "index.js",
"scripts": {
"lint": "eslint .",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"monero",
"prometheus"
],
"author": "Excitable Aardvark <excitableaardvark@tutanota.de>",
"license": "BSDv3",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/ExcitableAardvark/monerod_exporter.git"
},
"bugs": {
"url": "https://github.com/ExcitableAardvark/monerod_exporter/issues"
},
"homepage": "https://github.com/ExcitableAardvark/monerod_exporter#readme",
"dependencies": {
"express": "^4.16.2",
"monero-rpc": "^0.4.0",
"prom-client": "^10.2.2"
},
"devDependencies": {
"eslint": "^4.17.0",
"eslint-config-standard": "^11.0.0-beta.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-node": "^6.0.0",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-standard": "^3.0.1"
}
}