#!/bin/sh
#
# S.M.A.R.T. attribute check plugin for Nagios
# written by Gerd Koenig <geko@deb.ymc.ch>
# and Daniel Beyer <dabe@deb.ymc.ch>
#
# Description:
#
# This plugin will provide the output previously generated by command
# fliwi-check-smart for nagios.

log_dir="/var/log/fliwi-monitoring"

if [ -f "$log_dir/fliwi_check_smart.message" ] && \
   [ -f "$log_dir/fliwi_check_smart.exit_code" ]; then
  message=$(cat $log_dir/fliwi_check_smart.message)
  exit_code=$(cat $log_dir/fliwi_check_smart.exit_code)
else
  message="Can not find any SMART-information in '$log_dir'"
  exit_code=3
fi

echo $message
exit $exit_code
