Skip to content

Commit

Permalink
Add telegraf service
Browse files Browse the repository at this point in the history
  • Loading branch information
perdy committed Oct 27, 2017
1 parent 2c6b3fd commit c783391
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,11 @@ This bot provides a real time interaction with Barrenero through its API, allowi
the API and link it to a Telegram chat. Once the registration is done, it's possible to query for Barrenero status,
restart services and performs any action allowed in the API.

Barrenero Telegraf
^^^^^^^^^^^^^^^^^^

Telegraf code can be found in this `repository <https://github.com/PeRDy/barrenero-telegraf>`_.

Extension for Barrenero that harvests information and send it using Telegraf.

This extension provides an automatic way of harvesting Barrenero status through its API and send it through Telegraf.
4 changes: 4 additions & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ Telegram
Telegram bot for Barrenero that serves information and provides interactive methods through Barrenero API.
Code can be found in this `repository <https://github.com/PeRDy/barrenero-telegram>`_.

Telegraf
Extension for Barrenero that harvests information and send it using Telegraf.
Code can be found in this `repository <https://github.com/PeRDy/barrenero-telegraf>`_.

Code repository can be found in `GitHub <https://github.com/PeRDy/barrenero>`_.

Expand Down Expand Up @@ -75,6 +78,7 @@ Requirements
Miner<miner/index.rst>
API<api/index.rst>
Telegram<telegram/index.rst>
Telegraf<telegraf/index.rst>

Indices and tables
==================
Expand Down
34 changes: 34 additions & 0 deletions doc/source/telegraf/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
..
Barrenero, a set of services and tools for effective mining cryptocurrencies.
Copyright (C) 2017 José Antonio Perdiguero López
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.

Telegram
========

.. toctree::
:maxdepth: 1
:caption: Contents

Installation<installation.rst>

Overview
--------

Telegraf code can be found in this `repository <https://github.com/PeRDy/barrenero-telegraf>`_.

Extension for Barrenero that harvests information and send it using Telegraf.

This extension provides an automatic way of harvesting Barrenero status through its API and send it through Telegraf.
63 changes: 63 additions & 0 deletions doc/source/telegraf/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
..
Barrenero, a set of services and tools for effective mining cryptocurrencies.
Copyright (C) 2017 José Antonio Perdiguero López
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.

Installation
============
1. Install services:

.. code:: console
sudo ./make install -u <influxdb_username> -p <influxdb_password> <influxdb_url> <influxdb_database>
2. Move to installation folder:

.. code:: console
cd /usr/local/lib/barrenero/barrenero-telegraf/
3. Build the service:

.. code:: console
./make build
4. Reboot or restart Systemd unit:

.. code:: console
sudo service barrenero_telegraf restart
Systemd
-------

The project provides a service file for Systemd that will be installed. These service files gives a reliable way to run
each miner, as well as overclocking scripts.

To check a miner service status:

.. code:: console
service barrenero_telegram status
Run manually
------------

As well as using systemd services you can run miners manually using:

.. code:: console
./make run
23 changes: 23 additions & 0 deletions make
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ SERVICES = {
'name': 'barrenero-telegram',
'systemd': ['barrenero_telegram']
},
'telegraf': {
'url': 'https://github.com/PeRDy/barrenero-telegraf',
'name': 'barrenero-telegraf',
'systemd': ['barrenero_telegraf']
},
}


Expand Down Expand Up @@ -207,6 +212,23 @@ def install(*args, **kwargs):
'introduce the token generated: ')
install_service('telegram', bot_token, path=barrenero_path)

if 'telegraf' in kwargs['service']:
barrenero_api_token = input('Barrenero API token: ')
influxdb_url = input('InfluxDB URL: ')
influxdb_database = input('InfluxDB Database: ')
influxdb_username = input('InfluxDB Username: ')
influxdb_password = input('InfluxDB Password: ')

install_kwargs = {
'pathh': barrenero_path,
}
if influxdb_username:
install_kwargs.update({
'influxdb_username': influxdb_username,
'influxdb_password': influxdb_password,
})
install_service('telegraf', barrenero_api_token, influxdb_url, influxdb_database, **install_kwargs)


@command(command_type=CommandType.PYTHON,
args=((('service',), {'help': 'Services to install', 'nargs': '+', 'choices': tuple(SERVICES.keys())}),
Expand Down Expand Up @@ -237,6 +259,7 @@ def clean(*args, **kwargs):
shutil.rmtree(os.path.abspath(os.path.join(os.getcwd(), 'barrenero-miner')), ignore_errors=True)
shutil.rmtree(os.path.abspath(os.path.join(os.getcwd(), 'barrenero-api')), ignore_errors=True)
shutil.rmtree(os.path.abspath(os.path.join(os.getcwd(), 'barrenero-telegram')), ignore_errors=True)
shutil.rmtree(os.path.abspath(os.path.join(os.getcwd(), 'barrenero-telegraf')), ignore_errors=True)


if __name__ == '__main__':
Expand Down

0 comments on commit c783391

Please sign in to comment.