utilities/tools/collector/scripts/collect_disk.sh
Nicolas Alvarez cb00a00c15 Add new log to the device and interface info files.
collector.spec: modify to add the new scripts with permissions.
collector_disk: new bash script with smartctl command.
collector_interfaces: new bash script with ethtool command.

Story: 2008452
Task: 41434

Signed-off-by: Nicolas Alvarez <nicolas.alvarez@windriver.com>
Change-Id: I4c7b6e6e3d3fe990750c1fb40b1ab555a63edf83
2021-01-13 16:31:36 -03:00

29 lines
727 B
Bash

#! /bin/bash
#
# Copyright (c) 2020 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# Loads Up Utilities and Commands Variables
source /usr/local/sbin/collect_parms
source /usr/local/sbin/collect_utils
SERVICE="disk"
LOGFILE="${extradir}/${SERVICE}.info"
###############################################################################
# Disk Info
###############################################################################
echo "${hostname}: Disk Info .: ${LOGFILE}"
for device in $(lsblk -l -o NAME,TYPE,TRAN | grep -v usb | grep -e disk | cut -d ' ' -f1); do
delimiter ${LOGFILE} "smartctl -a ${device}"
smartctl -a "/dev/${device}" >> ${LOGFILE} 2>>${COLLECT_ERROR_LOG}
done
exit 0