Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HOWTO Install and Configure Glances + InfluxDB + Grafana
- ======
- Screenshots
- [ https://imgur.com/a/9O9jzxP ]
- ======
- 1) Install and Test Glances
- There are several methods to Install Glances on your system. Choose your weapon!
- GNU/Linux
- Glances is available on many Linux distributions, so you should be able to
- install it using your favorite package manager. Be aware that when you use
- this method the operating system package for Glances may not be the latest
- version.
- === Valuable resources to guide you through the Glances Install ===
- * Glances PyPI Project :: https://pypi.org/project/Glances/
- * Glances Main Website :: https://nicolargo.github.io/glances/
- * Glances GitHub Repo :: https://github.com/nicolargo/glances
- * * * I prefer to Install Glances using pip * * *
- $ pip install glances
- * * * Install Optional Features * * *
- Optionally Install the following libraries in order to
- use optional features (like the Web interface, exports modules...):
- $ pip install 'glances[action,browser,cloud,cpuinfo,docker,export,folders,gpu,graph,ip,raid,snmp,web,wifi]'
- Done Installing Glances and optional libraries.
- Test Glances:
- Run glances locally from terminal:
- $ glances
- Run glances in local web server mode:
- $ glances -w
- Glances Web User Interface started on http://0.0.0.0:61208/
- You can stop right here if glances worked as expected.
- You can also read on and learn some more...
- Usage
- For the standalone mode, run:
- $ glances
- For the Web server mode, run:
- $ glances -w
- and enter the URL http://<ip>:61208 in your favorite web browser.
- NOTE: If you only plan on using Glances to monitor your local machine,
- from you local machine, on your local machine, like you would run
- conky, gkrellm, htop, top, or any sensor applet or gadget on your
- desktop on a single machine, you can *STOP RIGHT HERE*. =)
- === If you want to monitor multiple remote machines then follow the white rabbit... ===
- Glances client/server mode:
- Port 61209/tcp needs to be open on the glances-server.
- ie: The glances-server machine you run [ $ glances -s ] on.
- NOTE: If you have a firewall running on the glances-server
- you need to open port [ 61209/tcp ] on the glances-server.
- The glances-server is the machine you want to be remotely monitored.
- The glances-server is the machine you will run [ $ glances -s ]
- For a very clear, simple example, I will define the server and the client here.
- glances-server (Machine you want to remotely monitor)
- glances-client (Machine that will monitor the remote Glances server machine)
- On the glances-server, run...
- $ glances -s
- HINT: Don't forget to open Port 61209 on the glances-server machine.
- On the glances-client (Machine that will do the monitoring), run...
- $ glances -c <ip>
- In other words: [ $ glances -c INSERT-glances-server-IP-HERE ]
- If all went well, you are now monitoring glances-server from/on glances-client.
- This concludes the Glances installation and basic usage testing.
- Note: glances.conf and systemd service /etc/systemd/system/glances.service
- A glances.conf is NOT NEEDED if you are only going to use glances
- on your local machine with no bells and whistles. In other words,
- if you are not going to use glances in conjunction with InfluxDB
- or Grafana, for example.
- You can even use glances in server/client mode to monitor remote
- machines, as explained in detail above, without any need for a glances.conf.
- Open port (61209/tcp) in the firewall on the glances-server if you plan
- on monitoring a remote machine in server/client mode.
- If you plan on using Grafana and InfluxDB for a full fledged
- System Monitoring solution there is a need for glances.conf as
- well as a systemd service for glances. ie: /etc/systemd/glances.service
- *** THIS SPACE RESERVED FOR FUTURE INFORMATION REGARDING ***
- *** glances.conf and SystemD -- /etc/systemd/glances.service
- ====== Everything Below Is Not Complete --- More to come... ======
- ......
- Install Grafana
- Start Grafana Using systemd:
- If you're Logging in to Grafana for the first time:
- To run Grafana open your browser and go to http://localhost:3000/.
- 3000 is the default http port that Grafana listens to if you haven’t
- configured a different port. -> [ http://docs.grafana.org/installation/configuration/#http-port ]
- Then follow the instructions here. -> [ http://docs.grafana.org/guides/getting_started/ ]
- Default username: admin
- Default password: admin
- When you log in for the first time you will be asked to change your password.
- We strongly encourage you to follow Grafana’s best practices and change the
- default administrator password. You can later go to user preferences and
- change your user name.
- Before you create your first dashboard you need to add your data source.
- How to add a data source in Grafana
- I will use InfluxDB for a data source.
- How to install InfluxDB
- Each major Linux Distribution should have a Influxdb package in the repos.
- openSUSE InfluxDB Installation
- $ zypper install influxdb
- $ systemctl enable influxdb
- $ systemctl start influxdb
- Configure InfluxDB In Glances
- https://glances.readthedocs.io/en/latest/gw/influxdb.html?highlight=influxdb
- You can export statistics to an InfluxDB server (time series server).
- The connection should be defined in the Glances configuration file as following:
- Create /etc/glances.conf (or ~/.local/glances/glances.conf -- more on this later)
- and insert the following text:
- NOTE: DO NOT INCLUDE THE DOTS ...
- ...
- [influxdb]
- host=localhost
- port=8086
- user=root
- password=root
- db=glances
- tags=foo:bar,spam:eggs
- ...
- See this link for detailed information on Glances Configuration:
- https://glances.readthedocs.io/en/latest/config.html
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement