# Monitoring plugin to check Syncthing status This Icinga/Nagios check plugin permit to check Syncthing status : - verify Syncthing REST API is responding - check remote devices last seen datetime - check system and shared folders errors ## Installation First, generate and retreive the REST API key from Syncthing web interface: - in Actions menu, click on Configuration - in General tab, under API key, click on Generate button and copy the key ``` API_KEY=n6RseK3HWY5LJ29PzNSUJbmK4XKHa5uV apt install git git clone https://gitea.zionetrix.net/bn8/check_syncthing.git /usr/local/src/check_syncthing mkdir -p /usr/local/lib/nagios/plugins ln -s /usr/local/src/check_syncthing/check_syncthing /usr/local/lib/nagios/plugins/ echo "command[check_syncthing]=/usr/local/lib/nagios/plugins/check_syncthing -k $API_KEY" > /etc/nagios/nrpe.d/syncthing.cfg service nagios-nrpe-server reload ``` ## Usage ``` usage: check_syncthing [-h] [-d] [-v] [-H HOST] [-p PORT] -k API_KEY [-S] [-t TIMEOUT] [-D DEVICES] [-x EXCLUDED_DEVICES] [-F FOLDERS] [-X EXCLUDED_FOLDERS] [-w WARNING_DEVICE_LAST_SEEN] [-c CRITICAL_DEVICE_LAST_SEEN] Monitoring plugin to check Syncthing status options: -h, --help show this help message and exit -d, --debug Enable debug mode (default: False) -v, --verbose Enable verbose mode (default: False) -H HOST, --host HOST Syncthing host (default: 127.0.0.1) -p PORT, --port PORT Syncthing port (default: 8384) -k API_KEY, --api-key API_KEY Syncthing REST API key (default: None) -S, --ssl Enable SSL (default: False) -t TIMEOUT, --timeout TIMEOUT Requests timeout (in seconds) (default: 5) -D DEVICES, --devices DEVICES Monitor only specified devices (default: []) -x EXCLUDED_DEVICES, --excluded-devices EXCLUDED_DEVICES Do not monitor specified devices (default: []) -F FOLDERS, --folders FOLDERS Monitor only specified folders (default: []) -X EXCLUDED_FOLDERS, --excluded-folders EXCLUDED_FOLDERS Do not monitor specified folders (default: []) -w WARNING_DEVICE_LAST_SEEN, --warning-device-last-seen WARNING_DEVICE_LAST_SEEN Warning threshold for device last seen time in hours (default: 12) -c CRITICAL_DEVICE_LAST_SEEN, --critical-device-last-seen CRITICAL_DEVICE_LAST_SEEN Critical threshold for device last seen time in hours (default: 24) ``` ## Copyright Copyright (c) 2023 Benjamin Renard ## License This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.