顯示具有 mutt 標籤的文章。 顯示所有文章
顯示具有 mutt 標籤的文章。 顯示所有文章

2025/01/10

在PVE中撈出所有guest的 cpu使用率並在超過上限值時發出告警


#!/bin/bash

pvesh get /cluster/resources|awk '{print $2" "$33" "$8}'|grep -E "lxc|qemu"|sed 's/....$//' > /tmp/all_guest_cpu

cat /tmp/all_guest_cpu | awk  '$3 > 80 {print $0}' > /tmp/guest_cpu_high

if [ -s /tmp/guest_cpu_high ]; then

        sed -i '1i network guest cpu high' /tmp/guest_cpu_high
        sed -i '2i ==========' /tmp/guest_cpu_high
        cp /tmp/guest_cpu_high /tmp/guest_cpu_high_network
        /usr/bin/lftp ftp://user:pwd@10.0.0.1 -e "put /tmp/guest_cpu_high_network; bye"
        mutt -s guest_cpu_high user@abc.com < /tmp/guest_cpu_high

fi

2023/04/14

為了因應centos 7 EOS

今天在轉移程式到 almalinux 9 時 mutt 一直無法寄信

mail server 的log如下

Apr 14 10:09:09 mail postfix/smtpd[523701]: connect from unknown[10.0.0.1]

Apr 14 10:09:09 mail postfix/smtpd[523701]: lost connection after STARTTLS from unknown[10.0.0.1]

看來almalinux 9的mutt 預設會使用 STARTTLS

在 .muttrc 加上以下這行

set ssl_force_tls = no


目前寄信正常了


20240308 後記


轉換到新mail server後 有些mutt又出現不能寄信的狀況

以下是log


Mar  8 06:13:01 mail postfix/smtpd[27212]: warning: TLS library problem: error:0A000126:SSL routines::unexpected eof while reading:ssl/record/rec_layer_s3.c:320:

Mar  8 06:13:01 mail postfix/smtpd[27212]: lost connection after STARTTLS from unknown[10.0.0.1]


必須在.muttrc再加上 set ssl_starttls = no 
包括之前說明的共二行如下

set ssl_force_tls = no
set ssl_starttls = no

目前正常了 再觀察看看

2023/01/07

在一台几器上使用mutt寄信時出現

SMTP session failed: 502 5.5.2 Error: command not recognized


到mail server上看log


Jan  7 05:39:01 mail postfix/smtpd[1874477]: improper command pipelining after EHLO from unknown[10.0.01]: hostabc\r\n

感覺好像是hostname的問題

於是在 .muttrc 裡加上一行

set hostname=myhost


就ok了

2019/11/13

今天在使用mutt時一直出現以下的錯誤
找了半天還是沒有答案

mutt -s 'test' abc@de.com -a /tmp/test < test

SMTP session failed: 500 5.5.2 Error: bad UTF-8 syntax
Could not send the message.

改用

/usr/bin/mail -a /tmp/test1 -a /tmp/test2 -S smtp="10.0.0.1:25" -r "from@dde.com" -s 'test' to@de.com < test

https://www.binarytides.com/linux-mailx-command/

2019/11/06

剛剛在設定.muttrc從hinet寄信的時候

設ip不能寄
set smtp_url = "smtp://168.95.4.10:25/"

要設fqdn才能寄
set smtp_url = "smtp://msa.hinet.net:25/"

什麼怪事都有

http://nengfang.blogspot.com/2014/07/hinet-isp-smtp-server.html

2018/02/17

之前要發mail都使用二種方法

1. 直接在需要寄信的主機上起一個mail server 來寄

2. 使用python

import smtplib,sys

sender = "test_from_hinet@hinet.net"
receipt = "abc@de.com
smtp = smtplib.SMTP("168.95.4.10")
header = "Subject: test outside in mail from hinet\r\n\r\n"
msg = "test outside in mail from hinet"
smtp.sendmail(sender, receipt, header+msg)
smtp.quit()

今天才知道 mutt 也可以設定到別台mail server寄信
設定方法是安裝好mutt後在user的家目錄設定 ~/.muttrc

加上以下這行
set smtp_url = "smtp://mail.server.ip:25/"
或在
/etc/Muttrc加上相同的內容
醬就可以了
mutt -s test abc@de.com -a test < test

2013/06/20

昨天把win的log丟到log server後分析程式出現問題
就是看不到本文
所有的log變成了附件
要看的話就很麻煩
改用mutt來寄
語法跟mail其實差不多

 mutt [-a 附加檔] [-i 內文檔] [-b 秘密副本] [-c 一般副本]   [-s 信件標題] email位址 < mail內容
http://linux.vbird.org/linux_server/0380mail.php#mua_mutt

中文就ok了