updated node_exporter scripts

This commit is contained in:
Samuel Philipp 2021-05-16 00:27:56 +02:00
parent c395134a75
commit 52764e5bed
Signed by: samuel-p
GPG key ID: 2AD495D17760CB4E
5 changed files with 42 additions and 12 deletions

View file

@ -11,15 +11,24 @@ Some useful bash scripts.
|[validate-remote-backup.sh](validate-remote-backup.sh)|Script to validate server side rsync command to use ssh force command|
|[docker-compose-up-all.sh](docker-compose-up-all.sh)|Script to call `docker-compose up -d` on all subdirectories|
|[docker-stack-deploy-all.sh](docker-stack-deploy-all.sh)|Script to call `docker stack deploy` on all subdirectories|
|[node_dir_size_exporter.sh](node_dir_size_exporter.sh)|Script to call `du` on a given directory to export the size to prometheus|
|[node_dir_size_exporter.sh](node_exporter/directory-size.sh)|Script to call `du` on a given directory to export the size to prometheus|
|[update-notify.sh](update-notify.sh)|Script to call `apt` to check the host for new updates and notify in gotify|
__node_exporter__
|Script|Description|
|---|---|
|[active-sessions.sh](node_exporter/active-sessions.sh)|Script to export all active sessions to prometheus|
|[directory-size.sh](node_exporter/directory-size.sh)|Script to export directory sizes to prometheus|
## Setup
To set up all scripts in the current directory run this:
```
curl https://git.sp-codes.de/samuel-p/awesome-scripts/raw/branch/master/setup.sh | bash -s healthcheck.sh login-notify.sh validate-remote-backup.sh docker-compose-up-all.sh docker-stack-deploy-all.sh node_dir_size_exporter.sh update-notify.sh
curl https://git.sp-codes.de/samuel-p/awesome-scripts/raw/branch/master/setup.sh | bash -s healthcheck.sh login-notify.sh validate-remote-backup.sh docker-compose-up-all.sh docker-stack-deploy-all.sh update-notify.sh
curl https://git.sp-codes.de/samuel-p/awesome-scripts/raw/branch/master/setup.sh | bash -s active-sessions.sh directory-size.sh
```
## Usage
@ -41,3 +50,18 @@ Place a `.gotify` file in the same direction as the script and put the applicati
```
session optional pam_exec.so seteuid /path/to/login-notify.sh
```
### node_exporter
Add the following in crontab:
```
*/5 * * * * /root/exporter/directory-size.sh "<your_dir_pattern>" "<your_key>" | sponge /path/to/textfiles/directory-size.prom
* * * * * /root/exporter/active-sessions.sh | sponge /path/to/textfiles/active-sessions.prom
```
Add the `textfiles` dir as param to `node_exporter`:
```
node_exporter --collector.textfile.directory /path/to/textfiles ...
```