Sample Header Ad - 728x90

Is it alright to add a disk size monitoring script for NAGIOS, using loop?

0 votes
1 answer
152 views
I have a process that gets sizes for all disks on server, writes it into a file like this # cat disksize DISK# ACTUAL WARNING CRITICAL disk1 12 20 30 disk2 45 60 75 first row of file is for reference, showing what each column is for. Below is monitoring script, but I'm not sure if it will work for nagios, as some of these sizes may result in OK, some maybe in warning. Anyone give any insight on this, please # cat check-disk_size #!/usr/bin/env bash LOGFILE='disksize' cat ${LOGFILE} | while read disk_name actual warning critical do if [ $actual -ge $warning ]; then echo "WARNING: $disk_name has reached standard warning limit, Current actual: ${actual}" exit 1 elif [ $actual - ge $critical ]; then echo "WARNING: $disk_name has reached standard critical limit, Current actual: ${actual}" exit 2 else echo "OK: $disk_name is under optical limit, Current actual: ${actual}" exit 0 done
Asked by Sollosa (1993 rep)
Nov 24, 2021, 01:26 PM
Last activity: Nov 24, 2021, 03:52 PM