help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to configure smartd and send notifications?


From: Tristan Kohl
Subject: Re: How to configure smartd and send notifications?
Date: Tue, 21 May 2024 17:33:24 +0200

Hello Felix,

my last message was not to critizise your help but rather my frustration with 
my own limited progress. I really appreciate the help!

program-file at least results in a usable thing however since the script gets 
executed by smard I get the "command not found" in my logs. It seems like curl 
is not in PATH for smartd. Do I need to import something into the gexp?

Also those env variables are defined by smartd during runtime depending on 
which drive produced the error. Therefore I need shell expansion/env variables 
and have to use system (without *) imho.

This is the current state:

(define-smartd-send-ntfy
  (program-file "send-ntfy"
    #~(system
      (string-append "curl " "-H \"Title: $SMARTD_SUBJECT\" " ...))))

Note: when using system* the error is:
In execvp of curl: No such file or directory

Thanks for bearing with me!
Tristan

On 21 May 2024 01:42:02 CEST, Felix Lechner <felix.lechner@lease-up.com> wrote:
>Hi Tristan,
>
>On Mon, May 20 2024, Tristan Kohl via wrote:
>
>> smartd then complains that the file is not executable...
>
>Sorry, it was a Monday morning for me.
>
>If you are comfortable using Guile---which I'm sure you almost are by
>now--You can use 'program-file':
>
>Please have a look at any of these hooks on one of my systems. [1]
>
>An untested version of your script might look something like this,
>although I probably got some of the quoting wrong---either in Scheme or
>in your command.
>
>(define smartd-send-ntfy
>  (program-file "send-ntfy"
>  #~((let* ((subject (getenv "SMARTD_SUBJECT))
>            (device (getenv "SMARTD_DEVICE))
>            (failure-type (getenv "SMARTD_FAILTYPE))
>            (timestamp (getenv "SMARTD_TFIRST"))
>            (message (getenv "SMARTD_MESSAGE")))
>       (system* "curl"
>                "ntfy.sh/<my-topic>"
>                "-d" (string-join
>                      `("curl"
>                        "-Ls"
>                        "-H" ,(string-append "Title: " subject)
>                        "-d" ,subject
>                        "-d" ,(string-append
>                                "'"
>                                (string-join (list "Device:" device
>                                                   "Time:" timestamp
>                                                   "Message:" message))
>                                "'"))))))))
>
>Kind regards
>Felix
>
>[1] 
>https://codeberg.org/lechner/system-config/src/commit/215fc20a29e553fd8108ba737d557ecb98279540/host/wallace-server/operating-system.scm#L1134-L1168

reply via email to

[Prev in Thread] Current Thread [Next in Thread]