https://github.com/vlcty/check_usb
Icinga check for new USB devices
https://github.com/vlcty/check_usb
Last synced: 2 months ago
JSON representation
Icinga check for new USB devices
- Host: GitHub
- URL: https://github.com/vlcty/check_usb
- Owner: vlcty
- License: gpl-3.0
- Created: 2015-09-24T09:31:38.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-24T09:57:50.000Z (over 9 years ago)
- Last Synced: 2025-03-17T13:05:51.752Z (2 months ago)
- Language: Perl
- Size: 148 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# USB overwatch for Icinga 2
## What is it
This is a plugin for Icinga 2 to overwatch the USB bus for new USB devices
## What it does
It's a dirty implementation to monitor USB activity on Linux servers. It fetches the last 10 lines of dmesg output and checks for newly discovered USB devices.
## Differences from check_hw
This plugin is not intended to monitor specific USB devices or ports but the whole bus at once. I run a Tor exit relay on a 1U rack server and don't want any nasty stuff attached to the server without proper notification in advance, for example: USB Sticks, KVM devices and so on.
I combined my setup with an EventCommand which turns off the Tor relay if the service goes into CRITICAL state.
## How to install
### Step 1: Fetch the script
Fetch the script and place it in your PluginDir-Folder on every server you want to monitor. That's usually `/usr/lib/nagios/plugins`.
Note: This is an agent based check!
### Step 2: Make it available for Icinga 2
#### Step 2.1: Create a CheckCommand object
Navigate on your Icinga 2 server to your config folder, e.g.: `/etc/icinga2/conf.d` and open the `commands.conf` file.
Place this piece of code at the end of the file:```
object CheckCommand "usb-overwatch" {
import "plugin-check-command"command = [ PluginDir + "/check_usb" ]
}
```#### Step 2.2: Add check to a host
To add the check to a host use this snippet in a host configuration file:
```
object Host "mineralwasser" {
[...]
}object Service "usb-activity" {
import "generic-service"host_name = "minerwalwasser"
display_name = "USB Overwatch"check_command = "usb-overwatch"
}
```If you want to add it to multiple hosts work with `apply`!