diff --git a/netstat/mdm-netstat-connection-active.xml b/netstat/mdm-netstat-connection-active.xml
new file mode 100644
index 0000000..61e132a
--- /dev/null
+++ b/netstat/mdm-netstat-connection-active.xml
@@ -0,0 +1,168 @@
+
+
+ 3.4
+ 2021-06-14T12:23:50Z
+
+
+ MDM
+
+
+ Templates
+
+
+
+
+ mdm netstat connections active
+ mdm netstat connections active
+
+
+
+ MDM
+
+
+ Templates
+
+
+
+
+ Netstat
+
+
+
+ -
+ Http established cons on 80 and 443 ports
+ 7
+
+
+ netstat-conn[established]
+ 1m
+ 1w
+ 365d
+ 0
+ 3
+
+ conn
+
+
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+
+
+
+
+
+
+ 0
+
+
+ Netstat
+
+
+
+
+
+
+
+
+ -
+ Http time waiting conns on 80 and 443 ports
+ 7
+
+
+ netstat-conn[time_wait]
+ 1m
+ 1w
+ 365d
+ 0
+ 3
+
+ conn
+
+
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+
+
+
+
+
+
+ 0
+
+
+ Netstat
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Netstat: connections on 80 and 443 ports
+ 600
+ 200
+ 0.0000
+ 100.0000
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0.0000
+ 0.0000
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 2
+ AA00AA
+ 1
+ 2
+ 0
+ -
+ mdm netstat connections active
+ netstat-conn[established]
+
+
+
+ 1
+ 0
+ 00DD00
+ 1
+ 2
+ 0
+ -
+ mdm netstat connections active
+ netstat-conn[time_wait]
+
+
+
+
+
+
diff --git a/netstat/netstat_conn.conf b/netstat/netstat_conn.conf
new file mode 100755
index 0000000..c14e77b
--- /dev/null
+++ b/netstat/netstat_conn.conf
@@ -0,0 +1,3 @@
+#netstat connections status
+# $1 METRIC
+UserParameter=netstat-conn[*],/etc/zabbix/scripts/netstat_conn.sh "$1"
diff --git a/netstat/netstat_conn.sh b/netstat/netstat_conn.sh
new file mode 100755
index 0000000..3fb669b
--- /dev/null
+++ b/netstat/netstat_conn.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+#Netstat connections monitoring
+
+METRIC="$1"
+
+if [[ -z "$1" ]]; then
+ echo "Please enter metric"
+ exit 1
+fi
+
+CACHETTL="55" # Время действия кеша в секундах (чуть меньше чем период опроса элементов)
+CACHE="/tmp/netstat-status-`echo netstat| md5sum | cut -d" " -f1`.cache"
+
+if [ -s "$CACHE" ]; then
+ TIMECACHE=`stat -c"%Z" "$CACHE"`
+else
+ TIMECACHE=0
+fi
+
+TIMENOW=`date '+%s'`
+
+if [ "$(($TIMENOW - $TIMECACHE))" -gt "$CACHETTL" ]; then
+ netstat -tan|grep -e ':80\|:443' > $CACHE || exit 1
+fi
+
+case $METRIC in
+ 'established')
+ cat $CACHE | grep "ESTABLISHED" | wc -l
+ ;;
+ 'time_wait')
+ cat $CACHE | grep "TIME_WAIT" | wc -l
+ ;;
+ *)
+ echo "Not selected metric"
+ exit 0
+ ;;
+esac
+
diff --git a/php-fpm/fpm-status.conf b/php-fpm/fpm-status.conf
new file mode 100755
index 0000000..e845379
--- /dev/null
+++ b/php-fpm/fpm-status.conf
@@ -0,0 +1,5 @@
+#php-fpm status
+# $1 METRIC
+# $2 FPM URL
+# $3 FPM PORT
+UserParameter=php-fpm[*],/etc/zabbix/scripts/fpm-status.sh "$1" "$2" "$3"
\ No newline at end of file
diff --git a/php-fpm/fpm-status.sh b/php-fpm/fpm-status.sh
new file mode 100755
index 0000000..e202b3d
--- /dev/null
+++ b/php-fpm/fpm-status.sh
@@ -0,0 +1,80 @@
+#!/bin/bash
+##### OPTIONS VERIFICATION #####
+if [ -z "$1" ]; then
+ exit 1
+fi
+##### PARAMETERS #####
+METRIC="$1"
+POOL_PORT="${3:-9001}"
+STATSURL="${2:-http://localhost/fpm-status?port=$POOL_PORT}"
+CURL="/usr/bin/curl"
+CACHE_TTL="55"
+CACHE_FILE="/tmp/zabbix.fpm-status.`echo $STATSURL | md5sum | cut -d" " -f1`.cache"
+EXEC_TIMEOUT="1"
+NOW_TIME=`date '+%s'`
+##### RUN #####
+if [ -s "${CACHE_FILE}" ]; then
+ CACHE_TIME=`stat -c"%Y" "${CACHE_FILE}"`
+else
+ CACHE_TIME=0
+fi
+DELTA_TIME=$((${NOW_TIME} - ${CACHE_TIME}))
+#
+if [ ${DELTA_TIME} -lt ${EXEC_TIMEOUT} ]; then
+ sleep $((${EXEC_TIMEOUT} - ${DELTA_TIME}))
+elif [ ${DELTA_TIME} -gt ${CACHE_TTL} ]; then
+ echo "" >> "${CACHE_FILE}" # !!!
+ DATACACHE=`${CURL} --insecure -s "${STATSURL}" 2>&1`
+ echo "${DATACACHE}" > "${CACHE_FILE}" # !!!
+ chmod 640 "${CACHE_FILE}"
+fi
+
+#
+case $METRIC in
+ pool)
+ grep "^pool:" $CACHE_FILE | cut -d ':' -f 2 | sed 's|^\s\+||'
+ ;;
+ process_manager)
+ grep "^process manager:" $CACHE_FILE | cut -d ":" -f 2 | sed 's|^\s\+||'
+ ;;
+ start_time)
+ grep "^start time:" $CACHE_FILE | sed 's|^start time:\s\+||'
+ ;;
+ start_since)
+ grep "^start since:" $CACHE_FILE | cut -d ":" -f 2 | sed 's|^\s\+||'
+ ;;
+ accepted_conn)
+ grep "^accepted conn:" $CACHE_FILE | cut -d ":" -f 2 | sed 's|^\s\+||'
+ ;;
+ listen_queue)
+ grep "^listen queue:" $CACHE_FILE | cut -d ":" -f 2 | sed 's|^\s\+||'
+ ;;
+ max_listen_queue)
+ grep "^max listen queue:" $CACHE_FILE | cut -d ":" -f 2 | sed 's|^\s\+||'
+ ;;
+ listen_queue_len)
+ grep "^listen queue len:" $CACHE_FILE | cut -d ":" -f 2 | sed 's|^\s\+||'
+ ;;
+ idle_processes)
+ grep "^idle processes:" $CACHE_FILE | cut -d ":" -f 2 | sed 's|^\s\+||'
+ ;;
+ active_processes)
+ grep "^active processes:" $CACHE_FILE | cut -d ":" -f 2 | sed 's|^\s\+||'
+ ;;
+ total_processes)
+ grep "^total processes:" $CACHE_FILE | cut -d ":" -f 2 | sed 's|^\s\+||'
+ ;;
+ max_active_processes)
+ grep "^max active processes:" $CACHE_FILE | cut -d ":" -f 2 | sed 's|^\s\+||'
+ ;;
+ max_children_reached)
+ grep "^max children reached:" $CACHE_FILE | cut -d ":" -f 2 | sed 's|^\s\+||'
+ ;;
+ *)
+ echo "Unsupported metric $METRIC"
+ exit 1
+ ;;
+esac
+#
+
+exit 0
diff --git a/php-fpm/mdm-php-fpm-active.xml b/php-fpm/mdm-php-fpm-active.xml
new file mode 100644
index 0000000..a32defd
--- /dev/null
+++ b/php-fpm/mdm-php-fpm-active.xml
@@ -0,0 +1,418 @@
+
+
+ 3.4
+ 2021-06-14T12:27:54Z
+
+
+ Templates
+
+
+
+
+ mdm php-fpm active
+ mdm php-fpm active
+
+
+
+ Templates
+
+
+
+
+ php-fpm
+
+
+
+ -
+ php-fpm - ping check
+ 7
+
+
+ fpm[ping,{$POOL_PORT}]
+ 1m
+ 1w
+ 60d
+ 1
+ 3
+
+
+
+
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+
+
+
+
+
+
+ 0
+
+
+ php-fpm
+
+
+
+
+
+
+
+
+ -
+ php-fpm - number of active processes
+ 7
+
+
+ php-fpm[active_processes,{$FPM_URL},{$FPM_PORT}]
+ 1m
+ 1w
+ 60d
+ 0
+ 3
+
+
+
+
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+
+
+
+
+
+
+ 0
+
+
+ php-fpm
+
+
+
+
+
+
+
+
+ -
+ php-fpm - number of idle processes
+ 7
+
+
+ php-fpm[idle_processes,{$FPM_URL},{$FPM_PORT}]
+ 1m
+ 1w
+ 60d
+ 0
+ 3
+
+
+
+
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+
+
+
+
+
+
+ 0
+
+
+ php-fpm
+
+
+
+
+
+
+
+
+ -
+ php-fpm - number of total processes
+ 7
+
+
+ php-fpm[total_processes,{$FPM_URL},{$FPM_PORT}]
+ 1m
+ 1w
+ 60d
+ 0
+ 3
+
+
+
+
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+
+
+
+
+
+
+ 0
+
+
+ php-fpm
+
+
+
+
+
+
+
+
+ -
+ Number of running processes $1
+ 7
+
+
+ proc.num[{$FPM_PROCESS_NAME}]
+ 1m
+ 1w
+ 365d
+ 0
+ 3
+
+
+
+
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+
+
+
+
+
+
+ 0
+
+
+ php-fpm
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {$FPM_PROCESS_IDLE_CR}
+ 2
+
+
+ {$FPM_PROCESS_IDLE_TR}
+ 10
+
+
+ {$FPM_PROCESS_NAME}
+ php-fpm
+
+
+ {$POOL_PORT}
+ 9001
+
+
+
+
+
+
+
+
+ {mdm php-fpm active:fpm[ping,{$POOL_PORT}].last(0)}<>0
+ 0
+
+ php-fpm is not running on {HOSTNAME}
+ 0
+
+
+ 1
+ 4
+
+ 0
+ 0
+
+
+ php-fpm process is not running on {HOSTNAME}
+ {mdm php-fpm active:proc.num[{$FPM_PROCESS_NAME}].last(0)}<1
+
+
+
+
+
+
+ {mdm php-fpm active:php-fpm[idle_processes,{$FPM_URL},{$FPM_PORT}].last(0)}<{$FPM_PROCESS_IDLE_TR}
+ 0
+
+ php-fpm number of idle processes is too low on {HOSTNAME}
+ 0
+
+
+ 0
+ 1
+
+ 0
+ 0
+
+
+
+
+ {mdm php-fpm active:php-fpm[idle_processes,{$FPM_URL},{$FPM_PORT}].nodata(3m)}=1
+ 0
+
+ php-fpm number of idle processes nodata > 180s {HOSTNAME}
+ 0
+
+
+ 0
+ 1
+
+ 0
+ 0
+
+
+
+
+ {mdm php-fpm active:php-fpm[idle_processes,{$FPM_URL},{$FPM_PORT}].last(0)}<{$FPM_PROCESS_IDLE_CR}
+ 0
+
+ php-fpm number of idle process is critical on {HOSTNAME}
+ 0
+
+
+ 0
+ 4
+
+ 0
+ 0
+
+
+
+
+ {mdm php-fpm active:proc.num[{$FPM_PROCESS_NAME}].last(0)}<1
+ 0
+
+ php-fpm process is not running on {HOSTNAME}
+ 0
+
+
+ 0
+ 4
+
+ 0
+ 0
+
+
+
+
+ {mdm php-fpm active:php-fpm[total_processes,{$FPM_URL},{$FPM_PORT}].last()}>{$PHPFPM_MAXPROC}
+ 0
+
+ php-fpm total processes is too high on {HOSTNAME}
+ 0
+
+
+ 0
+ 3
+
+ 0
+ 0
+
+
+
+
+
+
+ php-fpm proccess
+ 600
+ 200
+ 0.0000
+ 100.0000
+ 0
+ 0
+ 0
+ 1
+ 0
+ 0.0000
+ 0.0000
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ 2
+ 009900
+ 0
+ 2
+ 0
+ -
+ mdm php-fpm active
+ php-fpm[total_processes,{$FPM_URL},{$FPM_PORT}]
+
+
+
+ 1
+ 2
+ CC0000
+ 0
+ 2
+ 0
+ -
+ mdm php-fpm active
+ php-fpm[idle_processes,{$FPM_URL},{$FPM_PORT}]
+
+
+
+ 2
+ 5
+ 0000BB
+ 0
+ 2
+ 0
+ -
+ mdm php-fpm active
+ php-fpm[active_processes,{$FPM_URL},{$FPM_PORT}]
+
+
+
+
+
+
diff --git a/test_backup/mdm_test_backup_active.xml b/test_backup/mdm_test_backup_active.xml
new file mode 100644
index 0000000..cf5686f
--- /dev/null
+++ b/test_backup/mdm_test_backup_active.xml
@@ -0,0 +1,306 @@
+
+
+ 3.4
+ 2021-06-14T11:56:47Z
+
+
+ MDM
+
+
+ Templates
+
+
+
+
+ mdm_test_backup_active
+ mdm_test_backup_active
+
+
+
+ MDM
+
+
+ Templates
+
+
+
+
+ backup
+
+
+
+ -
+ test_logfile
+ 7
+
+
+ test_backup[log]
+ 30s
+ 90d
+ 365d
+ 0
+ 3
+
+
+
+
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+
+
+
+
+
+
+ 0
+
+
+ backup
+
+
+
+
+
+
+
+
+ -
+ state
+ 7
+
+
+ test_backup[state]
+ 20s
+ 52w
+ 0
+ 0
+ 4
+
+
+
+
+ 0
+ 0
+
+ 0
+
+
+
+ 0
+
+
+
+
+
+
+ 0
+
+
+ backup
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {mdm_test_backup_active:test_backup[state].nodata(3m)}=1
+ 0
+
+ backup: no data
+ 0
+
+
+ 0
+ 4
+
+ 0
+ 0
+
+
+
+
+ {mdm_test_backup_active:test_backup[state].str(on backup,#1)}=1
+ 0
+
+ backup: on backup
+ 0
+
+
+ 0
+ 1
+
+ 0
+ 0
+
+
+
+
+ {mdm_test_backup_active:test_backup[state].str(on rotation,#1)}=1
+ 0
+
+ backup: on rotation
+ 0
+
+
+ 0
+ 1
+
+ 0
+ 0
+
+
+
+
+ {mdm_test_backup_active:test_backup[state].str(on sending,#1)}=1
+ 0
+
+ backup: on sending
+ 0
+
+
+ 0
+ 1
+
+ 0
+ 0
+
+
+
+
+ {mdm_test_backup_active:test_backup[state].str(starting script,#1)}=1
+ 0
+
+ backup: starting
+ 0
+
+
+ 0
+ 1
+
+ 0
+ 0
+
+
+
+
+ {mdm_test_backup_active:test_backup[state].str(fail,#1)}=1
+ 0
+
+ backup: {ITEM.LASTVALUE1}
+ 0
+
+
+ 0
+ 4
+
+ 0
+ 0
+
+
+
+
+ ({mdm_test_backup_active:test_backup[log].last()}<>1 and {mdm_test_backup_active:test_backup[log].time()}>{$BACKUP_ROTATION_TIME})
+ 0
+
+ Today, after macro-time, script was not running
+ 0
+
+
+ 0
+ 3
+ отсутствует резервная копия после времени, которое заданно в макросе
+Time format:170200 ( 17 - hours, 02 minutes, 00 seconds)
+Macros name: {$BACKUP_ROTATION_TIME}
+ 0
+ 0
+
+
+ backup: on backup
+ {mdm_test_backup_active:test_backup[state].str(on backup,#1)}=1
+
+
+
+ backup: on rotation
+ {mdm_test_backup_active:test_backup[state].str(on rotation,#1)}=1
+
+
+
+ backup: on sending
+ {mdm_test_backup_active:test_backup[state].str(on sending,#1)}=1
+
+
+
+ backup: starting
+ {mdm_test_backup_active:test_backup[state].str(starting script,#1)}=1
+
+
+
+ backup: {ITEM.LASTVALUE1}
+ {mdm_test_backup_active:test_backup[state].str(fail,#1)}=1
+
+
+
+
+
+
+ {mdm_test_backup_active:test_backup[log].last()}<>1
+ 0
+
+ Today script was not running
+ 0
+
+
+ 1
+ 3
+ отсутствует резервная копия
+ 0
+ 0
+
+
+ backup: on backup
+ {mdm_test_backup_active:test_backup[state].str(on backup,#1)}=1
+
+
+
+ backup: on rotation
+ {mdm_test_backup_active:test_backup[state].str(on rotation,#1)}=1
+
+
+
+ backup: on sending
+ {mdm_test_backup_active:test_backup[state].str(on sending,#1)}=1
+
+
+
+ backup: starting
+ {mdm_test_backup_active:test_backup[state].str(starting script,#1)}=1
+
+
+
+ backup: {ITEM.LASTVALUE1}
+ {mdm_test_backup_active:test_backup[state].str(fail,#1)}=1
+
+
+
+
+
+
+