Inspector

> Updating Docs
This commit is contained in:
Eugene Amos 2023-12-03 23:15:26 -08:00
parent baca50124b
commit 1198fc1592
2 changed files with 78 additions and 0 deletions

View File

@ -0,0 +1,78 @@
<h1 align="center">Inspector</h1>
<p align="center">
This will monitor the network and health of a container. If the network drops or health status is anything other than "Healthy", it will reboot the container after a set amount of time. After container has been rebooted, the cool down period will start to give the container time to normalize.
<br />
</p>
## Prerequisites
The following modules are required for the script to function. They will need to be installed first. Python ships with some core modules but others will need to be installed separately.
#### Standard Python Library Modules:
This script uses Python and multiple add on modules.
* **time:** This is a part of the standard Python library, used for handling time-related tasks.
* **os:** Also part of the standard library, it provides a way of using operating system dependent functionality.
* **datetime:** This module supplies classes for manipulating dates and times, and it's included in the standard library.
* **Logging:** This is used for logging events and messages and is included in the standard library.
* **logging.handlers:** This is a part of the logging module, offering various handlers for logging.
#### Modules that Need to be Installed:
* **<a href="https://pypi.org/project/colorlog/" target="_blank">colorlog:</a>** This is an external library for colored logging output. You need to install it separately using pip.
* **<a href="https://pypi.org/project/docker/" target="_blank">docker:</a>** This module is used to interact with Docker. It is not part of the standard library and needs to be installed separately.
* **<a href="https://pypi.org/project/requests/" target="_blank">requests:</a>** A popular HTTP library for Python, used for making HTTP requests. This is not included in the standard library and must be installed separately.
To install the external modules you will first need `PIP` installed on your server. **<a href="https://pypi.org/project/pip/" target="_blank">PIP</a>** is the package manager for Python.
1. See if **pip** is already installed. Open a terminal and type:
```bash
pip -V
```
2. If not, install it.
```bash
python get-pip.py
```
3. Once **pip** is installed you can install the external modules.
```bash
pip install colorlog docker requests
```
## Folder Structure
If you have not done so already, create a new folder called `scripts` in your home folder. This is where all your scripts will go.
Inside your `scripts` folder create a new folder called `inspector`
When done your folders structure should look like this: `/home/[username]/scripts/inspector`
## Script
Get the source code from the repo and save it as `inspector.py` in the **inspector** folder created in the previous step.
Make sure to replace /some/folder/to/monitor with the actual path of the folder you want to monitor making sure to leave the quotation marks.
Next we need to change the permissions of this file so that the server can read it.
Right click on podcast_folder_monitor.py then Properties.
Click on Permissions tab at top.
Make sure Owner & Group reflect your username with Read and Write access to all.
Check the Execute box to allow executing the file as a program.
Close out the window.
<p align="center">
<h2 align="center">For install instructions see the <a href="https://wiki.euronvault.com/podfetch" target="blank">wiki</a>.</h2>
</p>