Skip to content

Ubuntu not sending out smart alerts #1

@hyperbart

Description

@hyperbart

First of all kudo's for this project. I had no monitoring, enabled your scripts for ZFS and hey presto 👍 .

However for smart it doesn't seem to work (or I did something wrong) or I'm not receiving anything although I have hooked up a disk that generates pending sectors/reallocated sectors.

Ubuntu 18.04.3 LTS
Made a symlink to the script:

root@nas:~# ls -lah /etc/smartmontools/run.d/
total 16K
drwxr-xr-x 2 root root 4.0K Apr  1 12:31 .
drwxr-xr-x 4 root root 4.0K Nov 16 16:14 ..
-rwxr-xr-x 1 root root  231 Jul 30  2016 10mail
-rwxr-xr-x 1 root root  258 Jul 30  2016 10powersave-notify
lrwxrwxrwx 1 root root   50 Mar 21 18:51 10telegram -> /root/telegramsystemnotifications/telegram_text.sh

Script contains:

root@nas:~# cat /root/telegramsystemnotifications/telegram_text.sh
#!/bin/bash
CHAT_ID='xxxxxxxxx'
API_KEY='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

# Get the message from stdin, making the first line bold.
MESSAGE=$(cat -)

# Try to send a message; sleep a bit after each unsuccessful attempt.
until /usr/bin/curl -G \
    --data-urlencode "parse_mode=Markdown" \
    --data-urlencode "chat_id=${CHAT_ID}" \
    --data-urlencode "text=${MESSAGE}" \
    "https://api.telegram.org/bot${API_KEY}/sendMessage" >&/dev/null
do
    sleep 10
done

A simple echo to the symlink sends a message so that seems to work.
(echo hello | /etc/smartmontools/run.d/10telegram)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions