UserParameter=pgsql.archive_command.count_files_to_archive[*],$2 $1 -c "SELECT count(name) AS count_files FROM (SELECT name FROM pg_ls_dir('./pg_xlog/archive_status') name WHERE right( name,6)= '.ready'  ) ready;"
UserParameter=pgsql.archive_command.size_files_to_archive[*],$2 $1 -c "SELECT coalesce(sum((pg_stat_file('./pg_xlog/' ||  rtrim(ready.name,'.ready'))).size),0) AS size_files FROM (SELECT name FROM pg_ls_dir('./pg_xlog/archive_status') name WHERE right( name,6)= '.ready'  ) ready;"
UserParameter=pgsql.archive_command.archived_files[*],$2 $1 -c "SELECT archived_count from pg_stat_archiver;"
UserParameter=pgsql.archive_command.failed_trying_to_archive[*],$2 $1 -c "SELECT failed_count from pg_stat_archiver;"
UserParameter=pgsql.bgwriter.buffers_checkpoint[*],$2 $1 -c "select buffers_checkpoint from pg_catalog.pg_stat_bgwriter;"
UserParameter=pgsql.bgwriter.buffers_clean[*],$2 $1 -c "select buffers_clean from pg_catalog.pg_stat_bgwriter;"
UserParameter=pgsql.bgwriter.maxwritten_clean[*],$2 $1 -c "select maxwritten_clean from pg_catalog.pg_stat_bgwriter;"
UserParameter=pgsql.bgwriter.buffers_backend[*],$2 $1 -c "select buffers_backend from pg_catalog.pg_stat_bgwriter;"
UserParameter=pgsql.bgwriter.buffers_backend_fsync[*],$2 $1 -c "select buffers_backend_fsync from pg_catalog.pg_stat_bgwriter;"
UserParameter=pgsql.bgwriter.buffers_alloc[*],$2 $1 -c "select buffers_alloc from pg_catalog.pg_stat_bgwriter;"
UserParameter=pgsql.checkpoint.count_timed[*],$2 $1 -c "select checkpoints_timed*3600 from pg_catalog.pg_stat_bgwriter; "
UserParameter=pgsql.checkpoint.count_wal[*],$2 $1 -c "select checkpoints_req*3600 from pg_catalog.pg_stat_bgwriter; "
UserParameter=pgsql.checkpoint.write_time[*],$2 $1 -c "select checkpoint_write_time from pg_catalog.pg_stat_bgwriter; "
UserParameter=pgsql.checkpoint.checkpoint_sync_time[*],$2 $1 -c "select checkpoint_sync_time from pg_catalog.pg_stat_bgwriter; "
UserParameter=pgsql.connections.active[*],$2 $1 -c "select count(*) from pg_catalog.pg_stat_activity where state = 'active';"
UserParameter=pgsql.connections.idle[*],$2 $1 -c "select count(*) from pg_catalog.pg_stat_activity where state = 'idle';"
UserParameter=pgsql.connections.idle_in_transaction[*],$2 $1 -c "select count(*) from pg_catalog.pg_stat_activity where state = 'idle_in_transaction';"
UserParameter=pgsql.connections.idle_in_transaction_aborted[*],$2 $1 -c "select count(*) from pg_catalog.pg_stat_activity where state = 'idle_in_transaction_aborted';"
UserParameter=pgsql.connections.fastpath_function_call[*],$2 $1 -c "select count(*) from pg_catalog.pg_stat_activity where state = 'fastpath_function_call';"
UserParameter=pgsql.connections.disabled[*],$2 $1 -c "select count(*) from pg_catalog.pg_stat_activity where state = 'disabled';"
UserParameter=pgsql.connections.total[*],$2 $1 -c "select count(*) from pg_catalog.pg_stat_activity where state is not null ;"
UserParameter=pgsql.connections.waiting[*],$2 $1 -c "select count(*) from pg_catalog.pg_stat_activity where state is not null and  wait_event_type is not null"
UserParameter=pgsql.connections.max_connections[*],$2 $1 -c "select setting::INT from pg_settings where name = 'max_connections' "
UserParameter=pgsql.autovacumm.count[*],$2 $1 -c "select count(*) from pg_catalog.pg_stat_activity where query like '%%autovacuum%%' and state <> 'idle' and pid <> pg_catalog.pg_backend_pid() "
UserParameter=pgsql.database.discovery[*],$2 $1 -c "SELECT json_build_object ('data',json_agg(json_build_object('{#DATABASE}',d.datname))) FROM pg_database d WHERE NOT datistemplate AND datallowconn AND datname!='postgres';"
UserParameter=pgsql.database.size[*],echo "select pg_database_size(datname::text) from pg_catalog.pg_database where datistemplate = false and datname = :'p1';" | $3 $2 -v p1="$1"
UserParameter=pgsql.database.max_age[*],echo "select age(datfrozenxid) from pg_catalog.pg_database where datistemplate = false and datname = :'p1';" | $3 $2 -v p1="$1"
UserParameter=pgsql.database.bloating_tables[*],$3 $2 -d "$1" -c "select count(*) from pg_catalog.pg_stat_all_tables where (n_dead_tup/(n_live_tup+n_dead_tup)::float8) > 0.2 and (n_live_tup+n_dead_tup) > 50;"
UserParameter=system.vfs.discovery,/etc/zabbix/scripts/disk_sizes.sh -j MOUNTPOINT
UserParameter=system.vfs.used[*],df $1 | awk 'NR == 2 {print $$3 * 1024}'
UserParameter=system.vfs.free[*],df $1 | awk 'NR == 2 {print $$4 * 1024}'
UserParameter=system.vfs.percent_free[*],df $1 | awk 'NR == 2 {print 100 - $$5}'
UserParameter=system.disk.discovery,/etc/zabbix/scripts/disk_stats.sh -j BLOCKDEVICE
UserParameter=system.disk.utilization[*],expr `grep -w '$1' /proc/diskstats | awk '{print $$13 / 10}'`
UserParameter=system.disk.read[*],expr `grep -w '$1' /proc/diskstats | awk '{print $$4}'`
UserParameter=system.disk.write[*],expr `grep -w '$1' /proc/diskstats | awk '{print $$8}'`
UserParameter=system.disk.read_b[*],expr `grep -w '$1' /proc/diskstats | awk '{print $$6 * 512}'`
UserParameter=system.disk.write_b[*],expr `grep -w '$1' /proc/diskstats | awk '{print $$10 * 512}'`
UserParameter=system.disk.all_read,/etc/zabbix/scripts/disk_stats_read_op.sh
UserParameter=system.disk.all_write,/etc/zabbix/scripts/disk_stats_write_op.sh
UserParameter=system.disk.all_read_b,/etc/zabbix/scripts/disk_stats_read_b.sh
UserParameter=system.disk.all_write_b,/etc/zabbix/scripts/disk_stats_write_b.sh
UserParameter=mamonsu.plugin.keepalive,echo 0
UserParameter=pgsql.transactions.total[*],$2 $1 -c "select sum(xact_commit) as xact_commit from pg_catalog.pg_stat_database;"
UserParameter=pgsql.blocks.hit[*],$2 $1 -c "select sum(blks_hit) as blks_hit from pg_catalog.pg_stat_database;"
UserParameter=pgsql.blocks.read[*],$2 $1 -c "select sum(blks_read) as blks_read from pg_catalog.pg_stat_database;"
UserParameter=pgsql.events.conflicts[*],$2 $1 -c "select sum(conflicts) as conflicts from pg_catalog.pg_stat_database;"
UserParameter=pgsql.events.deadlocks[*],$2 $1 -c "select sum(deadlocks) as deadlocks from pg_catalog.pg_stat_database;"
UserParameter=pgsql.events.xact_rollback[*],$2 $1 -c "select sum(xact_rollback) as xact_rollback from pg_catalog.pg_stat_database;"
UserParameter=pgsql.temp.bytes[*],$2 $1 -c "select sum(temp_bytes) as temp_bytes from pg_catalog.pg_stat_database;"
UserParameter=pgsql.temp.files[*],$2 $1 -c "select sum(temp_files) as temp_files from pg_catalog.pg_stat_database;"
UserParameter=pgsql.tuples.deleted[*],$2 $1 -c "select sum(tup_deleted) as tup_deleted from pg_catalog.pg_stat_database;"
UserParameter=pgsql.tuples.fetched[*],$2 $1 -c "select sum(tup_fetched) as tup_fetched from pg_catalog.pg_stat_database;"
UserParameter=pgsql.tuples.inserted[*],$2 $1 -c "select sum(tup_inserted) as tup_inserted from pg_catalog.pg_stat_database;"
UserParameter=pgsql.tuples.returned[*],$2 $1 -c "select sum(tup_returned) as tup_returned from pg_catalog.pg_stat_database;"
UserParameter=pgsql.tuples.updated[*],$2 $1 -c "select sum(tup_updated) as tup_updated from pg_catalog.pg_stat_database;"
UserParameter=system.la.1,cat /proc/loadavg | awk '{ print $1 }'
UserParameter=system.memory.apps,MemTotal=$(cat /proc/meminfo | awk '/MemTotal\:/ { print $2 }'); SUM=$(cat /proc/meminfo | awk '/(MemFree|Buffers|(Swap)?Cached|Slab|PageTables)\:/ { SUM += $2 } END {print SUM}'); echo $((($MemTotal-$SUM)*1024))
UserParameter=system.memory.buffers,cat /proc/meminfo | awk '/^Buffers\:/ { print $2*1024 }'
UserParameter=system.memory.swap,expr `grep -Ei 'Swap(Total|Free)' /proc/meminfo | awk '{print $2 * 1024}' | paste -s -d '-' | sed -E 's/-/ - /g'` 
UserParameter=system.memory.cached,cat /proc/meminfo | awk '/^Cached\:/ { print $2*1024 }'
UserParameter=system.memory.unused,cat /proc/meminfo | awk '/^MemFree\:/ { print $2*1024 }'
UserParameter=system.memory.slab,cat /proc/meminfo | awk '/^Slab\:/ { print $2*1024 }'
UserParameter=system.memory.swap_cache,cat /proc/meminfo | awk '/^SwapCached\:/ { print $2*1024 }'
UserParameter=system.memory.page_tables,cat /proc/meminfo | awk '/^PageTables\:/ { print $2*1024 }'
UserParameter=system.memory.vmalloc_used,cat /proc/meminfo | awk '/^VmallocUsed\:/ { print $2*1024 }'
UserParameter=system.memory.committed,cat /proc/meminfo | awk '/^Committed_AS\:/ { print $2*1024 }'
UserParameter=system.memory.mapped,cat /proc/meminfo | awk '/^Mapped\:/ { print $2*1024 }'
UserParameter=system.memory.active,cat /proc/meminfo | awk '/^Active\:/ { print $2*1024 }'
UserParameter=system.memory.inactive,cat /proc/meminfo | awk '/^Inactive\:/ { print $2*1024 }'
UserParameter=system.net.discovery,/etc/zabbix/scripts/net.sh -j NETDEVICE
UserParameter=system.net.rx_bytes[*], expr `grep -Ei '$1' /proc/net/dev | awk '{print $$2}'`
UserParameter=system.net.rx_errs[*], expr `grep -Ei '$1' /proc/net/dev | awk '{print $$4}'`
UserParameter=system.net.rx_drop[*], expr `grep -Ei '$1' /proc/net/dev | awk '{print $$5}'`
UserParameter=system.net.tx_bytes[*], expr `grep -Ei '$1' /proc/net/dev | awk '{print $$10}'`
UserParameter=system.net.tx_errs[*], expr `grep -Ei '$1' /proc/net/dev | awk '{print $$12}'`
UserParameter=system.net.tx_drop[*], expr `grep -Ei '$1' /proc/net/dev | awk '{print $$13}'`
UserParameter=pgsql.oldest.xid_age[*],$2 $1 -c "select greatest(max(age(backend_xmin)), max(age(backend_xid))) from pg_catalog.pg_stat_activity;"
UserParameter=pgsql.oldest.query_time[*],$2 $1 -c "select case when extract(epoch from max(now() - xact_start)) is not null then extract(epoch from max(now() - xact_start)) else 0 end from pg_catalog.pg_stat_activity where pid not in (select pid from pg_stat_replication) AND pid <> pg_backend_pid() AND query not ilike '%%VACUUM%%'; "
UserParameter=system.open_files,cat  /proc/sys/fs/file-nr | awk '{ print $1 }'
UserParameter=pgsql.buffers.size[*],$2 $1 -c "select sum(1) * 8 * 1024 as size from public.pg_buffercache;"
UserParameter=pgsql.buffers.twice_used[*],$2 $1 -c "select sum(case when usagecount > 1 then 1 else 0 end) * 8 * 1024 as twice_used from public.pg_buffercache;"
UserParameter=pgsql.buffers.dirty[*],$2 $1 -c "select sum(case isdirty when true then 1 else 0 end) * 8 * 1024 as dirty from public.pg_buffercache;"
UserParameter=pgsql.ping[*],$2 $1 -c "select 1 as health;"
UserParameter=pgsql.uptime[*],$2 $1 -c "select date_part('epoch', now() - pg_postmaster_start_time());"
UserParameter=pgsql.cache.hit[*],$2 $1 -c "select round(sum(blks_hit)*100/sum(blks_hit+blks_read), 2)from pg_catalog.pg_stat_database;"
UserParameter=pgsql.pg_locks.accessshare[*],$2 $1 -c "select count(*) FROM pg_catalog.pg_locks where lower(mode)='accesssharelock'; "
UserParameter=pgsql.pg_locks.rowshare[*],$2 $1 -c "select count(*) FROM pg_catalog.pg_locks where lower(mode)='rowsharelock'; "
UserParameter=pgsql.pg_locks.rowexclusive[*],$2 $1 -c "select count(*) FROM pg_catalog.pg_locks where lower(mode)='rowexclusivelock'; "
UserParameter=pgsql.pg_locks.shareupdateexclusive[*],$2 $1 -c "select count(*) FROM pg_catalog.pg_locks where lower(mode)='shareupdateexclusivelock'; "
UserParameter=pgsql.pg_locks.share[*],$2 $1 -c "select count(*) FROM pg_catalog.pg_locks where lower(mode)='sharelock'; "
UserParameter=pgsql.pg_locks.sharerowexclusive[*],$2 $1 -c "select count(*) FROM pg_catalog.pg_locks where lower(mode)='sharerowexclusivelock'; "
UserParameter=pgsql.pg_locks.exclusive[*],$2 $1 -c "select count(*) FROM pg_catalog.pg_locks where lower(mode)='exclusivelock'; "
UserParameter=pgsql.pg_locks.accessexclusive[*],$2 $1 -c "select count(*) FROM pg_catalog.pg_locks where lower(mode)='accessexclusivelock'; "
UserParameter=pgsql.stat.read_bytes[*],$2 $1 -c "select sum(shared_blks_read+local_blks_read+temp_blks_read)*8*1024 from public.pg_stat_statements;"
UserParameter=pgsql.stat.write_bytes[*],$2 $1 -c "select sum(shared_blks_written+local_blks_written+temp_blks_written)*8*1024 from public.pg_stat_statements;"
UserParameter=pgsql.stat.dirty_bytes[*],$2 $1 -c "select sum(shared_blks_dirtied+local_blks_dirtied)*8*1024 from public.pg_stat_statements;"
UserParameter=pgsql.stat.read_time[*],$2 $1 -c "select sum(blk_read_time)/float4(100) from public.pg_stat_statements;"
UserParameter=pgsql.stat.write_time[*],$2 $1 -c "select sum(blk_write_time)/float4(100) from public.pg_stat_statements;"
UserParameter=pgsql.stat.other_time[*],$2 $1 -c "select sum(total_time-blk_read_time-blk_write_time)/float4(100) from public.pg_stat_statements;"
UserParameter=system.processes.running,cat /proc/stat | awk '/procs_running/ { print $2 }'
UserParameter=system.processes.blocked,cat /proc/stat | awk '/procs_blocked/ { print $2 }'
UserParameter=system.processes.forkrate,cat /proc/stat | awk '/processes/ { print $2 }'
UserParameter=system.cpu.user,expr `grep -w 'cpu' /proc/stat | awk '{print $2}'`
UserParameter=system.cpu.nice,expr `grep -w 'cpu' /proc/stat | awk '{print $3}'`
UserParameter=system.cpu.system,expr `grep -w 'cpu' /proc/stat | awk '{print $4}'`
UserParameter=system.cpu.idle,expr `grep -w 'cpu' /proc/stat | awk '{print $5}'`
UserParameter=system.cpu.iowait,expr `grep -w 'cpu' /proc/stat | awk '{print $6}'`
UserParameter=system.cpu.irq,expr `grep -w 'cpu' /proc/stat | awk '{print $7}'`
UserParameter=system.cpu.softirq,expr `grep -w 'cpu' /proc/stat | awk '{print $8}'`
UserParameter=system.up_time,cat /proc/uptime | awk '{ print int($1) }'
UserParameter=pgsql.wal.count[*],$2 $1 -c "select count(*) from pg_catalog.pg_ls_dir('pg_xlog')"
UserParameter=pgsql.wal.write[*],$2 $1 -c "select pg_catalog.pg_xlog_location_diff (pg_catalog.pg_current_xlog_location(), '0/00000000');"
UserParameter=pgsql.replication_lag.sec[*],$2 $1 -c "SELECT CASE WHEN extract(epoch from now()-pg_last_xact_replay_timestamp()) IS NULL THEN 0 ELSE extract(epoch from now()-pg_last_xact_replay_timestamp()) END"
