arc/ansible/roles/zabbix-agent/files/scripts/zabbix-check-ro.sh
siddharthvipul 79a92bb2f3 add zabbix agent role
Signed-off-by: siddharthvipul <siddharthvipul1@gmail.com>
2021-03-16 13:42:06 +00:00

7 lines
442 B
Bash

#!/bin/bash
logfile="/var/log/centos-ro-devices"
ro_mounted_devices=$(awk '$4 ~ "^ro[,$]" && $3 !~ "(squashfs|iso9660|tmpfs|nfs)" {print $0}' /proc/mounts | wc -l)
zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k devices.ro -o $ro_mounted_devices >/dev/null
echo "=== $(date) === Read-Only devices on this system $(hostname)" >> $logfile
awk '$4 ~ "^ro[,$]" && $3 !~ "(squashfs|iso9660|tmpfs|nfs)" {print $0} ' /proc/mounts >> $logfile