|
| 1 | +Preparing Environment |
| 2 | +====================== |
| 3 | +You will need Python version 3.5+ and `pip` installed. |
| 4 | +In the most cases `pip` should come bundled, if building from source, you will need to have `openssl` development package installed, otherwise it will skip. |
| 5 | + |
| 6 | +If for some reason you don't have it and cannot build with `openssl`, there's always: |
| 7 | + |
| 8 | +`wget https://bootstrap.pypa.io/get-pip.py | python` |
| 9 | + |
| 10 | +Virtualenv |
| 11 | +---------- |
| 12 | +It is optional, but highly recommended. |
| 13 | +Can be installed via `pip install virtualenv` |
| 14 | + |
| 15 | +To create actual virtualenv, do: |
| 16 | +`virtualenv venv` |
| 17 | +Or if you have multiple versions of python (usually 2.7 and 3.****), |
| 18 | +failproof approach would be: |
| 19 | +`python3 -m virtualenv venv` |
| 20 | + |
| 21 | +This will create virtual environment inside folder |
| 22 | + |
| 23 | +Depending on OS, activating environment may slightly differ. |
| 24 | +Linux/MacOS/*BSD it is `source venv/bin/activate` |
| 25 | +Windows: `venv\Scripts\activate` |
| 26 | + |
| 27 | +Installing Oshino |
| 28 | +----------------- |
| 29 | +When everything is prepared, installing is as easy as: |
| 30 | +`pip install oshino` |
| 31 | + |
| 32 | + |
| 33 | +Launching Oshino |
| 34 | +================ |
| 35 | +First create config. Easy way to do that is by using `oshino-admin` |
| 36 | + |
| 37 | +`oshino-admin config init config.yaml` |
| 38 | + |
| 39 | +And now you can actually start it: |
| 40 | +`oshino --config=config.yaml` |
| 41 | + |
| 42 | +Running as daemon |
| 43 | +------------------ |
| 44 | +To start as a daemon, we need to use `oshino-admin` |
| 45 | +`oshino-admin start --config=config.yaml` |
| 46 | + |
| 47 | +If you're running on your local machine or not as root, it's possible to get error like: |
| 48 | +`Unable to create the pidfile.` |
| 49 | +By default it writes PID (Process ID) file to `/var/run/oshino.pid` and permissions are not always sufficient to do that. |
| 50 | +Issue can be easily mitigated by providing custom path: |
| 51 | +`oshino-admin start --config=config.yaml --pid=oshino.pid` |
| 52 | + |
| 53 | +To check if it's running: |
| 54 | +`oshino-admin status` |
| 55 | + |
| 56 | +To stop it: |
| 57 | +`oshino-admin stop` |
| 58 | + |
| 59 | +Main caveat in using custom pid path, you need to provide it for `status` and `stop` commands as well: |
| 60 | + |
| 61 | +`oshino-admin status --pid=oshino.pid` |
| 62 | +`oshino-admin stop --pid=oshino.pid` |
| 63 | + |
| 64 | + |
| 65 | +Installing plugins |
| 66 | +================== |
| 67 | + |
| 68 | +In the most cases, these plugins are for agents. Agent in Oshino context is metrics collector. |
| 69 | +So for example, if our service is using [Prometheus](https://prometheus.io/) and we want to collect metrics from it, |
| 70 | +plugin needs to be installed: |
| 71 | + |
| 72 | +`oshino-admin plugin install oshino_prometheus` |
| 73 | + |
| 74 | +To list available plugins: |
| 75 | +`oshino-admin plugin list` |
| 76 | + |
| 77 | +Plugin can be removed via `uninstall` command: |
| 78 | + |
| 79 | +`oshino-admin plugin uninstall oshino_statsd` |
| 80 | + |
| 81 | +Making sense of Config |
| 82 | +======================= |
| 83 | +Generated config should look like this: |
| 84 | + |
| 85 | +```yaml |
| 86 | +--- |
| 87 | +interval: 10 |
| 88 | +riemann: |
| 89 | + host: localhost |
| 90 | + port: 5555 |
| 91 | +agents: |
| 92 | + - name: health-check |
| 93 | + module: oshino.agents.http_agent.HttpAgent |
| 94 | + url: http://python.org |
| 95 | + tag: healthcheck |
| 96 | +``` |
| 97 | +
|
| 98 | +It says, that `interval` at which metrics will be pushed is 10 seconds, |
| 99 | +it is expecting Riemann at `localhost:5555` |
| 100 | +And currently has one Agent called `health-check` which uses included `HttpAgent` |
| 101 | +to do a healthcheck on `http://python.org`. Resulting metrics are tagged `healthcheck` |
| 102 | + |
| 103 | +More info can be found on: [Config](config.md) section. |
| 104 | + |
| 105 | +In general, a proper Riemann's address needs to be providen and array of agents extended |
| 106 | +with agents you require |
0 commit comments