Postfix relay yandex
Пошаговая инструкция установки Postfix и Dovecot на Ubuntu
journalctl: open database /etc/aliases.db: No such file or directory
user@yandex.ru - e-mail с которого будем посылать письма на произвольные адреса
$ sudo apt update
$ sudo apt upgrade
(postfix без настройки)
$ sudo apt install postfix mutt
$ sudo mkdir /etc/postfix/private
#$ sudo cp /etc/postfix/main.cf /etc/postfix/main.cf.bak
$ sudo nano /etc/postfix/main.cf
Заменить содержимое файла на:
relayhost =
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/private/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_type = cyrus
smtp_sasl_mechanism_filter = login
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/private/sender_relay
sender_canonical_maps = hash:/etc/postfix/private/canonical
Сохранить.
Создать файл /etc/postfix/private/canonical :
$ sudo nano /etc/postfix/private/canonical
Содержимое (Ваш: user@yandex.ru где user ваш логин) :
@yandex.ru user@yandex.ru
Сохранить.
Создать файл /etc/postfix/private/sender_relay :
sudo nano /etc/postfix/private/sender_relay
Содержимое:
@yandex.ru smtp.yandex.ru
Сохранить.
Создать файл /etc/postfix/private/sasl_passwd:
где вместо *** укажите свой пароль:
$ sudo nano /etc/postfix/private/sasl_passwd
Содержимое (Ваш: user@yandex.ru где user ваш логин, password - ваш пароль ) :
[smtp.yandex.ru] user@yandex.ru:password
Сохранить.
$ sudo postmap /etc/postfix/private/*
$ sudo systemctl restart postfix.service
#$ sudo systemctl status postfix.service
$ sudo reboot
посмотреть:
$ sudo journalctl -b
$ sudo journalctl -b -p err
Если есть сообщения:
........
open database /etc/aliases.db: No such file or directory
........
$ sudo postalias /etc/aliases
или
$ sudo newaliases
Перезагрузить и проверить.
Отправка почты на наш e-mail:
$ echo "test" | mutt -s "test" nash@e-mail.ru
Отправка почты на наш e-mail с вложением файла:
$ echo "test" | mutt -s "test" nash@e-mail.ru -a file
======================================================
$ sudo apt install sysstat lm-sensors smartmontools
$ sudo nano /root/sysinfo.sh
Вставить:
#!/bin/sh
# Устанавливаем дату
DATA=`date +"%Y-%m-%d_%H-%M"`
#FILE= 'sys_$DATA.txt'
echo $DATA > sysinfo.txt
#echo '12345' > sys_$DATA.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "uptime" >> sysinfo.txt
uptime >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "free -m" >> sysinfo.txt
free -m >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "df -h" >> sysinfo.txt
df -h >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "Размер папки с логами postgresql:" >> sysinfo.txt
echo "du -h -s /var/lib/postgresql/9.6/main/pg_log" >> sysinfo.txt
du -h -s /var/lib/postgresql/9.6/main/pg_log >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "Размер папки с базами postgresql:" >> sysinfo.txt
echo "du -h -s /var/lib/postgresql/9.6/main/base" >> sysinfo.txt
du -h -s /var/lib/postgresql/9.6/main/base >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "Размер папки с логами технологического журнала 1с:" >> sysinfo.txt
echo "du -h -s /home/usr1cv8/log" >> sysinfo.txt
du -h -s /home/usr1cv8/log >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "Размер папки с dumps 1с:" >> sysinfo.txt
#echo "du -h -s /dumps" >> sysinfo.txt
echo "du -h -s /home/usr1cv8/dumps" >> sysinfo.txt
#du -h -s /dumps >> sysinfo.txt
du -h -s /home/usr1cv8/dumps >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "sensors" >> sysinfo.txt
sensors >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "iostat -xz" >> sysinfo.txt
iostat -xz >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "sar -r 1 1" >> sysinfo.txt
sar -r 1 1 >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
#echo "ps aux --sort -%mem | awk '{print $6/1024 " MB\t\t" $11}' | head -n10" >> sysinfo.txt
#ps aux --sort -%mem | awk '{print $6/1024 " MB\t\t" $11}' | head -n10 >> sysinfo.txt
#echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "top -b -n1 -o %MEM | head -n30"
top -b -n1 -o %MEM | head -n30 >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
ps -eo rss,pid,user,command | sort -rn | head -20 | awk '{ hr[1024**2]="GB"; hr[1024]="MB";\
for (x=1024**3; x>=1024; x/=1024) {\
if ($1>=x) { printf ("%-6.2f %s ", $1/x, hr[x]); break }\
} } { printf ("%-6s %-10s ", $2, $3) }\
{ for ( x=4 ; x<=NF ; x++ ) { printf ("%s ",$x) } print ("\n") }\
' >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "cat /proc/meminfo" >> sysinfo.txt
cat /proc/meminfo >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "mpstat -P ALL" >> sysinfo.txt
mpstat -P ALL >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "smartctl -A /dev/sda" >> sysinfo.txt
smartctl -A /dev/sda >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "smartctl -A /dev/sdb" >> sysinfo.txt
smartctl -A /dev/sdb >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "journalctl -b -p err" >> sysinfo.txt
journalctl -b -p err >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "Мониторинг 1С" >> sysinfo.txt
if ! pgrep 'ras'; then /opt/1C/v8.3/x86_64/ras --daemon cluster; fi
_cluster=$(/opt/1C/v8.3/x86_64/rac cluster list | grep 'cluster'| awk -F' ' '{print $3}')
_base=$(/opt/1C/v8.3/x86_64/rac infobase --cluster=$_cluster summary list | grep 'infobase '| awk '{print$3}')
_session=$(/opt/1C/v8.3/x86_64/rac session --cluster=$_cluster list | grep 'session '| awk '{print$3}')
echo 'кластер: ' $_cluster >> sysinfo.txt
echo 'базы: ' $_base >> sysinfo.txt
echo 'сессии: ' $_session >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
/opt/1C/v8.3/x86_64/rac cluster list >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
for cluster in $_cluster
do
/opt/1C/v8.3/x86_64/rac session --cluster=$_cluster list >> sysinfo.txt
done
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
sleep 2
echo "test" | mutt -s $DATA f@vt.com -a sysinfo.txt
Сохранить.
$ sudo sh /root/sysinfo.sh
$ sudo -i
# crontab -e
Добавить в конец (сработает в 2:01):
# каждые 5 минут
Смотреть задания:
# crontab -l
2018-09-07_14-27
---------------------------------------------------------------------------------------
uptime
19:30:01 up 4:00, 2 users, load average: 0,08, 0,07, 0,13
---------------------------------------------------------------------------------------
free -m
total used free shared buff/cache available
Память: 32061 1335 5319 3188 25406 26982
Подкачка: 1023 0 1023
---------------------------------------------------------------------------------------
df -h
Файл.система Размер Использовано Дост Использовано% Cмонтировано в
udev 16G 0 16G 0% /dev
tmpfs 3,2G 5,0M 3,2G 1% /run
/dev/sda1 230G 25G 193G 12% /
tmpfs 16G 20K 16G 1% /dev/shm
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
tmpfs 3,2G 0 3,2G 0% /run/user/1000
tmpfs 3,2G 0 3,2G 0% /run/user/999
---------------------------------------------------------------------------------------
Размер папки с логами postgresql:
du -h -s /var/lib/postgresql/9.6/main/pg_log
6,3M /var/lib/postgresql/9.6/main/pg_log
---------------------------------------------------------------------------------------
Размер папки с базами postgresql:
du -h -s /var/lib/postgresql/9.6/main/base
4,7G /var/lib/postgresql/9.6/main/base
---------------------------------------------------------------------------------------
Размер папки с логами технологического журнала 1с:
du -h -s /home/usr1cv8/log
18M /home/usr1cv8/log
---------------------------------------------------------------------------------------
Размер папки с dumps 1с:
du -h -s /home/usr1cv8/dumps
4,0K /home/usr1cv8/dumps
---------------------------------------------------------------------------------------
sensors
acpitz-virtual-0
Adapter: Virtual device
temp1: +27.8°C (crit = +119.0°C)
temp2: +29.8°C (crit = +119.0°C)
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +41.0°C (high = +84.0°C, crit = +100.0°C)
Core 0: +34.0°C (high = +84.0°C, crit = +100.0°C)
Core 1: +35.0°C (high = +84.0°C, crit = +100.0°C)
Core 2: +35.0°C (high = +84.0°C, crit = +100.0°C)
Core 3: +40.0°C (high = +84.0°C, crit = +100.0°C)
---------------------------------------------------------------------------------------
iostat -xz
Linux 4.15.0-43-generic (Soc-1c-test-239k) 16.03.2019 _x86_64_ (8 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
3,06 0,00 1,06 1,06 0,00 94,82
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
loop0 0,00 0,00 0,00 0,00 0,00 0,00 5,00 0,00 0,00 0,00 0,00 0,00 0,00
sda 0,18 99,01 2,22 50,58 103,03 4283,31 166,16 0,38 7,12 2,71 7,31 1,95 10,29
sdb 0,00 0,00 0,01 0,00 0,37 0,00 70,37 0,00 3,24 3,24 0,00 3,08 0,00
---------------------------------------------------------------------------------------
sar -r 1 1
Linux 4.15.0-43-generic (Soc-1c-test-239k) 16.03.2019 _x86_64_ (8 CPU)
19:30:01 kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty
19:30:02 5447224 27383972 83,41 245056 24758284 5084600 15,01 8955460 17291980 288
Среднее: 5447224 27383972 83,41 245056 24758284 5084600 15,01 8955460 17291980 288
---------------------------------------------------------------------------------------
top - 19:30:03 up 4:00, 2 users, load average: 0,08, 0,07, 0,13
Tasks: 201 total, 1 running, 133 sleeping, 0 stopped, 0 zombie
%Cpu(s): 3,1 us, 1,0 sy, 0,0 ni, 94,8 id, 1,1 wa, 0,0 hi, 0,1 si, 0,0 st
КиБ Mem : 32831196 total, 5447180 free, 1367556 used, 26016460 buff/cache
КиБ Swap: 1048572 total, 1048572 free, 0 used. 27629508 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1167 postgres 20 0 4605936 2,534g 2,524g S 0,0 8,1 0:03.99 postgres
28878 usr1cv8 20 0 3418780 1,242g 201272 S 0,0 4,0 16:52.78 rphost
24032 postgres 20 0 4620336 226328 214212 S 0,0 0,7 0:01.56 postgres
1145 postgres 20 0 4597816 181968 180208 S 0,0 0,6 0:01.64 postgres
24251 postgres 20 0 4612528 148572 141832 S 0,0 0,5 0:01.11 postgres
28827 usr1cv8 20 0 2266080 114576 81856 S 0,0 0,3 0:42.20 rmngr
24887 postgres 20 0 4612740 97920 91340 S 0,0 0,3 0:00.27 postgres
24045 postgres 20 0 4606960 94136 90732 S 0,0 0,3 0:00.08 postgres
467 root 20 0 141312 77892 77552 S 0,0 0,2 0:00.85 systemd-jo+
1168 postgres 20 0 4598172 46044 44260 S 0,0 0,1 0:02.79 postgres
28240 usr1cv8 20 0 1276516 34280 25556 S 0,0 0,1 0:00.06 ras
28819 usr1cv8 20 0 1280676 31712 24348 S 0,0 0,1 0:12.57 ragent
866 root 20 0 398532 24320 15760 S 0,0 0,1 0:00.21 snapd
1169 postgres 20 0 4597816 21240 19468 S 0,0 0,1 0:08.17 postgres
1264 root 20 0 339132 15996 13440 S 0,0 0,0 0:00.02 smbd
1171 postgres 20 0 173936 10144 2528 S 0,0 0,0 0:07.41 postgres
29318 root 20 0 63456 8224 6876 S 0,0 0,0 0:00.02 mc
1170 postgres 20 0 4599068 7200 5056 S 0,0 0,0 0:00.91 postgres
11675 root 20 0 92836 6916 5988 S 0,0 0,0 0:00.01 sshd
2215 root 20 0 92836 6876 5948 S 0,0 0,0 0:00.01 sshd
12316 root 20 0 92836 6868 5940 S 0,0 0,0 0:00.00 sshd
12258 root 20 0 92832 6752 5824 S 0,0 0,0 0:00.01 sshd
2130 root 20 0 92832 6668 5736 S 0,0 0,0 0:00.02 sshd
---------------------------------------------------------------------------------------
2.53 GB 1167 postgres postgres: checkpointer process
1.24 GB 28878 usr1cv8 /opt/1C/v8.3/x86_64/rphost -range 1560:1591 -reghost Soc-1c-test-239k -regport 1541 -pid 7e66af34-47eb-11e9-1680-309c23451546
221.02 MB 24032 postgres postgres: postgres zik 127.0.0.1(59984) idle
177.70 MB 1145 postgres /usr/lib/postgresql/9.6/bin/postgres -D /var/lib/postgresql/9.6/main -c config_file=/etc/postgresql/9.6/main/postgresql.conf
145.09 MB 24251 postgres postgres: postgres demo 127.0.0.1(60022) idle
111.89 MB 28827 usr1cv8 /opt/1C/v8.3/x86_64/rmngr -port 1541 -host Soc-1c-test-239k -range 1560:1591 -clstid 7e15e068-47eb-11e9-1680-309c23451546
95.62 MB 24887 postgres postgres: postgres demo 127.0.0.1(60058) idle
91.93 MB 24045 postgres postgres: postgres zik 127.0.0.1(59986) idle
76.07 MB 467 root /lib/systemd/systemd-journald
44.96 MB 1168 postgres postgres: writer process
33.48 MB 28240 usr1cv8 /opt/1C/v8.3/x86_64/ras --daemon cluster
30.97 MB 28819 usr1cv8 /opt/1C/v8.3/x86_64/ragent -daemon
23.75 MB 866 root /usr/lib/snapd/snapd
20.74 MB 1169 postgres postgres: wal writer process
15.62 MB 1264 root /usr/sbin/smbd -D
9.91 MB 1171 postgres postgres: stats collector process
8.03 MB 29318 root mc
7.03 MB 1170 postgres postgres: autovacuum launcher process
6.75 MB 11675 root sshd: user [priv]
6.71 MB 2215 root sshd: user [priv]
---------------------------------------------------------------------------------------
cat /proc/meminfo
MemTotal: 32831196 kB
MemFree: 5447188 kB
MemAvailable: 27629516 kB
Buffers: 245056 kB
Cached: 24758284 kB
SwapCached: 0 kB
Active: 8955664 kB
Inactive: 17291980 kB
Active(anon): 4438580 kB
Inactive(anon): 73664 kB
Active(file): 4517084 kB
Inactive(file): 17218316 kB
Unevictable: 3652 kB
Mlocked: 3652 kB
SwapTotal: 1048572 kB
SwapFree: 1048572 kB
Dirty: 288 kB
Writeback: 0 kB
AnonPages: 1247780 kB
Mapped: 3135380 kB
Shmem: 3265520 kB
Slab: 1013120 kB
SReclaimable: 916176 kB
SUnreclaim: 96944 kB
KernelStack: 5900 kB
PageTables: 26356 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 17464168 kB
Committed_AS: 5087108 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 136576 kB
DirectMap2M: 10240000 kB
DirectMap1G: 23068672 kB
---------------------------------------------------------------------------------------
mpstat -P ALL
Linux 4.15.0-43-generic (Soc-1c-test-239k) 16.03.2019 _x86_64_ (8 CPU)
19:30:03 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
19:30:03 all 3,06 0,00 0,96 1,06 0,00 0,09 0,00 0,00 0,00 94,82
19:30:03 0 2,23 0,00 0,65 0,08 0,00 0,20 0,00 0,00 0,00 96,84
19:30:03 1 2,59 0,00 1,19 0,01 0,00 0,07 0,00 0,00 0,00 96,13
19:30:03 2 2,63 0,00 0,64 0,02 0,00 0,06 0,00 0,00 0,00 96,65
19:30:03 3 3,07 0,00 0,28 0,02 0,00 0,05 0,00 0,00 0,00 96,58
19:30:03 4 2,84 0,00 0,23 0,03 0,00 0,05 0,00 0,00 0,00 96,86
19:30:03 5 4,34 0,00 0,39 5,83 0,00 0,09 0,00 0,00 0,00 89,35
19:30:03 6 4,27 0,00 0,61 2,25 0,00 0,04 0,00 0,00 0,00 92,84
19:30:03 7 2,52 0,00 3,79 0,24 0,00 0,20 0,00 0,00 0,00 93,24
---------------------------------------------------------------------------------------
smartctl -A /dev/sda
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.15.0-43-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail Always - 0
9 Power_On_Hours 0x0032 099 099 000 Old_age Always - 3305
12 Power_Cycle_Count 0x0032 099 099 000 Old_age Always - 340
177 Wear_Leveling_Count 0x0013 096 096 000 Pre-fail Always - 70
179 Used_Rsvd_Blk_Cnt_Tot 0x0013 100 100 010 Pre-fail Always - 0
181 Program_Fail_Cnt_Total 0x0032 100 100 010 Old_age Always - 0
182 Erase_Fail_Count_Total 0x0032 100 100 010 Old_age Always - 0
183 Runtime_Bad_Block 0x0013 100 100 010 Pre-fail Always - 0
187 Uncorrectable_Error_Cnt 0x0032 100 100 000 Old_age Always - 0
190 Airflow_Temperature_Cel 0x0032 067 054 000 Old_age Always - 33
195 ECC_Error_Rate 0x001a 200 200 000 Old_age Always - 0
199 CRC_Error_Count 0x003e 100 100 000 Old_age Always - 0
235 POR_Recovery_Count 0x0012 099 099 000 Old_age Always - 29
241 Total_LBAs_Written 0x0032 099 099 000 Old_age Always - 16267254787
---------------------------------------------------------------------------------------
smartctl -A /dev/sdb
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.15.0-43-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000b 100 100 016 Pre-fail Always - 0
2 Throughput_Performance 0x0005 140 140 054 Pre-fail Offline - 68
3 Spin_Up_Time 0x0007 137 137 024 Pre-fail Always - 418 (Average 420)
4 Start_Stop_Count 0x0012 100 100 000 Old_age Always - 254
5 Reallocated_Sector_Ct 0x0033 100 100 005 Pre-fail Always - 0
7 Seek_Error_Rate 0x000b 100 100 067 Pre-fail Always - 0
8 Seek_Time_Performance 0x0005 124 124 020 Pre-fail Offline - 33
9 Power_On_Hours 0x0012 100 100 000 Old_age Always - 3118
10 Spin_Retry_Count 0x0013 100 100 060 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 254
192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 308
193 Load_Cycle_Count 0x0012 100 100 000 Old_age Always - 308
194 Temperature_Celsius 0x0002 150 150 000 Old_age Always - 40 (Min/Max 17/48)
196 Reallocated_Event_Count 0x0032 100 100 000 Old_age Always - 0
197 Current_Pending_Sector 0x0022 100 100 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0008 100 100 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x000a 200 200 000 Old_age Always - 0
---------------------------------------------------------------------------------------
journalctl -b -p err
-- Logs begin at Сб 2019-01-26 16:26:19 MSK, end at Сб 2019-03-16 19:30:01 MSK. --
мар 16 15:30:17 Soc-1c-test-239k iscsid[1427]: iSCSI daemon with pid=1430 started!
---------------------------------------------------------------------------------------
Мониторинг 1С
кластер: 7e15e068-47eb-11e9-1680-309c23451546
базы: 97182896-47eb-11e9-3688-309c23451546 1521b932-47ec-11e9-3688-309c23451546
сессии: 193ab89c-4806-11e9-329a-309c23451546 b4d9e13e-4805-11e9-329a-309c23451546 cb58f13e-4805-11e9-329a-309c23451546
---------------------------------------------------------------------------------------
Пошаговая инструкция установки Postfix и Dovecot на Ubuntu
journalctl: open database /etc/aliases.db: No such file or directory
user@yandex.ru - e-mail с которого будем посылать письма на произвольные адреса
$ sudo apt update
$ sudo apt upgrade
(postfix без настройки)
$ sudo apt install postfix mutt
$ sudo mkdir /etc/postfix/private
#$ sudo cp /etc/postfix/main.cf /etc/postfix/main.cf.bak
$ sudo nano /etc/postfix/main.cf
Заменить содержимое файла на:
relayhost =
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/private/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_type = cyrus
smtp_sasl_mechanism_filter = login
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/private/sender_relay
sender_canonical_maps = hash:/etc/postfix/private/canonical
Сохранить.
Создать файл /etc/postfix/private/canonical :
$ sudo nano /etc/postfix/private/canonical
Содержимое (Ваш: user@yandex.ru где user ваш логин) :
@yandex.ru user@yandex.ru
Сохранить.
Создать файл /etc/postfix/private/sender_relay :
sudo nano /etc/postfix/private/sender_relay
Содержимое:
@yandex.ru smtp.yandex.ru
Сохранить.
Создать файл /etc/postfix/private/sasl_passwd:
где вместо *** укажите свой пароль:
$ sudo nano /etc/postfix/private/sasl_passwd
Содержимое (Ваш: user@yandex.ru где user ваш логин, password - ваш пароль ) :
[smtp.yandex.ru] user@yandex.ru:password
Сохранить.
$ sudo postmap /etc/postfix/private/*
$ sudo systemctl restart postfix.service
#$ sudo systemctl status postfix.service
$ sudo reboot
посмотреть:
$ sudo journalctl -b
$ sudo journalctl -b -p err
Если есть сообщения:
........
open database /etc/aliases.db: No such file or directory
........
$ sudo postalias /etc/aliases
или
$ sudo newaliases
Перезагрузить и проверить.
Отправка почты на наш e-mail:
$ echo "test" | mutt -s "test" nash@e-mail.ru
Отправка почты на наш e-mail с вложением файла:
$ echo "test" | mutt -s "test" nash@e-mail.ru -a file
======================================================
$ sudo apt install sysstat lm-sensors smartmontools
$ sudo nano /root/sysinfo.sh
Вставить:
#!/bin/sh
# Устанавливаем дату
DATA=`date +"%Y-%m-%d_%H-%M"`
#FILE= 'sys_$DATA.txt'
echo $DATA > sysinfo.txt
#echo '12345' > sys_$DATA.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "uptime" >> sysinfo.txt
uptime >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "free -m" >> sysinfo.txt
free -m >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "df -h" >> sysinfo.txt
df -h >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "Размер папки с логами postgresql:" >> sysinfo.txt
echo "du -h -s /var/lib/postgresql/9.6/main/pg_log" >> sysinfo.txt
du -h -s /var/lib/postgresql/9.6/main/pg_log >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "Размер папки с базами postgresql:" >> sysinfo.txt
echo "du -h -s /var/lib/postgresql/9.6/main/base" >> sysinfo.txt
du -h -s /var/lib/postgresql/9.6/main/base >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "Размер папки с логами технологического журнала 1с:" >> sysinfo.txt
echo "du -h -s /home/usr1cv8/log" >> sysinfo.txt
du -h -s /home/usr1cv8/log >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "Размер папки с dumps 1с:" >> sysinfo.txt
#echo "du -h -s /dumps" >> sysinfo.txt
echo "du -h -s /home/usr1cv8/dumps" >> sysinfo.txt
#du -h -s /dumps >> sysinfo.txt
du -h -s /home/usr1cv8/dumps >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "sensors" >> sysinfo.txt
sensors >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "iostat -xz" >> sysinfo.txt
iostat -xz >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "sar -r 1 1" >> sysinfo.txt
sar -r 1 1 >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
#echo "ps aux --sort -%mem | awk '{print $6/1024 " MB\t\t" $11}' | head -n10" >> sysinfo.txt
#ps aux --sort -%mem | awk '{print $6/1024 " MB\t\t" $11}' | head -n10 >> sysinfo.txt
#echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "top -b -n1 -o %MEM | head -n30"
top -b -n1 -o %MEM | head -n30 >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
ps -eo rss,pid,user,command | sort -rn | head -20 | awk '{ hr[1024**2]="GB"; hr[1024]="MB";\
for (x=1024**3; x>=1024; x/=1024) {\
if ($1>=x) { printf ("%-6.2f %s ", $1/x, hr[x]); break }\
} } { printf ("%-6s %-10s ", $2, $3) }\
{ for ( x=4 ; x<=NF ; x++ ) { printf ("%s ",$x) } print ("\n") }\
' >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "cat /proc/meminfo" >> sysinfo.txt
cat /proc/meminfo >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "mpstat -P ALL" >> sysinfo.txt
mpstat -P ALL >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "smartctl -A /dev/sda" >> sysinfo.txt
smartctl -A /dev/sda >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "smartctl -A /dev/sdb" >> sysinfo.txt
smartctl -A /dev/sdb >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "journalctl -b -p err" >> sysinfo.txt
journalctl -b -p err >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
echo "Мониторинг 1С" >> sysinfo.txt
if ! pgrep 'ras'; then /opt/1C/v8.3/x86_64/ras --daemon cluster; fi
_cluster=$(/opt/1C/v8.3/x86_64/rac cluster list | grep 'cluster'| awk -F' ' '{print $3}')
_base=$(/opt/1C/v8.3/x86_64/rac infobase --cluster=$_cluster summary list | grep 'infobase '| awk '{print$3}')
_session=$(/opt/1C/v8.3/x86_64/rac session --cluster=$_cluster list | grep 'session '| awk '{print$3}')
echo 'кластер: ' $_cluster >> sysinfo.txt
echo 'базы: ' $_base >> sysinfo.txt
echo 'сессии: ' $_session >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
/opt/1C/v8.3/x86_64/rac cluster list >> sysinfo.txt
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
for cluster in $_cluster
do
/opt/1C/v8.3/x86_64/rac session --cluster=$_cluster list >> sysinfo.txt
done
echo "---------------------------------------------------------------------------------------" >> sysinfo.txt
sleep 2
echo "test" | mutt -s $DATA f@vt.com -a sysinfo.txt
Сохранить.
$ sudo sh /root/sysinfo.sh
$ sudo -i
# crontab -e
Добавить в конец (сработает в 2:01):
# каждые 5 минут
*/5 * * * * sudo sh /root/sysinfo.sh
Смотреть задания:
# crontab -l
2018-09-07_14-27
---------------------------------------------------------------------------------------
uptime
19:30:01 up 4:00, 2 users, load average: 0,08, 0,07, 0,13
---------------------------------------------------------------------------------------
free -m
total used free shared buff/cache available
Память: 32061 1335 5319 3188 25406 26982
Подкачка: 1023 0 1023
---------------------------------------------------------------------------------------
df -h
Файл.система Размер Использовано Дост Использовано% Cмонтировано в
udev 16G 0 16G 0% /dev
tmpfs 3,2G 5,0M 3,2G 1% /run
/dev/sda1 230G 25G 193G 12% /
tmpfs 16G 20K 16G 1% /dev/shm
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
tmpfs 3,2G 0 3,2G 0% /run/user/1000
tmpfs 3,2G 0 3,2G 0% /run/user/999
---------------------------------------------------------------------------------------
Размер папки с логами postgresql:
du -h -s /var/lib/postgresql/9.6/main/pg_log
6,3M /var/lib/postgresql/9.6/main/pg_log
---------------------------------------------------------------------------------------
Размер папки с базами postgresql:
du -h -s /var/lib/postgresql/9.6/main/base
4,7G /var/lib/postgresql/9.6/main/base
---------------------------------------------------------------------------------------
Размер папки с логами технологического журнала 1с:
du -h -s /home/usr1cv8/log
18M /home/usr1cv8/log
---------------------------------------------------------------------------------------
Размер папки с dumps 1с:
du -h -s /home/usr1cv8/dumps
4,0K /home/usr1cv8/dumps
---------------------------------------------------------------------------------------
sensors
acpitz-virtual-0
Adapter: Virtual device
temp1: +27.8°C (crit = +119.0°C)
temp2: +29.8°C (crit = +119.0°C)
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +41.0°C (high = +84.0°C, crit = +100.0°C)
Core 0: +34.0°C (high = +84.0°C, crit = +100.0°C)
Core 1: +35.0°C (high = +84.0°C, crit = +100.0°C)
Core 2: +35.0°C (high = +84.0°C, crit = +100.0°C)
Core 3: +40.0°C (high = +84.0°C, crit = +100.0°C)
---------------------------------------------------------------------------------------
iostat -xz
Linux 4.15.0-43-generic (Soc-1c-test-239k) 16.03.2019 _x86_64_ (8 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
3,06 0,00 1,06 1,06 0,00 94,82
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
loop0 0,00 0,00 0,00 0,00 0,00 0,00 5,00 0,00 0,00 0,00 0,00 0,00 0,00
sda 0,18 99,01 2,22 50,58 103,03 4283,31 166,16 0,38 7,12 2,71 7,31 1,95 10,29
sdb 0,00 0,00 0,01 0,00 0,37 0,00 70,37 0,00 3,24 3,24 0,00 3,08 0,00
---------------------------------------------------------------------------------------
sar -r 1 1
Linux 4.15.0-43-generic (Soc-1c-test-239k) 16.03.2019 _x86_64_ (8 CPU)
19:30:01 kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty
19:30:02 5447224 27383972 83,41 245056 24758284 5084600 15,01 8955460 17291980 288
Среднее: 5447224 27383972 83,41 245056 24758284 5084600 15,01 8955460 17291980 288
---------------------------------------------------------------------------------------
top - 19:30:03 up 4:00, 2 users, load average: 0,08, 0,07, 0,13
Tasks: 201 total, 1 running, 133 sleeping, 0 stopped, 0 zombie
%Cpu(s): 3,1 us, 1,0 sy, 0,0 ni, 94,8 id, 1,1 wa, 0,0 hi, 0,1 si, 0,0 st
КиБ Mem : 32831196 total, 5447180 free, 1367556 used, 26016460 buff/cache
КиБ Swap: 1048572 total, 1048572 free, 0 used. 27629508 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1167 postgres 20 0 4605936 2,534g 2,524g S 0,0 8,1 0:03.99 postgres
28878 usr1cv8 20 0 3418780 1,242g 201272 S 0,0 4,0 16:52.78 rphost
24032 postgres 20 0 4620336 226328 214212 S 0,0 0,7 0:01.56 postgres
1145 postgres 20 0 4597816 181968 180208 S 0,0 0,6 0:01.64 postgres
24251 postgres 20 0 4612528 148572 141832 S 0,0 0,5 0:01.11 postgres
28827 usr1cv8 20 0 2266080 114576 81856 S 0,0 0,3 0:42.20 rmngr
24887 postgres 20 0 4612740 97920 91340 S 0,0 0,3 0:00.27 postgres
24045 postgres 20 0 4606960 94136 90732 S 0,0 0,3 0:00.08 postgres
467 root 20 0 141312 77892 77552 S 0,0 0,2 0:00.85 systemd-jo+
1168 postgres 20 0 4598172 46044 44260 S 0,0 0,1 0:02.79 postgres
28240 usr1cv8 20 0 1276516 34280 25556 S 0,0 0,1 0:00.06 ras
28819 usr1cv8 20 0 1280676 31712 24348 S 0,0 0,1 0:12.57 ragent
866 root 20 0 398532 24320 15760 S 0,0 0,1 0:00.21 snapd
1169 postgres 20 0 4597816 21240 19468 S 0,0 0,1 0:08.17 postgres
1264 root 20 0 339132 15996 13440 S 0,0 0,0 0:00.02 smbd
1171 postgres 20 0 173936 10144 2528 S 0,0 0,0 0:07.41 postgres
29318 root 20 0 63456 8224 6876 S 0,0 0,0 0:00.02 mc
1170 postgres 20 0 4599068 7200 5056 S 0,0 0,0 0:00.91 postgres
11675 root 20 0 92836 6916 5988 S 0,0 0,0 0:00.01 sshd
2215 root 20 0 92836 6876 5948 S 0,0 0,0 0:00.01 sshd
12316 root 20 0 92836 6868 5940 S 0,0 0,0 0:00.00 sshd
12258 root 20 0 92832 6752 5824 S 0,0 0,0 0:00.01 sshd
2130 root 20 0 92832 6668 5736 S 0,0 0,0 0:00.02 sshd
---------------------------------------------------------------------------------------
2.53 GB 1167 postgres postgres: checkpointer process
1.24 GB 28878 usr1cv8 /opt/1C/v8.3/x86_64/rphost -range 1560:1591 -reghost Soc-1c-test-239k -regport 1541 -pid 7e66af34-47eb-11e9-1680-309c23451546
221.02 MB 24032 postgres postgres: postgres zik 127.0.0.1(59984) idle
177.70 MB 1145 postgres /usr/lib/postgresql/9.6/bin/postgres -D /var/lib/postgresql/9.6/main -c config_file=/etc/postgresql/9.6/main/postgresql.conf
145.09 MB 24251 postgres postgres: postgres demo 127.0.0.1(60022) idle
111.89 MB 28827 usr1cv8 /opt/1C/v8.3/x86_64/rmngr -port 1541 -host Soc-1c-test-239k -range 1560:1591 -clstid 7e15e068-47eb-11e9-1680-309c23451546
95.62 MB 24887 postgres postgres: postgres demo 127.0.0.1(60058) idle
91.93 MB 24045 postgres postgres: postgres zik 127.0.0.1(59986) idle
76.07 MB 467 root /lib/systemd/systemd-journald
44.96 MB 1168 postgres postgres: writer process
33.48 MB 28240 usr1cv8 /opt/1C/v8.3/x86_64/ras --daemon cluster
30.97 MB 28819 usr1cv8 /opt/1C/v8.3/x86_64/ragent -daemon
23.75 MB 866 root /usr/lib/snapd/snapd
20.74 MB 1169 postgres postgres: wal writer process
15.62 MB 1264 root /usr/sbin/smbd -D
9.91 MB 1171 postgres postgres: stats collector process
8.03 MB 29318 root mc
7.03 MB 1170 postgres postgres: autovacuum launcher process
6.75 MB 11675 root sshd: user [priv]
6.71 MB 2215 root sshd: user [priv]
---------------------------------------------------------------------------------------
cat /proc/meminfo
MemTotal: 32831196 kB
MemFree: 5447188 kB
MemAvailable: 27629516 kB
Buffers: 245056 kB
Cached: 24758284 kB
SwapCached: 0 kB
Active: 8955664 kB
Inactive: 17291980 kB
Active(anon): 4438580 kB
Inactive(anon): 73664 kB
Active(file): 4517084 kB
Inactive(file): 17218316 kB
Unevictable: 3652 kB
Mlocked: 3652 kB
SwapTotal: 1048572 kB
SwapFree: 1048572 kB
Dirty: 288 kB
Writeback: 0 kB
AnonPages: 1247780 kB
Mapped: 3135380 kB
Shmem: 3265520 kB
Slab: 1013120 kB
SReclaimable: 916176 kB
SUnreclaim: 96944 kB
KernelStack: 5900 kB
PageTables: 26356 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 17464168 kB
Committed_AS: 5087108 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 136576 kB
DirectMap2M: 10240000 kB
DirectMap1G: 23068672 kB
---------------------------------------------------------------------------------------
mpstat -P ALL
Linux 4.15.0-43-generic (Soc-1c-test-239k) 16.03.2019 _x86_64_ (8 CPU)
19:30:03 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
19:30:03 all 3,06 0,00 0,96 1,06 0,00 0,09 0,00 0,00 0,00 94,82
19:30:03 0 2,23 0,00 0,65 0,08 0,00 0,20 0,00 0,00 0,00 96,84
19:30:03 1 2,59 0,00 1,19 0,01 0,00 0,07 0,00 0,00 0,00 96,13
19:30:03 2 2,63 0,00 0,64 0,02 0,00 0,06 0,00 0,00 0,00 96,65
19:30:03 3 3,07 0,00 0,28 0,02 0,00 0,05 0,00 0,00 0,00 96,58
19:30:03 4 2,84 0,00 0,23 0,03 0,00 0,05 0,00 0,00 0,00 96,86
19:30:03 5 4,34 0,00 0,39 5,83 0,00 0,09 0,00 0,00 0,00 89,35
19:30:03 6 4,27 0,00 0,61 2,25 0,00 0,04 0,00 0,00 0,00 92,84
19:30:03 7 2,52 0,00 3,79 0,24 0,00 0,20 0,00 0,00 0,00 93,24
---------------------------------------------------------------------------------------
smartctl -A /dev/sda
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.15.0-43-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail Always - 0
9 Power_On_Hours 0x0032 099 099 000 Old_age Always - 3305
12 Power_Cycle_Count 0x0032 099 099 000 Old_age Always - 340
177 Wear_Leveling_Count 0x0013 096 096 000 Pre-fail Always - 70
179 Used_Rsvd_Blk_Cnt_Tot 0x0013 100 100 010 Pre-fail Always - 0
181 Program_Fail_Cnt_Total 0x0032 100 100 010 Old_age Always - 0
182 Erase_Fail_Count_Total 0x0032 100 100 010 Old_age Always - 0
183 Runtime_Bad_Block 0x0013 100 100 010 Pre-fail Always - 0
187 Uncorrectable_Error_Cnt 0x0032 100 100 000 Old_age Always - 0
190 Airflow_Temperature_Cel 0x0032 067 054 000 Old_age Always - 33
195 ECC_Error_Rate 0x001a 200 200 000 Old_age Always - 0
199 CRC_Error_Count 0x003e 100 100 000 Old_age Always - 0
235 POR_Recovery_Count 0x0012 099 099 000 Old_age Always - 29
241 Total_LBAs_Written 0x0032 099 099 000 Old_age Always - 16267254787
---------------------------------------------------------------------------------------
smartctl -A /dev/sdb
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.15.0-43-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000b 100 100 016 Pre-fail Always - 0
2 Throughput_Performance 0x0005 140 140 054 Pre-fail Offline - 68
3 Spin_Up_Time 0x0007 137 137 024 Pre-fail Always - 418 (Average 420)
4 Start_Stop_Count 0x0012 100 100 000 Old_age Always - 254
5 Reallocated_Sector_Ct 0x0033 100 100 005 Pre-fail Always - 0
7 Seek_Error_Rate 0x000b 100 100 067 Pre-fail Always - 0
8 Seek_Time_Performance 0x0005 124 124 020 Pre-fail Offline - 33
9 Power_On_Hours 0x0012 100 100 000 Old_age Always - 3118
10 Spin_Retry_Count 0x0013 100 100 060 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 254
192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 308
193 Load_Cycle_Count 0x0012 100 100 000 Old_age Always - 308
194 Temperature_Celsius 0x0002 150 150 000 Old_age Always - 40 (Min/Max 17/48)
196 Reallocated_Event_Count 0x0032 100 100 000 Old_age Always - 0
197 Current_Pending_Sector 0x0022 100 100 000 Old_age Always - 0
198 Offline_Uncorrectable 0x0008 100 100 000 Old_age Offline - 0
199 UDMA_CRC_Error_Count 0x000a 200 200 000 Old_age Always - 0
---------------------------------------------------------------------------------------
journalctl -b -p err
-- Logs begin at Сб 2019-01-26 16:26:19 MSK, end at Сб 2019-03-16 19:30:01 MSK. --
мар 16 15:30:17 Soc-1c-test-239k iscsid[1427]: iSCSI daemon with pid=1430 started!
---------------------------------------------------------------------------------------
Мониторинг 1С
кластер: 7e15e068-47eb-11e9-1680-309c23451546
базы: 97182896-47eb-11e9-3688-309c23451546 1521b932-47ec-11e9-3688-309c23451546
сессии: 193ab89c-4806-11e9-329a-309c23451546 b4d9e13e-4805-11e9-329a-309c23451546 cb58f13e-4805-11e9-329a-309c23451546
---------------------------------------------------------------------------------------
Комментариев нет:
Отправить комментарий