#!/bin/sh
#
# opsi_nagios is part of the device management solution opsi http://www.opsi.org
# Copyright (c) 2008-2025 uib GmbH <info@uib.de>
# All rights reserved.
# License: AGPL-3.0-only
#
# The opsi monitoring module is required to use this function: https://opsi.org/de/extensions
#
#
# Certain checks can be executed with --checks.
# opsiconfd health-check --format nagios --checks mysql
# Information on this can be found in the opsiconfd help 'opsiconfd health-check --help' and 'opsiconfd health-check --documentation'
#
# Copy this script to /usr/lib/nagios/plugins/opsi_opsi and make it executable.


if [ -z "$1" ]; then
  echo "Usage: $0 check_to_run"
  echo "Example: $0 mysql"
  echo "Available checks can be listed with: opsiconfd health-check --list"
  echo "For detailed information about each check, use: opsiconfd health-check --documentation"
  exit 1
fi

opsiconfd health-check --format nagios --checks $1