Smartmontools – Comprehensive Monitoring Guide

Overview

Smartmontools is an essential tool for monitoring SSDs and HDDs in modern server environments. It identifies early signs of hardware degradation, provides detailed diagnostics, and integrates seamlessly into automated maintenance workflows. This guide delivers a production‑ready configuration, clear threshold recommendations, structured troubleshooting, operational best practices, and an automated daily health‑check script for the server at1.

Tags

vim /etc/vim/vimrc

syntax on                  " Enable syntax highlighting
set background=dark        " Optimize color schemes for a dark background
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal!
Tags
  1. ai ansible
  2. omz plugin enable ansible
  3. omz plugin info ansible

vim ~/scripts/ansible_structure_setup.sh

#!/bin/bash
# Script Version: 0.8
# Description: Set up Ansible directory structure and necessary files in /etc/ansible

# Create directories
mkdir -p /etc/ansible/{group_vars,host_vars,roles,playbooks}

# Create configuration and inventory files
if [ !
Tags

Erstes Wort

grep -Eo '^[^ ]+'

Letztes Wort

grep -oE '[^ ]+$'

extract IP addresses

grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| 

exclude lines which begin with "#" or ";"

grep "^[^#;]" 

exclude empty lines and contain #

egrep -v '#|^$'

Tags

vim

Numeric sort

:sort n

remove duplicate lines

:%sort u

Sorting IP addresses

:%sort n /\.\d\+\./

To adjust the indent on lines

V    select lines
>    indent

# block

Ctrl v
shift I
#
ESC ESC

replace sequences of spaces with a single tab

:'<,'>s/ \+/\t/g

Tags
  1. omz plugin load tmux; omz plugin enable tmux
  2. omz reload
  3. omz plugin info tmux
| Alias      | Command                    | Description                                              |
| ---------- | -------------------------- | -------------------------------------------------------- |
| `ta`       | tmux attach -t             | Attach new tmux session to already running named session |
| `tad`      | tmux attach -d -t          | Detach named tmux session                                |
| `ts`       | tmux new-session -s      
Tags
  1. https://github.com/settings/tokens
  2. ai gh
  3. gh auth login
  4. gh repo clone user/repo
Tags

sort | uniq -c  | sort -nr

Tags

awk

skip first column

awk '{$1=""}1'  

print only the last column in a record

awk '{print $NF}'

print first 3 numbers from ip address 
Delimiter "."

awk -F\. '{print $1"."$2"."$3"."}'

Tags
Tags

Vim supports plugins to extend its functionality. 

  1. Here are a few popular plugin managers
  2. Install Plug by adding the following lines to your `.vimrc`:
      ```
      " Install Plug if not already installed
Tags
-='cd -'

...=../..
....=../../..
.....=../../../..
......=../../../../..
1='cd -1'
2='cd -2'
3='cd -3'
4='cd -4'
5='cd -5'
6='cd -6'
7='cd -7'
8='cd -8'
9='cd -9'
CA='2>&1 | cat -A'

Tags