├── .gitignore ├── COPYRIGHT ├── README.md ├── files ├── cgroups │ └── README.md ├── flashcache │ ├── README.md │ ├── flashcache-template.xml │ ├── flashcache.conf │ └── scripts │ │ ├── flashcache.dm.discovery.sh │ │ └── flashcache.vol.discovery.sh ├── glusterfs-client │ ├── README.md │ ├── glusterfs-client-minimal-template.xml │ ├── glusterfs.conf │ └── scripts │ │ └── glusterfs.discovery.sh ├── hwraid-adaptec │ ├── adaptec.conf │ ├── hwraid-adaptec-template.xml │ ├── scripts │ │ ├── adaptec-adp-discovery.sh │ │ ├── adaptec-ld-discovery.sh │ │ ├── adaptec-pd-discovery.sh │ │ └── adaptec-raid-data-processor.sh │ └── zabbix.adaptec ├── hwraid-megacli │ ├── hwraid-megacli-template.xml │ ├── megacli.conf │ ├── scripts │ │ ├── megacli-adp-discovery.sh │ │ ├── megacli-ld-discovery.sh │ │ ├── megacli-pd-discovery.sh │ │ └── megacli-raid-data-processor.sh │ └── zabbix.megacli ├── hwraid-smartarray │ ├── README.md │ ├── hp-raid-smart-array.conf │ ├── hp-smart-array-template.xml │ ├── scripts │ │ ├── hp-raid-ctrl-discovery.sh │ │ ├── hp-raid-data-processor.sh │ │ ├── hp-raid-ld-discovery.sh │ │ └── hp-raid-pd-discovery.sh │ └── zabbix.smartarray ├── iostat │ ├── crontab │ ├── iostat-disk-utilization-template.xml │ ├── iostat.conf │ └── readme.md ├── keepalived │ ├── keepalived.conf │ ├── keepalived_template.xml │ └── scripts │ │ ├── keepalived.addr.availability.sh │ │ └── keepalived.addr.discovery.sh ├── linux │ ├── README.md │ ├── linux-extended-template.xml │ ├── linux-extended.conf │ ├── scripts │ │ ├── check-netif-speed.sh │ │ ├── check-open-descriptors.sh │ │ ├── mem-usage.sh │ │ └── swap.discovery.sh │ ├── zabbix.cron │ └── zabbix.sudo ├── memcached │ ├── README.md │ ├── memcached-extended-template.xml │ └── memcached.conf ├── pgbouncer │ ├── README.md │ ├── pgbouncer-extended-template.xml │ ├── pgbouncer.conf │ └── scripts │ │ ├── pgbouncer.pool.discovery.sh │ │ └── pgbouncer.stat.sh ├── postfix │ ├── README.md │ ├── postfix-minimal-template.xml │ ├── userparameter_postfix.conf │ └── zabbix-postqueue-local.te ├── postgresql │ ├── README.md │ ├── postgresql-extended-template.xml │ └── postgresql.conf ├── redis │ ├── README.md │ ├── redis-extended-template.xml │ ├── redis.conf │ └── scripts │ │ └── redis.discovery.sh ├── skytools │ ├── scripts │ │ ├── skytools.pgqd.queue.discovery.sh │ │ └── skytools.pgqd.sh │ ├── skytools-template.xml │ └── skytools.conf ├── sphinx2 │ ├── sphinx2-template.xml │ └── sphinx2.conf ├── testcookie │ └── testcookie.conf ├── unicorn │ ├── unicorn-extended-template.xml │ └── unicorn.conf ├── yum-security │ ├── README.md │ ├── yum-security-template.xml │ └── yum-updates.sh └── zabbix-server │ ├── README.md │ └── Zabbix-Server-Template.xml ├── gentoo ├── Manifest ├── files │ └── zabbix-agentd-conf.d ├── metadata.xml ├── zabbix-extensions-1-r1.ebuild ├── zabbix-extensions-2.ebuild ├── zabbix-extensions-3.ebuild ├── zabbix-extensions-4.ebuild └── zabbix-extensions-5.ebuild └── icons ├── normal ├── database-postgres.png ├── server-accounting.png ├── server-database-gray.png ├── server-database-green.png ├── server-database-mysql.png ├── server-database-postgres.png ├── server-database-yellow.png ├── server-directory.png ├── server-email.png ├── server-pack.png ├── server-status-disabled.png ├── server-status-maintenance.png ├── server-status-ok.png ├── server-status-problem.png ├── server-web-secure.png └── server-web.png └── small ├── database-postgres.png ├── server-accounting.png ├── server-database-gray.png ├── server-database-green.png ├── server-database-mysql.png ├── server-database-postgres.png ├── server-database-replica-gray.png ├── server-database-yellow.png ├── server-directory.png ├── server-email.png ├── server-pack.png ├── server-status-disabled.png ├── server-status-maintenance.png ├── server-status-ok.png ├── server-status-problem.png ├── server-web-secure.png └── server-web.png /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018, Lesovsky Alexey All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 7 | Neither the name of the Alexey Lesovsky nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 8 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Zabbix Extensions that extends Zabbix monitoring facilities. 2 | 3 | **Unfortunately, most of these scripts aren't supported. If you discover issues with some or want to propose an improvement, please create a Pull-Request.** 4 | 5 | **Stephan Knauss is actively maintaining the _PostgreSQL_ and _iostat_ sub-section. Please file issues if you detect a problem.** 6 | 7 | -- 8 | Features: 9 | 10 | - written in Bash (requires minimal dependencies); 11 | - in some cases may needs utilities for working directly with the applications (redis-cli, hpacucli, psql, etc...). 12 | - extensions tested, but proper work isn't guaranteed (when a mismatch between software version); 13 | 14 | 15 | -- 16 | 17 | Disclaimer. 18 | The information contained in this repository is for general information purposes only. The information is provided by me and other contributors and while we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk. 19 | 20 | In no event will we be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this repository. 21 | 22 | Through this repository you are able to link to other websites or repos which are not under the our control. We have no control over the nature, content and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them. 23 | 24 | Every effort is made to keep the repo up and running smoothly. However, I takes no responsibility for, and will not be liable for, the repository being temporarily unavailable due to technical issues beyond our control. 25 | -------------------------------------------------------------------------------- /files/cgroups/README.md: -------------------------------------------------------------------------------- 1 | cgroups monitoring extension: 2 | http://www.thislinux.org/2012/07/cgroups-memory-controller-monitoring.html 3 | 4 | 1. memory controller: 5 | - tasks and process counts; 6 | - oom_control state; 7 | - failcnt counters; 8 | - memory usage and limits; 9 | - kernel memory usage and limits; 10 | - additional memory and NUMA statistics. 11 | -------------------------------------------------------------------------------- /files/flashcache/README.md: -------------------------------------------------------------------------------- 1 | нужен установленный модуль flashcache 2 | для zabbix нужно разрешение выполнять dmsetup через sudo 3 | статистика собирается из 4 | /proc/flashcache//flashcache_errors 5 | /proc/flashcache//flashcache_stats 6 | dmsetup table 7 | есть авто-обнаружение томов 8 | -------------------------------------------------------------------------------- /files/flashcache/flashcache.conf: -------------------------------------------------------------------------------- 1 | # Flashcache extension. 2 | # Auto-discovery 3 | UserParameter=flashcache.vol.discovery,/usr/libexec/zabbix-extensions/scripts/flashcache.vol.discovery.sh 4 | UserParameter=flashcache.dm.discovery,/usr/libexec/zabbix-extensions/scripts/flashcache.dm.discovery.sh 5 | 6 | # UserParameters 7 | # $1 - volume from /proc/flashcache. Auto-discovery {#VOLNAME} variable. 8 | # $2 - param name from statistics file 9 | UserParameter=flashcache.stat[*],grep -m1 -oE "$2=[0-9]+" /proc/flashcache/$1/flashcache_stats |cut -d= -f2 10 | UserParameter=flashcache.err[*],grep -m1 -oE "$2=[0-9]+" /proc/flashcache/$1/flashcache_errors |cut -d= -f2 11 | 12 | # Next UserParameters works with dmsetup table {#DMNAME}. 13 | # size, used: in Kb 14 | # pused: in % 15 | # $1 - flashcache-device name. Auto-discovery {#DMNAME} variable. 16 | UserParameter=flashcache.size[*],echo $(($(sudo dmsetup table $1 |grep -oE 'total blocks\([0-9]+\)' |grep -oE '[0-9]+') * $(sudo dmsetup table $1 |grep -oE 'data block size\([0-9]+' |grep -oE '[0-9]+'))) 17 | UserParameter=flashcache.used[*],echo $(($(sudo dmsetup table $1 |grep -oE 'cached blocks\([0-9]+\)' |grep -oE '[0-9]+') * $(sudo dmsetup table $1 |grep -oE 'data block size\([0-9]+' |grep -oE '[0-9]+'))) 18 | UserParameter=flashcache.pused[*],sudo dmsetup table $1 |grep -oE 'cache percent\([0-9]+\)' |grep -oE '[0-9]+' 19 | -------------------------------------------------------------------------------- /files/flashcache/scripts/flashcache.dm.discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: Flashcache volumes auto-discovery 4 | 5 | dms=$(for dm in $(sudo dmsetup ls |awk '{print $1}'); do if (sudo dmsetup status $dm |grep flashcache &> /dev/null); then echo $dm; fi; done) 6 | 7 | echo -n '{"data":[' 8 | for dm in $dms; do echo -n "{\"{#DMNAME}\": \"$dm\"},"; done |sed -e 's:\},$:\}:' 9 | echo -n ']}' 10 | -------------------------------------------------------------------------------- /files/flashcache/scripts/flashcache.vol.discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: Flashcache volumes auto-discovery 4 | 5 | if [ ! -d /proc/flashcache ]; then exit 1; fi 6 | 7 | volumes=$(ls -1d /proc/flashcache/*/ 2> /dev/null |cut -d\/ -f4) 8 | 9 | echo -n '{"data":[' 10 | for vol in $volumes; do echo -n "{\"{#VOLNAME}\": \"$vol\"},"; done |sed -e 's:\},$:\}:' 11 | echo -n ']}' 12 | -------------------------------------------------------------------------------- /files/glusterfs-client/README.md: -------------------------------------------------------------------------------- 1 | Glusterfs client monitoring 2 | 3 | - uses /etc/fstab entry for gluster mountpoints auto-discovery 4 | -------------------------------------------------------------------------------- /files/glusterfs-client/glusterfs-client-minimal-template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-05-17T05:03:28Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /files/glusterfs-client/glusterfs.conf: -------------------------------------------------------------------------------- 1 | UserParameter=glusterfs.discovery,/usr/libexec/zabbix-extensions/scripts/glusterfs.discovery.sh 2 | UserParameter=glusterfs.check.endpoint[*],ls $1 &> /dev/null && echo 0 || echo 1 3 | -------------------------------------------------------------------------------- /files/glusterfs-client/scripts/glusterfs.discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: Glusterfs mounts auto-discovery 4 | 5 | mountpoints=$(egrep -e '\sglusterfs\s' /etc/fstab|grep -v ^# |awk '{print $2}') 6 | 7 | echo -n '{"data":[' 8 | for mount in $mountpoints; do echo -n "{\"{#MOUNT}\": \"$mount\"},"; done |sed -e 's:\},$:\}:' 9 | echo -n ']}' 10 | -------------------------------------------------------------------------------- /files/hwraid-adaptec/adaptec.conf: -------------------------------------------------------------------------------- 1 | UserParameter=adaptec.adp.discovery,/usr/libexec/zabbix-extensions/scripts/adaptec-adp-discovery.sh 2 | UserParameter=adaptec.ld.discovery,/usr/libexec/zabbix-extensions/scripts/adaptec-ld-discovery.sh 3 | UserParameter=adaptec.pd.discovery,/usr/libexec/zabbix-extensions/scripts/adaptec-pd-discovery.sh 4 | -------------------------------------------------------------------------------- /files/hwraid-adaptec/scripts/adaptec-adp-discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Alexey Lesovsky 3 | # Description: Adaptec adapters auto-discovery via arcconf. (TESTED WITH V5.20 (B17414)) 4 | 5 | adp_list=$(sudo arcconf getversion |grep -w "^Controller" |cut -d# -f2) 6 | 7 | if [[ $1 = raw ]]; then 8 | for adp in ${adp_list}; do echo $adp; done ; exit 0 9 | fi 10 | 11 | echo -n '{"data":[' 12 | for adp in $adp_list; do echo -n "{\"{#ADP}\": \"$adp\"},"; done |sed -e 's:\},$:\}:' 13 | echo -n ']}' 14 | -------------------------------------------------------------------------------- /files/hwraid-adaptec/scripts/adaptec-ld-discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: Logical drives auto-discovery via arcconf. (TESTED WITH V5.20 (B17414)) 4 | 5 | adp_list=$(sudo arcconf getversion |grep -w "^Controller" |cut -d# -f2) 6 | ld_list=$(for a in $adp_list; do sudo arcconf getconfig $a ld |grep -w "Logical device number" |awk '{print $4}' |while read ld ; do echo $a:$ld; done ; done) 7 | 8 | if [[ $1 = raw ]]; then 9 | for ld in ${ld_list}; do echo $ld; done ; exit 0 10 | fi 11 | 12 | echo -n '{"data":[' 13 | for ld in $ld_list; do echo -n "{\"{#LD}\": \"$ld\"},"; done |sed -e 's:\},$:\}:' 14 | echo -n ']}' 15 | -------------------------------------------------------------------------------- /files/hwraid-adaptec/scripts/adaptec-pd-discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: Physical drive auto-discovery via arcconf. (TESTED ON V5.20 (B17414)) 4 | 5 | adp_list=$(sudo arcconf getversion |grep -w "^Controller" |cut -d# -f2) 6 | pd_list=$(for a in $adp_list; 7 | do 8 | sudo arcconf getconfig 1 pd |grep -B1 -w "Device is a Hard drive" |grep -wE "Device.*[0-9]+" |cut -d# -f2 |awk -v adp=$a '{print adp":"$1}' 9 | done) 10 | 11 | if [[ $1 = raw ]]; then 12 | for pd in ${pd_list}; do echo $pd; done ; exit 0 13 | fi 14 | 15 | echo -n '{"data":[' 16 | for pd in $pd_list; do echo -n "{\"{#PD}\": \"$pd\"},"; done |sed -e 's:\},$:\}:' 17 | echo -n ']}' 18 | -------------------------------------------------------------------------------- /files/hwraid-adaptec/scripts/adaptec-raid-data-processor.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: Gathering available information about Adaptec supported devices. 4 | # Description: Analyze information and send data to zabbix server. 5 | 6 | PATH="/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/bin" 7 | 8 | arcconf=$(which arcconf) 9 | data_tmp="/run/adaptec-raid-data-harvester.tmp" 10 | data_out="/run/adaptec-raid-data-harvester.out" 11 | all_keys='/run/keys' 12 | zbx_servers=$(grep ^Server\= /etc/zabbix/zabbix_agentd.conf |cut -d= -f2|sed 's/,/ /') 13 | zbx_hostname=$(grep ^Hostname\= /etc/zabbix/zabbix_agentd.conf |cut -d= -f2|cut -d, -f1) 14 | zbx_data='/run/zabbix-sender-adaptec-raid-data.in' 15 | adp_list=$(/usr/libexec/zabbix-extensions/scripts/adaptec-adp-discovery.sh raw) 16 | ld_list=$(/usr/libexec/zabbix-extensions/scripts/adaptec-ld-discovery.sh raw) 17 | pd_list=$(/usr/libexec/zabbix-extensions/scripts/adaptec-pd-discovery.sh raw) 18 | 19 | echo -n > $data_tmp 20 | 21 | # берем список контроллеров и берем с каждого информацию. 22 | echo "### adp section begin ###" >> $data_tmp 23 | for adp in $adp_list; 24 | do 25 | echo "### adp begin $adp ###" >> $data_tmp 26 | $arcconf getconfig $adp ad >> $data_tmp 27 | echo "### adp end $adp ###" >> $data_tmp 28 | done 29 | echo "### adp section end ###" >> $data_tmp 30 | 31 | # перебираем все контроллеры и все логические тома на этих контроллерах 32 | echo "### ld section begin ###" >> $data_tmp 33 | for ld in $ld_list; 34 | do 35 | a=$(echo $ld|cut -d: -f1) 36 | l=$(echo $ld|cut -d: -f2) 37 | echo "### ld begin $a $l ###" >> $data_tmp 38 | $arcconf getconfig $a ld $l >> $data_tmp 39 | echo "### ld end $a $l ###" >> $data_tmp 40 | done 41 | echo "### ld section end ###" >> $data_tmp 42 | 43 | # перебираем все контроллеры и все физические диски на этих контроллерах 44 | echo "### pd section begin ###" >> $data_tmp 45 | for pd in $pd_list; 46 | do 47 | a=$(echo $ld|cut -d: -f1) 48 | p=$(echo $pd|cut -d: -f2) 49 | echo "### pd begin $a $p ###" >> $data_tmp 50 | $arcconf getconfig $a pd >> $data_tmp 51 | echo "### pd end $a $p ###" >> $data_tmp 52 | done 53 | echo "### pd section end ###" >> $data_tmp 54 | 55 | mv $data_tmp $data_out 56 | 57 | echo -n > $all_keys 58 | echo -n > $zbx_data 59 | 60 | # формируем список ключей для zabbix 61 | for a in $adp_list; 62 | do 63 | if grep -Fq 'Controller Battery' $data_out 64 | then 65 | echo -n -e "adaptec.adp.status[$a]\nadaptec.adp.name[$a]\nadaptec.adp.temp[$a]\nadaptec.adp.ld_total[$a]\nadaptec.adp.ld_failed[$a]\nadaptec.adp.ld_degraded[$a]\nadaptec.bbu.status[$a]\n"; 66 | else 67 | echo -n -e "adaptec.adp.status[$a]\nadaptec.adp.name[$a]\nadaptec.adp.temp[$a]\nadaptec.adp.ld_total[$a]\nadaptec.adp.ld_failed[$a]\nadaptec.adp.ld_degraded[$a]\n"; 68 | fi 69 | done >> $all_keys 70 | 71 | for l in $ld_list; 72 | do 73 | echo -n -e "adaptec.ld.status[$l]\n"; 74 | done >> $all_keys 75 | 76 | for p in $pd_list; 77 | do 78 | echo -n -e "adaptec.pd.status[$p]\n"; 79 | done >> $all_keys 80 | 81 | cat $all_keys | while read key; do 82 | if [[ "$key" == *adaptec.adp.status* ]]; then 83 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\]) 84 | value=$(sed -n -e "/adp begin $adp/,/adp end $adp/p" $data_out |grep -w "Controller Status" |awk '{print $4}') 85 | echo "$zbx_hostname $key $value" >> $zbx_data 86 | fi 87 | if [[ "$key" == *adaptec.adp.name* ]]; then 88 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\]) 89 | value=$(sed -n -e "/adp begin $adp/,/adp end $adp/p" $data_out |grep -w "Controller Model" |awk -F: '{print $2}') 90 | echo "$zbx_hostname $key $value" >> $zbx_data 91 | fi 92 | if [[ "$key" == *adaptec.adp.temp* ]]; then 93 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\]) 94 | value=$(sed -n -e "/adp begin $adp/,/adp end $adp/p" $data_out |grep -wE "[ ]+Temperature[ ]+" |awk '{print $3}') 95 | echo "$zbx_hostname $key $value" >> $zbx_data 96 | fi 97 | if [[ "$key" == *adaptec.adp.ld_total* ]]; then 98 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\]) 99 | value=$(sed -n -e "/adp begin $adp/,/adp end $adp/p" $data_out |grep -w "Logical devices/Failed/Degraded" |cut -d: -f2 |tr -d ' ' |cut -d/ -f1) 100 | echo "$zbx_hostname $key $value" >> $zbx_data 101 | fi 102 | if [[ "$key" == *adaptec.adp.ld_failed* ]]; then 103 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\]) 104 | value=$(sed -n -e "/adp begin $adp/,/adp end $adp/p" $data_out |grep -w "Logical devices/Failed/Degraded" |cut -d: -f2 |tr -d ' ' |cut -d/ -f2) 105 | echo "$zbx_hostname $key $value" >> $zbx_data 106 | fi 107 | if [[ "$key" == *adaptec.adp.ld_degraded* ]]; then 108 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\]) 109 | value=$(sed -n -e "/adp begin $adp/,/adp end $adp/p" $data_out |grep -w "Logical devices/Failed/Degraded" |cut -d: -f2 |tr -d ' ' |cut -d/ -f3) 110 | echo "$zbx_hostname $key $value" >> $zbx_data 111 | fi 112 | if [[ "$key" == *adaptec.bbu.status* ]]; then 113 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\]) 114 | value=$(sed -n -e "/adp begin $adp/,/adp end $adp/p" $data_out |sed -n -e '/Controller Battery Information/,/Status/p' |grep -w Status |cut -d: -f2 |tr -d ' ') 115 | echo "$zbx_hostname $key $value" >> $zbx_data 116 | fi 117 | if [[ "$key" == *adaptec.ld.status* ]]; then 118 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f1) 119 | ld=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f2) 120 | value=$(sed -n -e "/ld begin $adp $ld/,/ld end $adp $ld/p" $data_out |grep -w "Status of logical device" |cut -d: -f2 |tr -d ' ') 121 | echo "$zbx_hostname $key $value" >> $zbx_data 122 | fi 123 | if [[ "$key" == *adaptec.pd.status* ]]; then 124 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f1) 125 | pd=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f2) 126 | value=$(sed -n -e "/pd begin $adp $pd/,/ld end $adp $pd/p" $data_out |sed -n -e "/Device #$pd/,/Device #/p" |grep -m1 -wE '[ ]+State[ ]+' |cut -d: -f2 |tr -d ' ') 127 | echo "$zbx_hostname $key $value" >> $zbx_data 128 | fi 129 | done 130 | 131 | for zbx_server in $zbx_servers ; do zabbix_sender -z $zbx_server -i $zbx_data > /dev/null 2>&1 ; done 132 | 133 | -------------------------------------------------------------------------------- /files/hwraid-adaptec/zabbix.adaptec: -------------------------------------------------------------------------------- 1 | # Author: Lesovsky A.V. 2 | # Description: Adaptec data gathering, analyzing, and sending. 3 | 0 */1 * * * root /usr/libexec/zabbix-extensions/scripts/adaptec-raid-data-processor.sh 4 | -------------------------------------------------------------------------------- /files/hwraid-megacli/megacli.conf: -------------------------------------------------------------------------------- 1 | # Author: Lesovsky A.V. 2 | # Description: RAID contollers monitoring via MegaCLI (CmdTool) 3 | # 4 | UserParameter=megacli.adp.discovery,/usr/libexec/zabbix-extensions/scripts/megacli-adp-discovery.sh 5 | UserParameter=megacli.ld.discovery,/usr/libexec/zabbix-extensions/scripts/megacli-ld-discovery.sh 6 | UserParameter=megacli.pd.discovery,/usr/libexec/zabbix-extensions/scripts/megacli-pd-discovery.sh 7 | -------------------------------------------------------------------------------- /files/hwraid-megacli/scripts/megacli-adp-discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Adapters auto-discovery via MegaCLI. VERY VERY EXPERIMENTAL (TESTED WITH 8.02.21 Oct 21, 2011) 4 | 5 | adp_list=$(sudo megacli adpallinfo aALL nolog |grep "^Adapter #" |cut -d# -f2) 6 | 7 | if [[ $1 = raw ]]; then 8 | for adp in ${adp_list}; do echo $adp; done ; exit 0 9 | fi 10 | 11 | echo -n '{"data":[' 12 | for adp in $adp_list; do echo -n "{\"{#ADPNUM}\": \"$adp\"},"; done |sed -e 's:\},$:\}:' 13 | echo -n ']}' 14 | -------------------------------------------------------------------------------- /files/hwraid-megacli/scripts/megacli-ld-discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Logical drives auto-discovery via MegaCLI. VERY VERY EXPERIMENTAL (TESTED WITH 8.02.21 Oct 21, 2011) 4 | 5 | adp_list=$(sudo megacli adpallinfo aALL nolog |grep "^Adapter #" |cut -d# -f2) 6 | ld_list=$(for a in $adp_list; do sudo megacli ldinfo lall a$a nolog |grep -w "^Virtual Drive:" |awk '{print $3}' |while read ld ; do echo $a:$ld; done ; done) 7 | 8 | if [[ $1 = raw ]]; then 9 | for ld in ${ld_list}; do echo $ld; done ; exit 0 10 | fi 11 | 12 | echo -n '{"data":[' 13 | for ld in $ld_list; do echo -n "{\"{#LD}\": \"$ld\"},"; done |sed -e 's:\},$:\}:' 14 | echo -n ']}' 15 | -------------------------------------------------------------------------------- /files/hwraid-megacli/scripts/megacli-pd-discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Physical drives auto-discovery. VERY VERY EXPERIMENTAL (TESTED ON MEGACLI 8.02.21 Oct 21, 2011) 4 | 5 | adp_list=$(sudo megacli adpallinfo aALL nolog |grep "^Adapter #" |cut -d# -f2) 6 | enc_list=$(for a in $adp_list; do sudo megacli encinfo a$a nolog |grep -w "Device ID" |awk '{print $4}'; done) 7 | pd_list=$(for a in $adp_list; 8 | do 9 | for e in $enc_list; 10 | do 11 | sudo megacli pdlist a$a nolog |sed -n -e "/Enclosure Device ID: $e/,/Slot Number:/p" |grep -wE 'Slot Number:' |awk -v adp=$a -v enc=$e '{print adp":"enc":"$3}' 12 | done 13 | done) 14 | 15 | if [[ $1 = raw ]]; then 16 | for pd in ${pd_list}; do echo $pd; done ; exit 0 17 | fi 18 | 19 | echo -n '{"data":[' 20 | for pd in $pd_list; do echo -n "{\"{#PD}\": \"$pd\"},"; done |sed -e 's:\},$:\}:' 21 | echo -n ']}' 22 | -------------------------------------------------------------------------------- /files/hwraid-megacli/scripts/megacli-raid-data-processor.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: Gathering available information about MegaCLI supported devices. 4 | # Description: Analyze information and send data to zabbix server. 5 | # Disclaimer: VERY VERY EXPERIMENTAL. 6 | 7 | PATH="/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/bin" 8 | 9 | megacli=$(which megacli) 10 | data_tmp="/run/megacli-raid-data-harvester.tmp" 11 | data_out="/run/megacli-raid-data-harvester.out" 12 | all_keys='/run/keys' 13 | zbx_server=$(grep ^Server= /etc/zabbix/zabbix_agentd.conf |cut -d= -f2|cut -d, -f1) 14 | zbx_hostname=$(grep ^Hostname= /etc/zabbix/zabbix_agentd.conf |cut -d= -f2|cut -d, -f1) 15 | zbx_data='/run/zabbix-sender-megacli-raid-data.in' 16 | adp_list=$(/usr/libexec/zabbix-extensions/scripts/megacli-adp-discovery.sh raw) 17 | ld_list=$(/usr/libexec/zabbix-extensions/scripts/megacli-ld-discovery.sh raw) 18 | pd_list=$(/usr/libexec/zabbix-extensions/scripts/megacli-pd-discovery.sh raw) 19 | 20 | echo -n > $data_tmp 21 | 22 | # берем список контроллеров и берем с каждого информацию. 23 | echo "### adp section begin ###" >> $data_tmp 24 | for adp in $adp_list; 25 | do 26 | echo "### adp begin $adp ###" >> $data_tmp 27 | $megacli adpallinfo a$adp nolog >> $data_tmp 28 | echo "### adp end $adp ###" >> $data_tmp 29 | done 30 | echo "### adp section end ###" >> $data_tmp 31 | 32 | # перебираем все контроллеры и все логические тома на этих контроллерах 33 | echo "### ld section begin ###" >> $data_tmp 34 | for ld in $ld_list; 35 | do 36 | a=$(echo $ld|cut -d: -f1) 37 | l=$(echo $ld|cut -d: -f2) 38 | echo "### ld begin $a $l ###" >> $data_tmp 39 | $megacli ldinfo l$l a$a nolog >> $data_tmp 40 | echo "### ld end $a $l ###" >> $data_tmp 41 | done 42 | echo "### ld section end ###" >> $data_tmp 43 | 44 | # перебираем все контроллеры и все физические диски на этих контроллерах 45 | echo "### pd section begin ###" >> $data_tmp 46 | for pd in $pd_list; 47 | do 48 | a=$(echo $ld|cut -d: -f1) 49 | e=$(echo $pd|cut -d: -f2) 50 | p=$(echo $pd|cut -d: -f3) 51 | echo "### pd begin $a $e $p ###" >> $data_tmp 52 | $megacli pdinfo physdrv [$e:$p] a$a nolog >> $data_tmp 53 | echo "### pd end $a $e $p ###" >> $data_tmp 54 | done 55 | echo "### pd section end ###" >> $data_tmp 56 | 57 | mv $data_tmp $data_out 58 | 59 | echo -n > $all_keys 60 | echo -n > $zbx_data 61 | 62 | # формируем список ключей для zabbix 63 | for a in $adp_list; 64 | do 65 | echo -n -e "megacli.adp.name[$a]\nmegacli.ld.degraded[$a]\nmegacli.ld.offline[$a]\nmegacli.pd.total[$a]\nmegacli.pd.critical[$a]\nmegacli.pd.failed[$a]\nmegacli.mem.err[$a]\nmegacli.mem.unerr[$a]\n"; 66 | done >> $all_keys 67 | 68 | for l in $ld_list; 69 | do 70 | echo -n -e "megacli.ld.state[$l]\n"; 71 | done >> $all_keys 72 | 73 | for p in $pd_list; 74 | do 75 | echo -n -e "megacli.pd.media_error[$p]\nmegacli.pd.other_error[$p]\nmegacli.pd.pred_failure[$p]\nmegacli.pd.state[$p]\nmegacli.pd.temperature[$p]\n"; 76 | done >> $all_keys 77 | 78 | cat $all_keys | while read key; do 79 | if [[ "$key" == *megacli.adp.name* ]]; then 80 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d, -f1) 81 | value=$(sed -n -e "/adp begin $adp/,/adp end $adp/p" $data_out |grep -m1 -w "Product Name" |cut -d: -f2) 82 | echo "\"$zbx_hostname\" $key $value" >> $zbx_data 83 | fi 84 | if [[ "$key" == *megacli.ld.degraded* ]]; then 85 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d, -f1) 86 | value=$(sed -n -e "/adp begin $adp/,/adp end $adp/p" $data_out |grep -A1 -m1 -w "Virtual Drives" |grep -w "Degraded" |cut -d: -f2 |tr -d " ") 87 | echo "\"$zbx_hostname\" $key $value" >> $zbx_data 88 | fi 89 | if [[ "$key" == *megacli.ld.offline* ]]; then 90 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d, -f1) 91 | value=$(sed -n -e "/adp begin $adp/,/adp end $adp/p" $data_out |grep -A2 -m1 -w "Virtual Drives" |grep -w "Offline" |cut -d: -f2 |tr -d " ") 92 | echo "\"$zbx_hostname\" $key $value" >> $zbx_data 93 | fi 94 | if [[ "$key" == *megacli.pd.total* ]]; then 95 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d, -f1) 96 | value=$(sed -n -e "/adp begin $adp/,/adp end $adp/p" $data_out |grep -A1 -m1 -w "Physical Devices" |grep -w "Disks" |cut -d: -f2 |tr -d " ") 97 | echo "\"$zbx_hostname\" $key $value" >> $zbx_data 98 | fi 99 | if [[ "$key" == *megacli.pd.critical* ]]; then 100 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d, -f1) 101 | value=$(sed -n -e "/adp begin $adp/,/adp end $adp/p" $data_out |grep -A2 -m1 -w "Physical Devices" |grep -w "Critical Disks" |cut -d: -f2 |tr -d " ") 102 | echo "\"$zbx_hostname\" $key $value" >> $zbx_data 103 | fi 104 | if [[ "$key" == *megacli.pd.failed* ]]; then 105 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d, -f1) 106 | value=$(sed -n -e "/adp begin $adp/,/adp end $adp/p" $data_out |grep -A3 -m1 -w "Physical Devices" |grep -w "Failed Disks" |cut -d: -f2 |tr -d " ") 107 | echo "\"$zbx_hostname\" $key $value" >> $zbx_data 108 | fi 109 | if [[ "$key" == *megacli.mem.err* ]]; then 110 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d, -f1) 111 | value=$(sed -n -e "/adp begin $adp/,/adp end $adp/p" $data_out |grep -m1 -w "Memory Correctable Errors" |cut -d: -f2 |tr -d " ") 112 | echo "\"$zbx_hostname\" $key $value" >> $zbx_data 113 | fi 114 | if [[ "$key" == *megacli.mem.unerr* ]]; then 115 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d, -f1) 116 | value=$(sed -n -e "/adp begin $adp/,/adp end $adp/p" $data_out |grep -m1 -w "Memory Uncorrectable Errors" |cut -d: -f2 |tr -d " ") 117 | echo "\"$zbx_hostname\" $key $value" >> $zbx_data 118 | fi 119 | if [[ "$key" == *megacli.ld.state* ]]; then 120 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f1) 121 | enc=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f2) 122 | value=$(sed -n -e "/ld begin $adp $enc/,/ld end $adp $enc/p" $data_out |grep -m1 -w "^State" |cut -d: -f2 |tr -d " ") 123 | echo "\"$zbx_hostname\" $key $value" >> $zbx_data 124 | fi 125 | if [[ "$key" == *megacli.pd.media_error* ]]; then 126 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f1) 127 | enc=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f2) 128 | pd=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f3) 129 | value=$(sed -n -e "/pd begin $adp $enc $pd/,/ld end $adp $enc $pd/p" $data_out |grep -m1 -w "^Media Error Count:" |cut -d: -f2 |tr -d " ") 130 | echo "\"$zbx_hostname\" $key $value" >> $zbx_data 131 | fi 132 | if [[ "$key" == *megacli.pd.other_error* ]]; then 133 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f1) 134 | enc=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f2) 135 | pd=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f3) 136 | value=$(sed -n -e "/pd begin $adp $enc $pd/,/ld end $adp $enc $pd/p" $data_out |grep -m1 -w "^Other Error Count:" |cut -d: -f2 |tr -d " ") 137 | echo "\"$zbx_hostname\" $key $value" >> $zbx_data 138 | fi 139 | if [[ "$key" == *megacli.pd.pred_failure* ]]; then 140 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f1) 141 | enc=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f2) 142 | pd=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f3) 143 | value=$(sed -n -e "/pd begin $adp $enc $pd/,/ld end $adp $enc $pd/p" $data_out |grep -m1 -w "^Predictive Failure Count:" |cut -d: -f2 |tr -d " ") 144 | echo "\"$zbx_hostname\" $key $value" >> $zbx_data 145 | fi 146 | if [[ "$key" == *megacli.pd.state* ]]; then 147 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f1) 148 | enc=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f2) 149 | pd=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f3) 150 | value=$(sed -n -e "/pd begin $adp $enc $pd/,/ld end $adp $enc $pd/p" $data_out |grep -m1 -w "^Firmware state:" |cut -d" " -f3 |tr -d ,) 151 | echo "\"$zbx_hostname\" $key $value" >> $zbx_data 152 | fi 153 | if [[ "$key" == *megacli.pd.temperature* ]]; then 154 | adp=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f1) 155 | enc=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f2) 156 | pd=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f3) 157 | value=$(sed -n -e "/pd begin $adp $enc $pd/,/ld end $adp $enc $pd/p" $data_out |grep -m1 -w "^Drive Temperature" |awk '{print $3}' |grep -oE '[0-9]+') 158 | echo "\"$zbx_hostname\" $key ${value:-0}" >> $zbx_data 159 | fi 160 | done 161 | 162 | zabbix_sender -z $zbx_server -i $zbx_data &> /dev/null 163 | -------------------------------------------------------------------------------- /files/hwraid-megacli/zabbix.megacli: -------------------------------------------------------------------------------- 1 | # Author: Lesovsky A.V. 2 | # Description: MegaCLI data gathering, analyzing, and sending. 3 | 0 */1 * * * root /usr/libexec/zabbix-extensions/scripts/megacli-raid-data-processor.sh 4 | -------------------------------------------------------------------------------- /files/hwraid-smartarray/README.md: -------------------------------------------------------------------------------- 1 | HP Smart Array RAID controller monitoring extension. 2 | 3 | Check: 4 | - controller, cache, battery* health; 5 | - logical volumes health; 6 | - physical drives health and temperature**; 7 | - auto-discovery and agentd-side send data procedure. 8 | 9 | Installation notes: 10 | Run install.sh for agent-side configuration. 11 | Import template.xml in Zabbix front-end. 12 | 13 | Tested on: 14 | - HP Smart Array P410 15 | - HP Smart Array P222 16 | 17 | * - cache and battery may NOT shows on P410; 18 | ** - some models may not show temperature (Seagate). 19 | -------------------------------------------------------------------------------- /files/hwraid-smartarray/hp-raid-smart-array.conf: -------------------------------------------------------------------------------- 1 | # Author: Lesovsky A.V. 2 | # Description: HP Smart Array monitoring via hpacucli (tested with P410, P222) 3 | 4 | # controller auto discovery 5 | UserParameter=hpraid.ctrl.discovery,/usr/libexec/zabbix-extensions/scripts/hp-raid-ctrl-discovery.sh 6 | # logical drives (RAID volumes) auto discovery 7 | UserParameter=hpraid.ld.discovery,/usr/libexec/zabbix-extensions/scripts/hp-raid-ld-discovery.sh 8 | # physical drives auto discovery 9 | UserParameter=hpraid.pd.discovery,/usr/libexec/zabbix-extensions/scripts/hp-raid-pd-discovery.sh 10 | 11 | 12 | ### ==================== 13 | # Adapters status section. 14 | # $1 - slot number with installed adapter. Int from 1 to X (auto-discovery variable {#CTRL_SLOT}). 15 | UserParameter=hpraid.ctrl.status[*],sed -n -e "/ctrl begin $1/,/ctrl end $1/p" /tmp/hp-raid-data-harvester.out |grep -wE "[ ]+Controller Status:" |awk '{print $$3}' 16 | UserParameter=hpraid.cache.status[*],sed -n -e "/ctrl begin $1/,/ctrl end $1/p" /tmp/hp-raid-data-harvester.out |grep -w "Controller Status:" |awk '{print $$3}' 17 | UserParameter=hpraid.bbu.status[*],sed -n -e "/ctrl begin $1/,/ctrl end $1/p" /tmp/hp-raid-data-harvester.out |grep -w "Controller Status:" |awk '{print $$3}' 18 | 19 | # Logical volume status section. 20 | # $1 - slot number with installed adapter. Int from 1 to X 21 | # $2 - logical volume number. Int from 1 to X 22 | UserParameter=hpraid.ld.status[*],sed -n -e "/ld begin $1 $2/,/ld end $1 $2/p" /tmp/hp-raid-data-harvester.out |grep -wE "[ ]+Status:" |awk '{print $$2}' 23 | 24 | # Physical drive status section 25 | # $1 - slot number with installed adapter. Int from 1 to X 26 | # $2 - physical drive number. Int from 1 to X 27 | UserParameter=hpraid.pd.status[*],sed -n -e "/pd begin $1 $2/,/pd end $1 $2/p" /tmp/hp-raid-data-harvester.out |grep -wE '[ ]+Status:' |awk '{print $$2}' 28 | UserParameter=hpraid.pd.temperature[*],sed -n -e "/pd begin $1 $2/,/pd end $1 $2/p" /tmp/hp-raid-data-harvester.out |grep -wE '[ ]+Current Temperature \(C\):' |awk '{print $$4}' 29 | -------------------------------------------------------------------------------- /files/hwraid-smartarray/scripts/hp-raid-ctrl-discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Descriprion: Low-level discovery for HP Smart Array controllers 4 | 5 | data="/tmp/hp-raid-data-harvester.out" 6 | 7 | if [ -f "$data" ]; then 8 | ctrl_list=$(sed -n -e '/ctrl section begin/,/ctrl section end/p' $data |grep -oE 'Slot [0-9]+' |awk '{print $2}') 9 | else echo "$data not found."; exit 1 10 | fi 11 | 12 | if [[ $1 = raw ]]; then 13 | for line in ${ctrl_list}; do echo $line; done ; exit 0 14 | fi 15 | 16 | echo -n '{"data":[' 17 | for ctrl in $ctrl_list; do echo -n "{\"{#CTRL_SLOT}\": \"$ctrl\"},"; done |sed -e 's:\},$:\}:' 18 | echo -n ']}' 19 | -------------------------------------------------------------------------------- /files/hwraid-smartarray/scripts/hp-raid-data-processor.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: Gathering available information about HP Smart Array devices. 4 | # Description: Analyze information and send data to zabbix server. 5 | 6 | PATH="/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin" 7 | 8 | if [[ -x $(which hpssacli) ]] 9 | then 10 | hpcli=$(which hpssacli) 11 | elif [[ -x $(which hpacucli) ]] 12 | then 13 | hpcli=$(which hpacucli) 14 | else 15 | echo -ne 'hpssacli or hpacucli not installed\n' 16 | exit 1 17 | fi 18 | 19 | data_tmp="/tmp/hp-raid-data-harvester.tmp" 20 | data_out="/tmp/hp-raid-data-harvester.out" 21 | all_keys='/tmp/keys' 22 | zbx_servers=$(grep ^Server\= /etc/zabbix/zabbix_agentd.conf |cut -d= -f2|sed 's/,/ /g') 23 | zbx_hostname=$(grep ^Hostname\= /etc/zabbix/zabbix_agentd.conf |cut -d= -f2|cut -d, -f1) 24 | zbx_data='/tmp/zabbix-sender-hp-raid-data.in' 25 | ctrl_list=$(${hpcli} ctrl all show |grep -oE 'Slot [0-9]+' |awk '{print $2}' |xargs echo) 26 | 27 | echo -n > $data_tmp 28 | 29 | # Get adapters list and get info about each. 30 | echo "### ctrl section begin ###" >> $data_tmp 31 | for slot in $ctrl_list; 32 | do 33 | echo "### ctrl begin $slot ###" >> $data_tmp 34 | $hpcli ctrl slot=$slot show >> $data_tmp 35 | echo "### ctrl end $slot ###" >> $data_tmp 36 | done 37 | echo "### ctrl section end ###" >> $data_tmp 38 | 39 | # enumerate all adapters and all logical drives on each adapter. 40 | echo "### ld section begin ###" >> $data_tmp 41 | for slot in $ctrl_list; 42 | do 43 | ld_list=$($hpcli ctrl slot=$slot ld all show |grep -w logicaldrive |awk '{print $2}' |xargs echo) 44 | for ld in $ld_list; 45 | do 46 | echo "### ld begin $slot $ld ###" >> $data_tmp 47 | $hpcli ctrl slot=$slot ld $ld show >> $data_tmp 48 | echo "### ld end $slot $ld ###" >> $data_tmp 49 | done 50 | done 51 | echo "### ld section end ###" >> $data_tmp 52 | 53 | # enumerate all adapters and all physical drives on each adapter. 54 | echo "### pd section begin ###" >> $data_tmp 55 | for slot in $ctrl_list; 56 | do 57 | pd_list=$($hpcli ctrl slot=$slot pd all show |grep -w physicaldrive |awk '{print $2}' |xargs echo) 58 | for pd in $pd_list; 59 | do 60 | echo "### pd begin $slot $pd ###" >> $data_tmp 61 | $hpcli ctrl slot=$slot pd $pd show >> $data_tmp 62 | echo "### pd end $slot $pd ###" >> $data_tmp 63 | done 64 | done 65 | echo "### pd section end ###" >> $data_tmp 66 | 67 | mv $data_tmp $data_out 68 | 69 | # fill zabbix key 70 | echo -n > $all_keys 71 | echo -n > $zbx_data 72 | 73 | for c in $(/usr/libexec/zabbix-extensions/scripts/hp-raid-ctrl-discovery.sh raw); 74 | do 75 | if grep -Fq 'Battery/Capacitor' $data_out 76 | then 77 | echo -n -e "hpraid.ctrl.status[$c]\nhpraid.cache.status[$c]\nhpraid.bbu.status[$c]\n"; 78 | else 79 | echo -n -e "hpraid.ctrl.status[$c]\nhpraid.cache.status[$c]\n"; 80 | fi 81 | done >> $all_keys 82 | 83 | for l in $(/usr/libexec/zabbix-extensions/scripts/hp-raid-ld-discovery.sh raw); 84 | do 85 | echo -n -e "hpraid.ld.status[$l]\n"; 86 | done >> $all_keys 87 | 88 | for p in $(/usr/libexec/zabbix-extensions/scripts/hp-raid-pd-discovery.sh raw); 89 | do 90 | if grep -Fq 'Current Temperature' $data_out 91 | then 92 | echo -n -e "hpraid.pd.status[$p]\nhpraid.pd.temperature[$p]\n"; 93 | else 94 | echo -n -e "hpraid.pd.status[$p]\n"; 95 | fi 96 | done >> $all_keys 97 | 98 | cat $all_keys | while read key; do 99 | if [[ "$key" == *hpraid.ctrl.status* ]]; then 100 | slot=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d, -f1) 101 | value=$(sed -n -e "/ctrl begin $slot/,/ctrl end $slot/p" /tmp/hp-raid-data-harvester.out |grep -wE "[ ]+Controller Status:" |awk '{print $3}') 102 | echo "$zbx_hostname $key $value" >> $zbx_data 103 | fi 104 | 105 | if [[ "$key" == *hpraid.cache.status* ]]; then 106 | slot=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d, -f1) 107 | value=$(sed -n -e "/ctrl begin $slot/,/ctrl end $slot/p" /tmp/hp-raid-data-harvester.out |grep -wE "[ ]+Cache Status:" |awk '{print $3}') 108 | echo "$zbx_hostname $key $value" >> $zbx_data 109 | fi 110 | 111 | if [[ "$key" == *hpraid.bbu.status* ]]; then 112 | slot=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d, -f1) 113 | value=$(sed -n -e "/ctrl begin $slot/,/ctrl end $slot/p" /tmp/hp-raid-data-harvester.out |grep -wE "[ ]+Battery/Capacitor Status:" |awk '{print $3}') 114 | echo "$zbx_hostname $key $value" >> $zbx_data 115 | fi 116 | 117 | if [[ "$key" == *hpraid.ld.status* ]]; then 118 | slot=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f1) 119 | ld=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f2) 120 | value=$(sed -n -e "/ld begin $slot $ld/,/ld end $slot $ld/p" /tmp/hp-raid-data-harvester.out |grep -wE "[ ]+Status:" |awk '{print $2}') 121 | echo "$zbx_hostname $key $value" >> $zbx_data 122 | fi 123 | 124 | if [[ "$key" == *hpraid.pd.temperature* ]]; then 125 | slot=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f1) 126 | pd=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f2-) 127 | value=$(sed -n -e "/pd begin $slot $pd/,/pd end $slot $pd/p" /tmp/hp-raid-data-harvester.out |grep -wE '[ ]+Current Temperature \(C\):' |awk '{print $4}') 128 | echo "$zbx_hostname $key $value" >> $zbx_data 129 | fi 130 | 131 | if [[ "$key" == *hpraid.pd.status* ]]; then 132 | slot=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f1) 133 | pd=$(echo $key |grep -o '\[.*\]' |tr -d \[\] |cut -d: -f2-) 134 | value=$(sed -n -e "/pd begin $slot $pd/,/pd end $slot $pd/p" /tmp/hp-raid-data-harvester.out |grep -wE '[ ]+Status:' |awk '{print $2}') 135 | echo "$zbx_hostname $key $value" >> $zbx_data 136 | fi 137 | done 138 | 139 | # send data to zabbix servers 140 | for zbx_server in $zbx_servers ; do zabbix_sender -z $zbx_server -i $zbx_data > /dev/null 2>&1 ; done 141 | -------------------------------------------------------------------------------- /files/hwraid-smartarray/scripts/hp-raid-ld-discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Descriprion: Low-level discovery for HP Smart Array logical volumes 4 | 5 | data="/tmp/hp-raid-data-harvester.out" 6 | 7 | if [ -f $data ]; then 8 | ld_list=$(sed -n -e '/ld section begin/,/ld section end/p' $data |grep -w 'ld begin' |awk '{OFS=":"} {print $4,$5}') 9 | else echo "$data not found."; exit 1 10 | fi 11 | 12 | if [[ $1 = raw ]]; then 13 | for line in ${ld_list}; do echo $line; done ; exit 0 14 | fi 15 | 16 | echo -n '{"data":[' 17 | for ld in $ld_list; do echo -n "{\"{#LD}\": \"$ld\"},"; done |sed -e 's:\},$:\}:' 18 | echo -n ']}' 19 | -------------------------------------------------------------------------------- /files/hwraid-smartarray/scripts/hp-raid-pd-discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Descriprion: Low-level discovery for HP Smart Array physical drives 4 | 5 | data="/tmp/hp-raid-data-harvester.out" 6 | 7 | if [ -f $data ]; then 8 | pd_list=$(sed -n -e '/pd section begin/,/pd section end/p' $data |grep -w 'pd begin' |awk '{OFS=":"} {print $4,$5}') 9 | else echo "$data not found."; exit 1 10 | fi 11 | 12 | if [[ $1 = raw ]]; then 13 | for line in ${pd_list}; do echo $line; done ; exit 0 14 | fi 15 | 16 | echo -n '{"data":[' 17 | for pd in $pd_list; do echo -n "{\"{#PD}\": \"$pd\"},"; done |sed -e 's:\},$:\}:' 18 | echo -n ']}' 19 | -------------------------------------------------------------------------------- /files/hwraid-smartarray/zabbix.smartarray: -------------------------------------------------------------------------------- 1 | # Description: HP SmartArray data gathering and analyze 2 | 0 */1 * * * root /usr/libexec/zabbix-extensions/scripts/hp-raid-data-processor.sh 3 | -------------------------------------------------------------------------------- /files/iostat/crontab: -------------------------------------------------------------------------------- 1 | # Collect data iops for zabbix - just execute "crontab -e" and write this line: 2 | * * * * * DATA=$(S_TIME_FORMAT=ISO /usr/bin/iostat -yxdt -o JSON 59 1) ; echo "$DATA" >/tmp/iostat-cron.out 3 | -------------------------------------------------------------------------------- /files/iostat/iostat.conf: -------------------------------------------------------------------------------- 1 | # Disk statistics via iostat (sysstat) 2 | UserParameter=iostat.discovery, iostat -d | awk 'BEGIN {check=0;count=0;array[0]=0;} {if(check==1 && $1 != ""){array[count]=$1;count=count+1;}if($1~"^Device"){check=1;}} END {printf("{\n\t\"data\":[\n");for(i=0;i 2 | 3 | 2.0 4 | 2013-12-25T06:35:12Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /files/keepalived/scripts/keepalived.addr.availability.sh: -------------------------------------------------------------------------------- 1 | #/usr/bin/env bash 2 | # Description: determines if the IP address is available on this server 3 | # Author: Lesovsky A.V. 4 | 5 | PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' 6 | IPADDR=$1 7 | 8 | [[ $1 ]] || { echo "ZBX_NOTSUPPORTED, need at least one parameter in which IP address must be specified."; exit 1; } 9 | [[ -f $(which ip 2>/dev/null) ]] || { echo "ZBX_NOTSUPPORTED, ip utility from iproute2 not found."; exit 1; } 10 | 11 | if ip addr show |grep -qo $IPADDR; then echo "Up"; else echo "Not present"; fi 12 | -------------------------------------------------------------------------------- /files/keepalived/scripts/keepalived.addr.discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Description: keepalived virtual addreses auto-discovery 3 | # Author: Lesovsky A.V. 4 | 5 | KEEPALIVED_CONF=$1 6 | 7 | [[ $1 ]] || { echo "ZBX_NOTSUPPORTED, need at least one parameter in which keepalived.conf must be specified"; exit 1; } 8 | [[ -f $KEEPALIVED_CONF ]] || { echo "ZBX_NOTSUPPORTED, $KEEPALIVED_CONF doesn't exist" ; exit 1; } 9 | 10 | ADDRESSES=$(sed -n -e '/virtual_ipaddress {/,/}/p' $KEEPALIVED_CONF |grep -v ^# |awk '{print $1}' |grep -oE '([0-9]{1,3}[\.]){3}[0-9]{1,3}*') 11 | 12 | echo -n '{"data":[' 13 | for addr in $ADDRESSES; do echo -n "{\"{#KADDR}\": \"$addr\"},"; done |sed -e 's:\},$:\}:' 14 | echo -n ']}' 15 | -------------------------------------------------------------------------------- /files/linux/README.md: -------------------------------------------------------------------------------- 1 | Extended monitoring for Linux. 2 | -------------------------------------------------------------------------------- /files/linux/linux-extended.conf: -------------------------------------------------------------------------------- 1 | # get sysctl variables 2 | UserParameter=sysctl[*],sysctl $1 |awk '{print $$3}' 3 | # memory 4 | UserParameter=system.pmemusage,/usr/libexec/zabbix-extensions/scripts/mem-usage.sh 5 | # swap discovery 6 | UserParameter=swap.discovery,/usr/libexec/zabbix-extensions/scripts/swap.discovery.sh 7 | # cft-check 8 | UserParameter=cfe.state,/bin/bash -c '[[ $(/usr/sbin/check-cft) == "OK - no changes" ]] && echo 0 || echo 1' 9 | # check network interfaces speed 10 | UserParameter=net.if.discovery.active,/usr/libexec/zabbix-extensions/scripts/check-netif-speed.sh --discovery 11 | UserParameter=net.if.speed[*],/usr/libexec/zabbix-extensions/scripts/check-netif-speed.sh --check=$1 12 | # count open files. first and single parameter is pidfile location (also require granted sudo privileges to zabbix user). 13 | UserParameter=count.openfiles[*],/usr/bin/sudo /usr/bin/lsof -nPp $(cat $1) |tail -n +2 |wc -l 14 | UserParameter=system.deleted_filehandler_maxsize,/usr/libexec/zabbix-extensions/scripts/check-open-descriptors.sh 15 | -------------------------------------------------------------------------------- /files/linux/scripts/check-netif-speed.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Description: check compliance with the current network interface speed to the declared. 3 | # Author: Lesovsky A.V. 4 | 5 | print_usage() { 6 | echo "Usage:" 7 | echo " ${0##*/} --discovery discovery ACTIVE physical interfaces" 8 | echo " ${0##*/} --check=eth0 check interface speed" 9 | exit 10 | } 11 | 12 | [[ $(which ethtool) ]] || { echo "FATAL: ethtool not found."; exit 1; } 13 | [[ -n $@ ]] || { print_usage; exit 1; } 14 | 15 | physIfList=$(find /sys/class/net -type l -not -lname '*virtual*' -printf '%f\n') 16 | physActiveIfList=$(for interface in $physIfList; do 17 | [[ -e /sys/class/net/$interface/operstate ]] && echo $interface $(cat /sys/class/net/$interface/operstate); 18 | done |grep -w up |cut -d' ' -f1) 19 | 20 | MODE=$1 21 | 22 | case "$MODE" in 23 | '--discovery' ) 24 | printf "{\n"; 25 | printf "\t\"data\":[\n"; 26 | INDEX=0 27 | for interface in ${physActiveIfList} 28 | do 29 | if [ $INDEX -gt 0 ] 30 | then 31 | printf ","; 32 | fi 33 | printf "\n\t{\n"; 34 | printf "\t\t\"{#PHYS_IFNAME}\":\"$interface\"\n"; 35 | printf "\t},\n"; 36 | done 37 | printf "\n\t]\n"; 38 | printf "}\n"; 39 | ;; 40 | --check=* ) 41 | physIfName=$(echo $1 |cut -d= -f2) 42 | [[ "$physActiveIfList" == *"$physIfName"* ]] || { echo "FATAL: Interface not found or link not detected. Exit"; exit 1; } 43 | 44 | maxRemoteSupported=$(ethtool $physIfName |sed -n -e '/Advertised link modes:/,/Advertised pause frame use:/p' |grep -oE '[0-9]+' |uniq |sort -n |tail -n1) 45 | maxLocalSupported=$(ethtool $physIfName |sed -n -e '/Link partner advertised link modes:/,/Link partner advertised pause frame use:/p' |grep -oE '[0-9]+' |uniq |sort -n |tail -n1) 46 | localCurrent=$(ethtool $physIfName |grep -m1 Speed: |grep -oE '[0-9]+') 47 | 48 | [[ $localCurrent -lt $maxLocalSupported && $localCurrent -lt $maxRemoteSupported ]] && { echo "$physIfName: current interface speed less then supported"; exit 1; } 49 | 50 | echo OK; exit 0 51 | ;; 52 | * ) print_usage;; 53 | esac 54 | -------------------------------------------------------------------------------- /files/linux/scripts/check-open-descriptors.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: Search open handlers deleted files and output file size associated with the handler. 4 | 5 | LSOF=$(which lsof) 6 | GLOBAL_BIG=0 7 | 8 | for mount in $(cat /proc/mounts |grep -wE 'ext[2-4]+|xfs' |awk '{print $2}'); 9 | do 10 | LOCAL_BIG=$(sudo $LSOF $mount |grep -i del |awk '{print $7}' |sort -n |tail -n1) 11 | [[ ! -z "$LOCAL_BIG" && $LOCAL_BIG -ge $GLOBAL_BIG ]] && GLOBAL_BIG=$LOCAL_BIG 12 | done 13 | 14 | echo $GLOBAL_BIG 15 | -------------------------------------------------------------------------------- /files/linux/scripts/mem-usage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # The aim of this check is detect the moment when memory usage is quite close to critical threshold, 3 | # when caches are close to be empty and all the memory is used and system starts swapping in near time. 4 | 5 | USEDRAM=$(free |grep ^Mem|awk '{print $3}') 6 | USEDSWAP=$(free |grep ^Swap|awk '{print $3}') 7 | FREERAM=$(free |grep ^Mem|awk '{print $4}') 8 | BUFFERS=$(grep ^Buffers: /proc/meminfo |awk '{print $2}') 9 | PAGECACHE=$(grep ^Cached: /proc/meminfo |awk '{print $2}') 10 | TOTALRAM=$(free |grep ^Mem|awk '{print $2}') 11 | USED=$(echo $(($USEDRAM + $USEDSWAP - $FREERAM - $BUFFERS - $PAGECACHE))) 12 | 13 | awk "BEGIN {print $USED/$TOTALRAM*100}" |cut -d. -f1 14 | -------------------------------------------------------------------------------- /files/linux/scripts/swap.discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: Swap discovery 4 | 5 | SIZE=$(swapon -s |grep -v ^Filename |awk '{sum += $3} END {print sum}') 6 | 7 | if [ -z $SIZE ]; then exit 1; fi 8 | 9 | echo -n '{"data":[' 10 | echo -n "{\"{#SWAP_EXISTS}\": \"$line\"}"; 11 | echo -n ']}' 12 | -------------------------------------------------------------------------------- /files/linux/zabbix.cron: -------------------------------------------------------------------------------- 1 | # Author: Lesovsky A.V. 2 | # Description: Extended zabbix check 3 | 0 */2 * * * root /usr/libexec/zabbix-extensions/scripts/check-open-descriptors.sh &> /dev/null 4 | -------------------------------------------------------------------------------- /files/linux/zabbix.sudo: -------------------------------------------------------------------------------- 1 | # Sudo rules for zabbix 2 | 3 | Cmnd_Alias HWRAID = /opt/bin/arcconf, /usr/sbin/hpacucli, /opt/bin/megacli 4 | Cmnd_Alias FILES = /usr/bin/lsof 5 | 6 | zabbix ALL=(root) NOPASSWD: HWRAID, FILES 7 | -------------------------------------------------------------------------------- /files/memcached/README.md: -------------------------------------------------------------------------------- 1 | Memcached - high-performance, distributed memory object caching system. 2 | -------------------------------------------------------------------------------- /files/memcached/memcached.conf: -------------------------------------------------------------------------------- 1 | UserParameter=memcached[*],echo -e "stats\nquit" | busybox nc 127.0.0.1 11211 | grep "STAT $1 " | awk '{print $$3}' 2 | -------------------------------------------------------------------------------- /files/pgbouncer/README.md: -------------------------------------------------------------------------------- 1 | PgBouncer - lightweight connection pooler for PostgreSQL. 2 | -------------------------------------------------------------------------------- /files/pgbouncer/pgbouncer.conf: -------------------------------------------------------------------------------- 1 | UserParameter=pgbouncer.pool.discovery,/usr/libexec/zabbix-extensions/scripts/pgbouncer.pool.discovery.sh 2 | UserParameter=pgbouncer.stat[*],/usr/libexec/zabbix-extensions/scripts/pgbouncer.stat.sh $1 $2 3 | UserParameter=pgbouncer.total.avg_req,/usr/libexec/zabbix-extensions/scripts/pgbouncer.stat.sh total_avg_req 4 | UserParameter=pgbouncer.total.avg_recv,/usr/libexec/zabbix-extensions/scripts/pgbouncer.stat.sh total_avg_recv 5 | UserParameter=pgbouncer.total.avg_sent,/usr/libexec/zabbix-extensions/scripts/pgbouncer.stat.sh total_avg_sent 6 | UserParameter=pgbouncer.total.avg_query,/usr/libexec/zabbix-extensions/scripts/pgbouncer.stat.sh total_avg_query 7 | -------------------------------------------------------------------------------- /files/pgbouncer/scripts/pgbouncer.pool.discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: Pgbouncer pools auto-discovery 4 | 5 | if [ ! -f ~zabbix/.pgpass ]; then echo "ERROR: ~zabbix/.pgpass not found" ; exit 1; fi 6 | 7 | hostname=$(head -n 1 ~zabbix/.pgpass |cut -d: -f1) 8 | port=$(head -n 1 ~zabbix/.pgpass |cut -d: -f2) 9 | username=$(head -n 1 ~zabbix/.pgpass |cut -d: -f4) 10 | dbname="pgbouncer" 11 | 12 | if [ '*' = "$hostname" ]; then hostname="127.0.0.1"; fi 13 | 14 | poollist=$(psql -h $hostname -p $port -U $username -tAF: --dbname=$dbname -c "show pools" |cut -d: -f1,2 |grep -v ^pgbouncer) 15 | 16 | echo -n '{"data":[' 17 | for pool in $poollist; do echo -n "{\"{#POOLNAME}\": \"$pool\"},"; done |sed -e 's:\},$:\}:' 18 | echo -n ']}' 19 | -------------------------------------------------------------------------------- /files/pgbouncer/scripts/pgbouncer.stat.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: Pgbouncer pools stats 4 | # $1 - param_name, $2 - pool_name 5 | 6 | if [ ! -f ~zabbix/.pgpass ]; then echo "ERROR: ~zabbix/.pgpass not found" ; exit 1; fi 7 | 8 | PSQL=$(which psql) 9 | 10 | hostname=$(head -n 1 ~zabbix/.pgpass |cut -d: -f1) 11 | port=$(head -n 1 ~zabbix/.pgpass |cut -d: -f2) 12 | username=$(head -n 1 ~zabbix/.pgpass |cut -d: -f4) 13 | dbname="pgbouncer" 14 | PARAM="$1" 15 | 16 | IFS=':'; arr_poolname=($2); unset IFS; 17 | 18 | if [ '*' = "$hostname" ]; then hostname="127.0.0.1"; fi 19 | 20 | conn_param="-qAtX -F: -h $hostname -p $port -U $username $dbname" 21 | 22 | case "$PARAM" in 23 | 'avg_req' ) 24 | $PSQL $conn_param -c "show stats" |grep -w ${arr_poolname[0]} |cut -d: -f6 25 | ;; 26 | 'avg_recv' ) 27 | $PSQL $conn_param -c "show stats" |grep -w ${arr_poolname[0]} |cut -d: -f7 28 | ;; 29 | 'avg_sent' ) 30 | $PSQL $conn_param -c "show stats" |grep -w ${arr_poolname[0]} |cut -d: -f8 31 | ;; 32 | 'avg_query' ) 33 | $PSQL $conn_param -c "show stats" |grep -w ${arr_poolname[0]} |cut -d: -f9 34 | ;; 35 | 'cl_active' ) 36 | $PSQL $conn_param -c "show pools" |grep -w ^$2 |cut -d: -f3 37 | ;; 38 | 'cl_waiting' ) 39 | $PSQL $conn_param -c "show pools" |grep -w ^$2 |cut -d: -f4 40 | ;; 41 | 'sv_active' ) 42 | $PSQL $conn_param -c "show pools" |grep -w ^$2 |cut -d: -f5 43 | ;; 44 | 'sv_idle' ) 45 | $PSQL $conn_param -c "show pools" |grep -w ^$2 |cut -d: -f6 46 | ;; 47 | 'sv_used' ) 48 | $PSQL $conn_param -c "show pools" |grep -w ^$2 |cut -d: -f7 49 | ;; 50 | 'sv_tested' ) 51 | $PSQL $conn_param -c "show pools" |grep -w ^$2 |cut -d: -f8 52 | ;; 53 | 'sv_login' ) 54 | $PSQL $conn_param -c "show pools" |grep -w ^$2 |cut -d: -f9 55 | ;; 56 | 'maxwait' ) 57 | $PSQL $conn_param -c "show pools" |grep -w ^$2 |cut -d: -f10 58 | ;; 59 | 'free_clients' ) 60 | $PSQL $conn_param -c "show lists" |grep -w free_clients |cut -d: -f2 61 | ;; 62 | 'used_clients' ) 63 | $PSQL $conn_param -c "show lists" |grep -w used_clients |cut -d: -f2 64 | ;; 65 | 'login_clients' ) 66 | $PSQL $conn_param -c "show lists" |grep -w login_clients |cut -d: -f2 67 | ;; 68 | 'free_servers' ) 69 | $PSQL $conn_param -c "show lists" |grep -w free_servers |cut -d: -f2 70 | ;; 71 | 'used_servers' ) 72 | $PSQL $conn_param -c "show lists" |grep -w used_servers |cut -d: -f2 73 | ;; 74 | 'total_avg_req' ) 75 | $PSQL $conn_param -c "show stats" |cut -d: -f6 |awk '{ s += $1 } END { print s }' 76 | ;; 77 | 'total_avg_recv' ) 78 | $PSQL $conn_param -c "show stats" |cut -d: -f7 |awk '{ s += $1 } END { print s }' 79 | ;; 80 | 'total_avg_sent' ) 81 | $PSQL $conn_param -c "show stats" |cut -d: -f8 |awk '{ s += $1 } END { print s }' 82 | ;; 83 | 'total_avg_query' ) 84 | $PSQL $conn_param -c "show stats" |cut -d: -f6,9 |awk -F: '{ a += $1 * $2} { b += $1} END { print a / b }' 85 | ;; 86 | * ) echo "ZBX_NOTSUPPORTED"; exit 1;; 87 | esac 88 | -------------------------------------------------------------------------------- /files/postfix/README.md: -------------------------------------------------------------------------------- 1 | Just in case - Installation 2 | --------------------------- 3 | 4 | postfix-minimal-template.xml needs to be installed under: 5 | 6 | Configuration -> Templates -> Import 7 | 8 | userparameter_postfix.conf goes to: 9 | 10 | /etc/zabbix/zabbix_agentd.d/ 11 | 12 | and make sure you restart zabbix-agent service after. 13 | 14 | 15 | SELinux module needs to compiled into loadable module and installed: 16 | 17 | checkmodule -M -m -o zabbix-postqueue-local.mod zabbix-postqueue-local.te 18 | semodule_package -o zabbix-postqueue-local.pp -m zabbix-postqueue-local.mod 19 | semodule -i zabbix-postqueue-local.pp 20 | 21 | -------------------------------------------------------------------------------- /files/postfix/postfix-minimal-template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-06-26T05:27:43Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 109 | 110 | 111 | 112 | {Postfix-Minimal-Template:proc.num[master].last(0)}=0 113 | Postfix master status on {HOSTNAME} 114 | 115 | 0 116 | 4 117 | 118 | 0 119 | 120 | 121 | 122 | {Postfix-Minimal-Template:mail.queue.count(#3,5000,"gt")} 123 | Too many requests in mail queue on {HOSTNAME} (queue={ITEM.LASTVALUE}) 124 | 125 | 0 126 | 2 127 | 128 | 0 129 | 130 | 131 | 132 | 133 | 134 | Postfix: Mail queue 135 | 900 136 | 200 137 | 0.0000 138 | 100.0000 139 | 1 140 | 1 141 | 0 142 | 1 143 | 0 144 | 0.0000 145 | 0.0000 146 | 1 147 | 0 148 | 0 149 | 0 150 | 151 | 152 | 0 153 | 0 154 | C80000 155 | 0 156 | 2 157 | 0 158 | 159 | Postfix-Minimal-Template 160 | mail.queue 161 | 162 | 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /files/postfix/userparameter_postfix.conf: -------------------------------------------------------------------------------- 1 | UserParameter=mail.queue,postqueue -p | tail -1 | awk '{if (/^--/) {print $5} else {print "0"}}' 2 | -------------------------------------------------------------------------------- /files/postfix/zabbix-postqueue-local.te: -------------------------------------------------------------------------------- 1 | 2 | module zabbix-postqueue-local 1.0; 3 | 4 | require { 5 | type postfix_etc_t; 6 | type kernel_t; 7 | type postfix_public_t; 8 | type postfix_postqueue_exec_t; 9 | type devlog_t; 10 | type zabbix_agent_t; 11 | type postfix_master_t; 12 | class sock_file write; 13 | class unix_stream_socket connectto; 14 | class unix_dgram_socket { create connect sendto }; 15 | class file { read execute open execute_no_trans }; 16 | } 17 | 18 | #============= zabbix_agent_t ============== 19 | allow zabbix_agent_t devlog_t:sock_file write; 20 | allow zabbix_agent_t kernel_t:unix_dgram_socket sendto; 21 | allow zabbix_agent_t postfix_etc_t:file read; 22 | allow zabbix_agent_t postfix_etc_t:file open; 23 | allow zabbix_agent_t postfix_master_t:unix_stream_socket connectto; 24 | allow zabbix_agent_t postfix_postqueue_exec_t:file { execute execute_no_trans }; 25 | allow zabbix_agent_t postfix_public_t:sock_file write; 26 | allow zabbix_agent_t self:unix_dgram_socket connect; 27 | allow zabbix_agent_t self:unix_dgram_socket create; 28 | -------------------------------------------------------------------------------- /files/postgresql/README.md: -------------------------------------------------------------------------------- 1 | PostgreSQL 2 | ========== 3 | 4 | PostgreSQL monitoring with Zabbix. 5 | 6 | The Template DB PostgreSQL was formerly known as pgCayenne. 7 | 8 | It is a set of `UserParameter` for PostgreSQL monitoring, which consists of Zabbix agent configuration and XML template for web monitoring. It is using built-in PostgreSQL system views and functions. The agent requires the standard `psql` client utility. 9 | 10 | ## Features 11 | - minimalistic configuration for monitored host, Zabbix agent and pg_hba access 12 | - no scripts, no .pgpass, no other redundant entities - only configuration for Zabbix agent 13 | - template-defined macros for configuring triggers and psql connection settings 14 | - gathering information about connections, transaction time, database and table statistics, streaming replication lag, and more... 15 | - low level discovery for streaming standby servers, databases, tables 16 | 17 | ## Supported versions 18 | - all upstream supported PostgreSQL versions (9.5 and above) 19 | - Zabbix 3.4, 4.0 LTS, 5.0 LTS (and newer unless breaking with LTS) 20 | 21 | ## Short how-to install and configure 22 | - download repository with `git clone` 23 | - copy __postgresql.conf__ into Zabbix agent configuration directory 24 | - include __postgresql.conf__ into Zabbix agent main configuration (see `Include` option in __zabbix_agentd.conf__) 25 | - restart Zabbix agent service 26 | - edit PostgreSQL service __pg_hba.conf__ to allow connections from Zabbix agent 27 | - recommended: enable extensions `pg_buffercache` and `pg_stat_statements` 28 | - import XML template into web monitoring and link template with target host 29 | - edit template macros parameters (set connections settings and other options) 30 | - add additional items into template if required 31 | 32 | ## Full how-to install and configure 33 | - download repository with `git clone`: 34 | ``` 35 | # git clone https://github.com/lesovsky/zabbix-extensions 36 | ``` 37 | 38 | - copy __postgresql.conf__ into Zabbix agent configuration directory (target directory maybe different in other OS): 39 | ``` 40 | # mkdir /etc/zabbix/zabbix_agentd.d/ 41 | # cp files/postgresql/postgresql.conf /etc/zabbix/zabbix_agentd.d/ 42 | ``` 43 | 44 | - include __postgresql.conf__ into Zabbix agent main configuration (add or uncomment `Include` option in __zabbix_agentd.conf__); 45 | ``` 46 | # vi /etc/zabbix/zabbix_agentd.conf 47 | Include=/etc/zabbix/zabbix_agentd.d/ 48 | ``` 49 | 50 | - restart Zabbix agent service: 51 | ``` 52 | # systemctl restart zabbix-agent.service 53 | ``` 54 | 55 | - edit access rules in PostgreSQL [pg_hba.conf](http://www.postgresql.org/docs/9.3/static/auth-pg-hba-conf.html) (example for RHEL-based OS). 56 | ``` 57 | # vi /var/lib/pgsql/9.3/data/pg_hba.conf 58 | host db_production postgres 127.0.0.1/32 trust 59 | ``` 60 | 61 | - reload PostgreSQL configuration after making changes 62 | ``` 63 | # systemctl reload postgresql.service 64 | ``` 65 | 66 | - recommended: enable extensions `pg_buffercache` and `pg_stat_statements` 67 | 68 | - verify installation with `zabbix_get` 69 | ``` 70 | # zabbix_get -s 127.0.0.1 -k pgsql.ping['-h 127.0.0.1 -p 5432 -U postgres -d postgres'] 71 | ``` 72 | If all things done correctly, we can see the response time of PostgreSQL service. Otherwise check all steps again and Zabbix agentd log/PostgreSQL log. 73 | 74 | - import XML template into web monitoring and link template with target host 75 | 76 | - adjust predefined template macros where needed. Either on a per host setting or globally for the template. 77 | - PG_CONNINFO - connection settings for Zabbix agent connections to the PostgreSQL service 78 | - PG_CONNINFO_STANDBY - connection settings for Zabbix agent connections to the PostgreSQL service on standby servers, required for streaming replication lag monitoring 79 | - PG_CACHE_HIT_RATIO - shared buffers cache ratio 80 | - PG_CHECKPOINTS_REQ_THRESHOLD - threshold for checkpoints which occurred by demand 81 | - PG_CONFLICTS_THRESHOLD - threshold for recovery conflicts trigger 82 | - PG_CONN_IDLE_IN_TRANSACTION - threshold for connections which are idle in transaction state 83 | - PG_CONN_TOTAL_PCT - the percentage of the total number of connections to the maximum allowed (`max_connections`) 84 | - PG_CONN_WAITING - threshold for connections which are in waiting state 85 | - PG_DATABASE_SIZE_THRESHOLD - threshold for database size 86 | - PG_DEADLOCKS_THRESHOLD - threshold for deadlock conflicts trigger 87 | - PG_LONG_QUERY_THRESHOLD - threshold for long transactions trigger 88 | - PG_PING_THRESHOLD_MS - threshold for PostgreSQL service response 89 | - PG_SR_LAG_BYTE - threshold in bytes for streaming replication lag between server and discovered standby servers 90 | - PG_SR_LAG_SEC - threshold in seconds for streaming replication lag between server and discovered standby servers 91 | - PG_UPTIME_THRESHOLD - threshold for service uptime 92 | - PG_PROCESS_NAME - the name of the main PostgreSQL process. Usually `postgres` which is the default value. Change if your system uses a different process name (e.g. the deprecated `postmaster` alias) 93 | 94 | - add additional items into template if required 95 | 96 | ## Graph descriptions 97 | - PostgreSQL bgwriter - information about buffers, how much allocated and written 98 | - PostgreSQL buffers - general information about shared buffers: how much cleaned, dirtied, used and total 99 | - PostgreSQL checkpoints - checkpoints and write/sync time during checkpoints 100 | - PostgreSQL connections - connection info (idle, active, waiting, idle in transaction) 101 | - PostgreSQL service response - service response, average query time (extension `pg_stat_statements` required) 102 | - PostgreSQL summary db stats: block hit/read - information about how much blocks read from disk or cache 103 | - PostgreSQL summary db stats: events - commits and rollbacks, recovery conflicts and deadlocks 104 | - PostgreSQL summary db stats: temp files - information about allocated temporary files 105 | - PostgreSQL summary db stats: tuples - how much tuples inserted/deleted/updated/fetched/returned 106 | - PostgreSQL transactions - max execution time for active/idle/waiting/prepared transactions 107 | - PostgreSQL uptime - cache hit ratio and uptime 108 | - PostgreSQL write-ahead log - information about amount of WAL write and WAL segments count 109 | - PostgreSQL database size - per-database graph with database size 110 | - PostgreSQL table read stat - information about how much block of table or index read from disk or cache (per-table) 111 | - PostgreSQL table rows - how much tuples inserted/updated/deleted per second (per-table) 112 | - PostgreSQL table scans - sequential/index scans and how many rows returned by these scans (per-table) 113 | - PostgreSQL table size - table and table's indexes size (per-table) 114 | - PostgreSQL streaming replication lag with standby - streaming replication between master and standby in bytes and seconds (per-standby) 115 | 116 | ## Known issues 117 | - Table low-level discovery requires manual specification of a list of tables to find, otherwise LLD generates many items (21 items per table) 118 | 119 | ## Authors 120 | Modernization and adaption for recent software version by Stephan Knauß. 121 | 122 | Based on work by Alexey Lesovsky and PR by various others. 123 | For details see the git version log. 124 | -------------------------------------------------------------------------------- /files/postgresql/postgresql.conf: -------------------------------------------------------------------------------- 1 | # Background writer statistics. https://www.postgresql.org/docs/9.6/static/monitoring-stats.html 2 | UserParameter=pgsql.bgwriter[*],psql -qAtX $1 -c "SELECT row_to_json(j) FROM (SELECT checkpoints_timed, checkpoints_req, checkpoint_write_time, checkpoint_sync_time, current_setting('block_size')::int*buffers_checkpoint AS buffers_checkpoint, current_setting('block_size')::int*buffers_clean AS buffers_clean, maxwritten_clean, current_setting('block_size')::int*buffers_backend AS buffers_backend, buffers_backend_fsync, current_setting('block_size')::int*buffers_alloc AS buffers_alloc FROM pg_stat_bgwriter) AS j" 3 | 4 | # pg_buffercache - extension which allow examining what's happening in the shared buffer cache in real time. https://www.postgresql.org/docs/9.6/static/pgbuffercache.html 5 | UserParameter=pgsql.buffercache[*],psql -qAtX $1 -c "SELECT row_to_json(j) FROM (SELECT current_setting('block_size')::int*count(*) AS total, current_setting('block_size')::int*sum(CASE WHEN isdirty THEN 1 ELSE 0 END) AS dirty, current_setting('block_size')::int*sum(CASE WHEN isdirty THEN 0 ELSE 1 END) AS clear, current_setting('block_size')::int*sum(CASE WHEN reldatabase IS NOT NULL THEN 1 ELSE 0 END) AS used, current_setting('block_size')::int*sum(CASE WHEN usagecount>=3 THEN 1 ELSE 0 END) AS popular FROM pg_buffercache) AS j" 6 | 7 | # General info 8 | UserParameter=pgsql.ping[*],/bin/echo -e "\\\timing \n select 1" | psql -qAtX $1 | tail -n 1 |cut -d' ' -f2|sed 's/,/./' 9 | UserParameter=pgsql.uptime[*],psql -qAtX $1 -c "select date_part('epoch', now() - pg_postmaster_start_time())::int" 10 | UserParameter=pgsql.cache.hit[*],psql -qAtX $1 -c "select round(sum(blks_hit)*100/sum(blks_hit+blks_read), 2) from pg_stat_database" 11 | 12 | # Connections 13 | UserParameter=pgsql.connections[*],if [ "$(psql -qAtX $1 -c 'show server_version_num')" -ge "090600" ]; then psql -qAtX $1 -c "SELECT row_to_json(j) FROM (select sum(CASE WHEN state = 'active' THEN 1 ELSE 0 END) AS active, sum(CASE WHEN state = 'idle' THEN 1 ELSE 0 END) AS idle, sum(CASE WHEN state = 'idle in transaction' THEN 1 ELSE 0 END) AS idle_in_transaction, count(*) AS total, count(*)*100/(select current_setting('max_connections')::int) AS total_pct, sum(CASE WHEN wait_event is not null THEN 1 ELSE 0 END) AS waiting from pg_stat_activity) AS j"; else psql -qAtX $1 -c "SELECT row_to_json(j) FROM (select sum(CASE WHEN state = 'active' THEN 1 ELSE 0 END) AS active, sum(CASE WHEN state = 'idle' THEN 1 ELSE 0 END) AS idle, sum(CASE WHEN state = 'idle in transaction' THEN 1 ELSE 0 END) AS idle_in_transaction, count(*) AS total, count(*)*100/(select current_setting('max_connections')::int) AS total_pct, sum(CASE WHEN waiting IS TRUE THEN 1 ELSE 0 END) AS waiting from pg_stat_activity) AS j"; fi 14 | UserParameter=pgsql.connections.prepared[*],psql -qAtX $1 -c "select count(*) from pg_prepared_xacts" 15 | 16 | # Size of database, table or indexes of specified table 17 | UserParameter=pgsql.db.size[*],psql -qAtX $1 -c "select pg_database_size('$2')" 18 | UserParameter=pgsql.table.size[*],psql -qAtX $1 -c "select pg_relation_size('$2')" 19 | UserParameter=pgsql.index.size[*],psql -qAtX $1 -c "select pg_total_relation_size('$2') - pg_relation_size('$2')" 20 | 21 | # Summary database statistics 22 | UserParameter=pgsql.dbstat.sum[*],psql -qAtX $1 -c "SELECT row_to_json(j) FROM (SELECT sum(numbackends) AS numbackends, sum(xact_commit) AS xact_commit, sum(xact_rollback) AS xact_rollback, sum(blks_read) AS blks_read, sum(blks_hit) AS blks_hit, sum(tup_returned) AS tup_returned, sum(tup_fetched) AS tup_fetched, sum(tup_inserted) AS tup_inserted, sum(tup_updated) AS tup_updated, sum(tup_deleted) AS tup_deleted, sum(conflicts) AS conflicts, sum(temp_files) AS temp_files, sum(temp_bytes) AS temp_bytes, sum(deadlocks) AS deadlocks FROM pg_stat_database) AS j" 23 | 24 | # Specified database statistics 25 | UserParameter=pgsql.dbstat.numbackends[*],psql -qAtX $1 -c "select numbackends from pg_stat_database where datname = '$2'" 26 | UserParameter=pgsql.dbstat.xact_commit[*],psql -qAtX $1 -c "select xact_commit from pg_stat_database where datname = '$2'" 27 | UserParameter=pgsql.dbstat.xact_rollback[*],psql -qAtX $1 -c "select xact_rollback from pg_stat_database where datname = '$2'" 28 | UserParameter=pgsql.dbstat.blks_read[*],psql -qAtX $1 -c "select blks_read from pg_stat_database where datname = '$2'" 29 | UserParameter=pgsql.dbstat.blks_hit[*],psql -qAtX $1 -c "select blks_hit from pg_stat_database where datname = '$2'" 30 | UserParameter=pgsql.dbstat.tup_returned[*],psql -qAtX $1 -c "select tup_returned from pg_stat_database where datname = '$2'" 31 | UserParameter=pgsql.dbstat.tup_fetched[*],psql -qAtX $1 -c "select tup_fetched from pg_stat_database where datname = '$2'" 32 | UserParameter=pgsql.dbstat.tup_inserted[*],psql -qAtX $1 -c "select tup_inserted from pg_stat_database where datname = '$2'" 33 | UserParameter=pgsql.dbstat.tup_updated[*],psql -qAtX $1 -c "select tup_updated from pg_stat_database where datname = '$2'" 34 | UserParameter=pgsql.dbstat.tup_deleted[*],psql -qAtX $1 -c "select tup_deleted from pg_stat_database where datname = '$2'" 35 | UserParameter=pgsql.dbstat.conflicts[*],psql -qAtX $1 -c "select conflicts from pg_stat_database where datname = '$2'" 36 | UserParameter=pgsql.dbstat.temp_files[*],psql -qAtX $1 -c "select temp_files from pg_stat_database where datname = '$2'" 37 | UserParameter=pgsql.dbstat.temp_bytes[*],psql -qAtX $1 -c "select temp_bytes from pg_stat_database where datname = '$2'" 38 | UserParameter=pgsql.dbstat.deadlocks[*],psql -qAtX $1 -c "select deadlocks from pg_stat_database where datname = '$2'" 39 | 40 | # Table statistics (pg_stat_user_tables and pg_statio_user_tables) 41 | UserParameter=pgsql.table.stat.heap_blks_read[*],psql -qAtX $1 -c "select coalesce(heap_blks_read,0) from pg_statio_user_tables where (schemaname || '.' || relname) = '$2'" 42 | UserParameter=pgsql.table.stat.heap_blks_hit[*],psql -qAtX $1 -c "select coalesce(heap_blks_hit,0) from pg_statio_user_tables where (schemaname || '.' || relname) = '$2'" 43 | UserParameter=pgsql.table.stat.idx_blks_read[*],psql -qAtX $1 -c "select coalesce(idx_blks_read,0) from pg_statio_user_tables where (schemaname || '.' || relname) = '$2'" 44 | UserParameter=pgsql.table.stat.idx_blks_hit[*],psql -qAtX $1 -c "select coalesce(idx_blks_hit,0) from pg_statio_user_tables where (schemaname || '.' || relname) = '$2'" 45 | UserParameter=pgsql.table.stat.toast_blks_read[*],psql -qAtX $1 -c "select coalesce(toast_blks_read,0) from pg_statio_user_tables where (schemaname || '.' || relname) = '$2'" 46 | UserParameter=pgsql.table.stat.toast_blks_hit[*],psql -qAtX $1 -c "select coalesce(toast_blks_hit,0) from pg_statio_user_tables where (schemaname || '.' || relname) = '$2'" 47 | UserParameter=pgsql.table.stat.tidx_blks_read[*],psql -qAtX $1 -c "select coalesce(tidx_blks_read,0) from pg_statio_user_tables where (schemaname || '.' || relname) = '$2'" 48 | UserParameter=pgsql.table.stat.tidx_blks_hit[*],psql -qAtX $1 -c "select coalesce(tidx_blks_hit,0) from pg_statio_user_tables where (schemaname || '.' || relname) = '$2'" 49 | 50 | UserParameter=pgsql.table.stat.seq_scan[*],psql -qAtX $1 -c "select coalesce(seq_scan,0) from pg_stat_user_tables where (schemaname || '.' || relname) = '$2'" 51 | UserParameter=pgsql.table.stat.seq_tup_read[*],psql -qAtX $1 -c "select coalesce(seq_tup_read,0) from pg_stat_user_tables where (schemaname || '.' || relname) = '$2'" 52 | UserParameter=pgsql.table.stat.idx_scan[*],psql -qAtX $1 -c "select coalesce(idx_scan,0) from pg_stat_user_tables where (schemaname || '.' || relname) = '$2'" 53 | UserParameter=pgsql.table.stat.idx_tup_fetch[*],psql -qAtX $1 -c "select coalesce(idx_tup_fetch,0) from pg_stat_user_tables where (schemaname || '.' || relname) = '$2'" 54 | UserParameter=pgsql.table.stat.n_tup_ins[*],psql -qAtX $1 -c "select coalesce(n_tup_ins,0) from pg_stat_user_tables where (schemaname || '.' || relname) = '$2'" 55 | UserParameter=pgsql.table.stat.n_tup_del[*],psql -qAtX $1 -c "select coalesce(n_tup_del,0) from pg_stat_user_tables where (schemaname || '.' || relname) = '$2'" 56 | UserParameter=pgsql.table.stat.n_tup_upd[*],psql -qAtX $1 -c "select coalesce(n_tup_upd,0) from pg_stat_user_tables where (schemaname || '.' || relname) = '$2'" 57 | UserParameter=pgsql.table.stat.n_tup_hot_upd[*],psql -qAtX $1 -c "select coalesce(n_tup_hot_upd,0) from pg_stat_user_tables where (schemaname || '.' || relname) = '$2'" 58 | UserParameter=pgsql.table.stat.n_live_tup[*],psql -qAtX $1 -c "select coalesce(n_live_tup,0) from pg_stat_user_tables where (schemaname || '.' || relname) = '$2'" 59 | UserParameter=pgsql.table.stat.n_dead_tup[*],psql -qAtX $1 -c "select coalesce(n_dead_tup,0) from pg_stat_user_tables where (schemaname || '.' || relname) = '$2'" 60 | UserParameter=pgsql.table.stat.vacuum_count[*],psql -qAtX $1 -c "select coalesce(vacuum_count,0) from pg_stat_user_tables where (schemaname || '.' || relname) = '$2'" 61 | UserParameter=pgsql.table.stat.autovacuum_count[*],psql -qAtX $1 -c "select coalesce(autovacuum_count,0) from pg_stat_user_tables where (schemaname || '.' || relname) = '$2'" 62 | UserParameter=pgsql.table.stat.analyze_count[*],psql -qAtX $1 -c "select coalesce(analyze_count,0) from pg_stat_user_tables where (schemaname || '.' || relname) = '$2'" 63 | UserParameter=pgsql.table.stat.autoanalyze_count[*],psql -qAtX $1 -c "select coalesce(autoanalyze_count,0) from pg_stat_user_tables where (schemaname || '.' || relname) = '$2'" 64 | 65 | 66 | # Streaming replication 67 | UserParameter=pgsql.streaming.count[*],psql -qAtX $1 -c "select count(*) from pg_stat_replication" 68 | UserParameter=pgsql.streaming.state[*],psql -qAtX $1 -c "select pg_is_in_recovery()" 69 | UserParameter=pgsql.streaming.lag.bytes[*],if [ "$(psql -qAtX $1 -c 'show server_version_num')" -ge "100000" ]; then psql -qAtX $1 -c "select greatest(0,pg_wal_lsn_diff(pg_current_wal_lsn(), replay_lsn)) from pg_stat_replication where client_addr = '$2'"; else psql -qAtX $1 -c "select greatest(0,pg_xlog_location_diff(pg_current_xlog_location(), replay_location)) from pg_stat_replication where client_addr = '$2'"; fi 70 | UserParameter=pgsql.streaming.lag.seconds[*],if [ "$(psql -qAtX $1 -c 'show server_version_num')" -ge "100000" ]; then psql -qAtX -h $2 $1 -c "SELECT CASE WHEN pg_last_wal_receive_lsn() = pg_last_wal_replay_lsn() THEN 0 ELSE EXTRACT (EPOCH FROM now() - pg_last_xact_replay_timestamp()) END"; else psql -qAtX -h $2 $1 -c "SELECT CASE WHEN pg_last_xlog_receive_location() = pg_last_xlog_replay_location() THEN 0 ELSE EXTRACT (EPOCH FROM now() - pg_last_xact_replay_timestamp()) END"; fi 71 | 72 | # Transactions 73 | UserParameter=pgsql.transactions.idle[*],psql -qAtX $1 -c "select coalesce(extract(epoch from max(age(now(), xact_start))), 0) from pg_stat_activity where state='idle in transaction'" 74 | UserParameter=pgsql.transactions.active[*],psql -qAtX $1 -c "select coalesce(extract(epoch from max(age(now(), xact_start))), 0) from pg_stat_activity where state='active' and query NOT LIKE 'autovacuum: %'" 75 | UserParameter=pgsql.transactions.waiting[*],if [ "$(psql -qAtX $1 -c 'show server_version_num')" -ge "090600" ]; then psql -qAtX $1 -c "select coalesce(extract(epoch from max(age(now(), xact_start))), 0) from pg_stat_activity where wait_event is not null"; else psql -qAtX $1 -c "select coalesce(extract(epoch from max(age(now(), xact_start))), 0) from pg_stat_activity where waiting IS TRUE"; fi 76 | UserParameter=pgsql.transactions.prepared[*],psql -qAtX $1 -c "select coalesce(extract(epoch from max(age(now(), prepared))), 0) from pg_prepared_xacts" 77 | 78 | # pg_stat_statements 79 | UserParameter=pgsql.pgstatstatements.avg_query_time[*],psql -qAtX $1 -c "select round((sum(total_time) / sum(calls))::numeric,2) from pg_stat_statements" 80 | 81 | # Others 82 | UserParameter=pgsql.table.tuples[*],psql -qAtX $1 -c "select count(*) from $2" 83 | UserParameter=pgsql.config[*],psql -qAtX $1 -c "select json_build_object('extensions',(select array_agg(extname) from (select extname from pg_extension order by extname) as e),'settings', (select json_object(array_agg(name),array_agg(setting)) from (select name,setting from pg_settings where name != 'application_name' AND name != 'server_version' AND name != 'server_version_num' order by name) as s));" 84 | UserParameter=pgsql.trigger[*],psql -qAtX $1 -c "select count(*) from pg_trigger where tgenabled='O' and tgname='$2'" 85 | UserParameter=pgsql.wal.write[*],if [ "$(psql -qAtX $1 -c 'show server_version_num')" -ge "100000" ]; then psql -qAtX $1 -c "select pg_wal_lsn_diff(pg_current_wal_lsn(),'0/00000000')"; else psql -qAtX $1 -c "select pg_xlog_location_diff(pg_current_xlog_location(),'0/00000000')"; fi 86 | UserParameter=pgsql.wal.count[*],if [ "$(psql -qAtX $1 -c 'show server_version_num')" -ge "100000" ]; then psql -qAtX $1 -c "select count(*) from pg_ls_waldir()"; else psql -qAtX $1 -c "select count(*) from pg_ls_dir('pg_xlog')"; fi 87 | 88 | # Discovery 89 | UserParameter=pgsql.db.discovery[*],/bin/echo -n '{"data":['; for db in $(psql -qAtX $1 -c "select datname from pg_database where not datistemplate and datallowconn and datname!='postgres'"); do /bin/echo -n "{\"{#DBNAME}\": \"$db\"},"; done |sed -e 's:,$::'; /bin/echo -n ']}' 90 | UserParameter=pgsql.table.discovery[*],/bin/echo -n '{"data":['; for table in $(psql -qAtX -F. $1 -c "select n.nspname,c.relname from pg_catalog.pg_class c left join pg_catalog.pg_namespace n on n.oid = c.relnamespace where c.relkind in ('r','s','') and n.nspname not in ('^pg_toast','information_schema','pg_catalog')"); do /bin/echo -n "{\"{#TABLENAME}\": \"$table\"},"; done |sed -e 's:\},$:\}:'; /bin/echo -n ']}' 91 | UserParameter=pgsql.streaming.discovery[*],/bin/echo -n '{"data":['; for replica in $(psql -qAtX $1 -c "select client_addr from pg_stat_replication"); do /bin/echo -n "{\"{#HOTSTANDBY}\": \"$replica\"},"; done |sed -e 's:,$::'; /bin/echo -n ']}' 92 | -------------------------------------------------------------------------------- /files/redis/README.md: -------------------------------------------------------------------------------- 1 | Redis - advanced key-value store. 2 | -------------------------------------------------------------------------------- /files/redis/redis.conf: -------------------------------------------------------------------------------- 1 | # total keys amount among all databases 2 | UserParameter=redis.keys,redis-cli info |grep -E -o 'keys=[0-9]+' |awk -F= '{sum += $2} END {print sum}' 3 | # info statistics 4 | UserParameter=redis.stat[*],redis-cli info |grep -w $1 |cut -d: -f2 5 | # get raw data from redis 6 | UserParameter=redis.raw[*],redis-cli --raw $1 $2 7 | UserParameter=redis.discovery[*],/usr/libexec/zabbix-extensions/scripts/redis.discovery.sh $1 $2 8 | -------------------------------------------------------------------------------- /files/redis/scripts/redis.discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: Get values stored in Redis keys 4 | 5 | getValues=$(redis-cli --raw $1 $2) 6 | 7 | echo -n '{"data":[' 8 | for value in $getValues; do echo -n "{\"{#VALUE}\": \"$value\"},"; done |sed -e 's:\},$:\}:' 9 | echo -n ']}' 10 | -------------------------------------------------------------------------------- /files/skytools/scripts/skytools.pgqd.queue.discovery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: PGQ queues auto-discovery 4 | 5 | username=$(head -n 1 ~zabbix/.pgpass |cut -d: -f4) 6 | 7 | #если имя базы не получено от сервера, то имя берется из ~zabbix/.pgpass 8 | if [ -z "$*" ]; 9 | then 10 | if [ ! -f ~zabbix/.pgpass ]; then echo "ERROR: ~zabbix/.pgpass not found" ; exit 1; fi 11 | dbname=$(head -n 1 ~zabbix/.pgpass |cut -d: -f3); 12 | else 13 | dbname="$1" 14 | fi 15 | 16 | queuelist=$(psql -qAtX -h localhost -U $username $dbname -c "select pgq.get_queue_info()" |cut -d, -f1 |tr -d \() 17 | 18 | echo -n '{"data":[' 19 | for queue in $queuelist; do echo -n "{\"{#QNAME}\": \"$queue\"},"; done |sed -e 's:\},$:\}:' 20 | echo -n ']}' 21 | -------------------------------------------------------------------------------- /files/skytools/scripts/skytools.pgqd.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: queue and consumers info 4 | # $1 - queue name, $2 - param 5 | 6 | username=$(head -n 1 ~zabbix/.pgpass |cut -d: -f4) 7 | 8 | #если имя базы не получено от сервера, то имя берется из ~zabbix/.pgpass 9 | if [ "$#" -lt 3 ]; 10 | then 11 | if [ ! -f ~zabbix/.pgpass ]; then echo "ERROR: ~zabbix/.pgpass not found" ; exit 1; fi 12 | dbname=$(head -n 1 ~zabbix/.pgpass |cut -d: -f3); 13 | else 14 | dbname="$3" 15 | fi 16 | # определяем какую харакетристику будем искать 17 | PARAM="$2" 18 | 19 | case "$PARAM" in 20 | 'length' ) 21 | q="select pending_events from pgq.get_consumer_info() where queue_name = '$1'" 22 | ;; 23 | 'lag' ) 24 | q="select extract(epoch from lag) from pgq.get_consumer_info() where queue_name = '$1'" 25 | ;; 26 | 'last_seen' ) 27 | q="select extract(epoch from last_seen) from pgq.get_consumer_info() where queue_name = '$1'" 28 | ;; 29 | 'ev_per_sec' ) 30 | q="select ev_per_sec from pgq.get_queue_info() where queue_name = '$1'" 31 | ;; 32 | * ) echo ZBX_NOTSUPPORTED; exit 1;; 33 | esac 34 | 35 | r=$(psql -h localhost -p 5432 -tA -U "$username" "$dbname" -c "$q" |head -n 1) 36 | [[ -z "$r" ]] && echo 0 || echo $r 37 | -------------------------------------------------------------------------------- /files/skytools/skytools-template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-06-20T08:49:56Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 318 | 319 | 320 | 321 | {Skytools-Template:proc.num[pgqd].last(0)}=0 322 | No running pgqd instances on {HOSTNAME} 323 | 324 | 0 325 | 5 326 | 327 | 0 328 | 329 | 330 | 331 | 332 | -------------------------------------------------------------------------------- /files/skytools/skytools.conf: -------------------------------------------------------------------------------- 1 | UserParameter=skytools.pgqd.queue.discovery,/usr/libexec/zabbix-extensions/scripts/skytools.pgqd.queue.discovery.sh 2 | UserParameter=skytools.pgqd[*],/usr/libexec/zabbix-extensions/scripts/skytools.pgqd.sh $1 $2 3 | -------------------------------------------------------------------------------- /files/sphinx2/sphinx2-template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-06-20T12:52:10Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 304 | 305 | 306 | 307 | {Sphinx2-Template:proc.num[searchd].last(0)}=0 308 | No running Searchd instances on {HOSTNAME} 309 | 310 | 0 311 | 5 312 | 313 | 0 314 | 315 | 316 | 317 | {Sphinx2-Template:sphinx2.uptime.last(0)}<600 318 | Sphinx2 searchd has just been restarted on {HOSTNAME} 319 | 320 | 0 321 | 1 322 | 323 | 0 324 | 325 | 326 | 327 | 328 | 329 | Searchd: Commands 330 | 900 331 | 200 332 | 0.0000 333 | 100.0000 334 | 1 335 | 1 336 | 0 337 | 1 338 | 0 339 | 0.0000 340 | 0.0000 341 | 1 342 | 0 343 | 0 344 | 0 345 | 346 | 347 | 1 348 | 2 349 | BB0000 350 | 0 351 | 2 352 | 0 353 | 354 | Sphinx2-Template 355 | sphinx2.cmd_update 356 | 357 | 358 | 359 | 0 360 | 5 361 | 0000BB 362 | 0 363 | 2 364 | 0 365 | 366 | Sphinx2-Template 367 | sphinx2.cmd_search 368 | 369 | 370 | 371 | 372 | 373 | Searchd: Connections and queries 374 | 900 375 | 200 376 | 0.0000 377 | 100.0000 378 | 1 379 | 1 380 | 0 381 | 1 382 | 0 383 | 0.0000 384 | 0.0000 385 | 1 386 | 0 387 | 0 388 | 0 389 | 390 | 391 | 1 392 | 0 393 | 0000BB 394 | 0 395 | 2 396 | 0 397 | 398 | Sphinx2-Template 399 | sphinx2.queries 400 | 401 | 402 | 403 | 0 404 | 0 405 | 00BB00 406 | 0 407 | 2 408 | 0 409 | 410 | Sphinx2-Template 411 | sphinx2.connections 412 | 413 | 414 | 415 | 416 | 417 | Searchd: Memory usage 418 | 900 419 | 200 420 | 0.0000 421 | 100.0000 422 | 1 423 | 1 424 | 0 425 | 1 426 | 0 427 | 0.0000 428 | 0.0000 429 | 0 430 | 0 431 | 0 432 | 0 433 | 434 | 435 | 0 436 | 0 437 | 00BB00 438 | 0 439 | 2 440 | 0 441 | 442 | Sphinx2-Template 443 | proc.mem[searchd] 444 | 445 | 446 | 447 | 448 | 449 | 450 | -------------------------------------------------------------------------------- /files/sphinx2/sphinx2.conf: -------------------------------------------------------------------------------- 1 | # Get internal sphinx2 statistics 2 | UserParameter=sphinx2.uptime,mysql -s -h 127.0.0.1 -P 9306 -e "show status" |grep -w ^uptime |awk '{print $2}' 3 | UserParameter=sphinx2.connections,mysql -s -h 127.0.0.1 -P 9306 -e "show status" |grep -w ^connections |awk '{print $2}' 4 | UserParameter=sphinx2.cmd_search,mysql -s -h 127.0.0.1 -P 9306 -e "show status" |grep -w ^command_search |awk '{print $2}' 5 | UserParameter=sphinx2.cmd_update,mysql -s -h 127.0.0.1 -P 9306 -e "show status" |grep -w ^command_update |awk '{print $2}' 6 | UserParameter=sphinx2.queries,mysql -s -h 127.0.0.1 -P 9306 -e "show status" |grep -w ^queries |awk '{print $2}' 7 | -------------------------------------------------------------------------------- /files/testcookie/testcookie.conf: -------------------------------------------------------------------------------- 1 | UserParameter=testcookie.top[*],if [[ -z $(cat $1) ]]; then echo 0; else tail -n1 $1 |awk '{print $$1}'; fi 2 | -------------------------------------------------------------------------------- /files/unicorn/unicorn.conf: -------------------------------------------------------------------------------- 1 | # Author: Lesovsky A.V. 2 | UserParameter=unicorn.rsz,ps h -C unicorn_rails -C unicorn -o rsz |paste -sd+ |bc 3 | UserParameter=unicorn.rsz.bigest,ps h -C unicorn_rails -C unicorn -o rsz |sort -rnk1 |head -n 1 4 | UserParameter=unicorn.rsz.smallest,ps h -C unicorn_rails -C unicorn -o rsz,cmd |cut -d' ' -f1 |sort -rnk1 |tail -n 1 5 | UserParameter=unicorn.rsz.average,echo \($(ps h -C unicorn_rails -C unicorn -o rsz |paste -sd+)\)\/$(ps h -C unicorn_rails -C unicorn -o vsz |wc -l) |bc 6 | 7 | UserParameter=unicorn.vsz,ps h -C unicorn_rails -C unicorn -o vsz |paste -sd+ |bc 8 | UserParameter=unicorn.vsz.bigest,ps h -C unicorn_rails -C unicorn -o vsz |sort -rnk1 |head -n 1 9 | UserParameter=unicorn.vsz.smallest,ps h -C unicorn_rails -C unicorn -o vsz,cmd |cut -d' ' -f1 |sort -rnk1 |tail -n 1 10 | UserParameter=unicorn.vsz.average,echo \($(ps h -C unicorn_rails -C unicorn -o vsz |paste -sd+)\)\/$(ps h -C unicorn_rails -C unicorn -o vsz |wc -l) |bc 11 | 12 | UserParameter=unicorn.response[*],curl -s -H "Host: $(grep -w ^HOST /home/$(grep ^UNICORN_USER /etc/conf.d/unicorn |cut -d\" -f2)/current/config/hosts.rb |cut -d\" -f2)" -I http://$1:$2/status |head -n 1 |cut -d' ' -f2 13 | -------------------------------------------------------------------------------- /files/yum-security/README.md: -------------------------------------------------------------------------------- 1 | Yum security - provide information about security related software updates in RHEL-based distros. 2 | - Based on yum-plugin-security and zabbix-sender; 3 | - cron-defined task execution; 4 | - collects information and sends it to the zabbix server; 5 | - no UserParameters on agent-side 6 | -------------------------------------------------------------------------------- /files/yum-security/yum-security-template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2014-06-18T05:52:48Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 325 | 326 | 327 | 328 | RH Updates: issues 329 | 900 330 | 200 331 | 0.0000 332 | 0.0000 333 | 0 334 | 0 335 | 2 336 | 1 337 | 0 338 | 0.0000 339 | 0.0000 340 | 0 341 | 0 342 | 0 343 | 0 344 | 345 | 346 | 5 347 | 0 348 | DD00DD 349 | 0 350 | 2 351 | 0 352 | 353 | RHEL-Updates-Template 354 | rh.updates.enh 355 | 356 | 357 | 358 | 3 359 | 0 360 | 00C8C8 361 | 0 362 | 2 363 | 0 364 | 365 | RHEL-Updates-Template 366 | rh.updates.low 367 | 368 | 369 | 370 | 4 371 | 0 372 | BBBB00 373 | 0 374 | 2 375 | 0 376 | 377 | RHEL-Updates-Template 378 | rh.updates.bugfix 379 | 380 | 381 | 382 | 1 383 | 0 384 | 0000BB 385 | 0 386 | 2 387 | 0 388 | 389 | RHEL-Updates-Template 390 | rh.updates.imp 391 | 392 | 393 | 394 | 0 395 | 0 396 | BB0000 397 | 0 398 | 2 399 | 0 400 | 401 | RHEL-Updates-Template 402 | rh.updates.crit 403 | 404 | 405 | 406 | 2 407 | 0 408 | 00BB00 409 | 0 410 | 2 411 | 0 412 | 413 | RHEL-Updates-Template 414 | rh.updates.mod 415 | 416 | 417 | 418 | 419 | 420 | 421 | -------------------------------------------------------------------------------- /files/yum-security/yum-updates.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Author: Lesovsky A.V. 3 | # Description: yum updates info 4 | 5 | YUM_LOG=/var/log/yum-updates.log 6 | 7 | # Clean up cache & reload to prevent metadata issues 8 | yum clean all -q 2>&1 >> $YUM_LOG 9 | yum makecache -q 2>&1 >> $YUM_LOG 10 | 11 | YUM_RESULT=/tmp/yum-security.out 12 | ZBX_DATA=/tmp/zabbix-sender-yum-data.in 13 | TOTAL_UPDATES=$(yum check-update -q --errorlevel=0 |wc -l) 14 | 15 | sleep 3 16 | 17 | ZBX_HOSTNAME_PRESENT=$(egrep ^Hostname /etc/zabbix/zabbix_agentd.conf -c) 18 | if [ "$ZBX_HOSTNAME_PRESENT" -ge "1" ]; then 19 | ZBX_HOSTNAME=$(egrep ^Hostname /etc/zabbix/zabbix_agentd.conf | cut -d = -f 2) 20 | else 21 | ZBX_HOSTNAME=$(hostname) 22 | fi 23 | 24 | yum list-security -q --errorlevel=0 |awk '{print $2}' |sort |uniq -c > $YUM_RESULT 25 | 26 | low=$(grep 'low/Sec.' $YUM_RESULT |awk '{print $1}') 27 | moderate=$(grep 'moderate/Sec.' $YUM_RESULT |awk '{print $1}') 28 | important=$(grep 'important/Sec.' $YUM_RESULT |awk '{print $1}') 29 | critical=$(grep 'critical/Sec.' $YUM_RESULT |awk '{print $1}') 30 | enhancement=$(grep 'enhancement' $YUM_RESULT |awk '{print $1}') 31 | bugfix=$(grep 'bugfix' $YUM_RESULT |awk '{print $1}') 32 | 33 | [[ ! $low ]] && low=0 34 | [[ ! $moderate ]] && moderate=0 35 | [[ ! $important ]] && important=0 36 | [[ ! $critical ]] && critical=0 37 | [[ ! $enhancement ]] && enhancement=0 38 | [[ ! $bugfix ]] && bugfix=0 39 | 40 | echo -n > $ZBX_DATA 41 | echo "${ZBX_HOSTNAME} rh.updates.enh $enhancement" >> $ZBX_DATA 42 | echo "${ZBX_HOSTNAME} rh.updates.bugfix $bugfix" >> $ZBX_DATA 43 | echo "${ZBX_HOSTNAME} rh.updates.low $low" >> $ZBX_DATA 44 | echo "${ZBX_HOSTNAME} rh.updates.mod $moderate" >> $ZBX_DATA 45 | echo "${ZBX_HOSTNAME} rh.updates.imp $important" >> $ZBX_DATA 46 | echo "${ZBX_HOSTNAME} rh.updates.crit $critical" >> $ZBX_DATA 47 | echo "${ZBX_HOSTNAME} rh.updates.total $TOTAL_UPDATES" >> $ZBX_DATA 48 | 49 | #zabbix_sender -z $ZBX_SERVER -i $ZBX_DATA &>> /var/log/yum-updates.log 50 | zabbix_sender -vv -c /etc/zabbix/zabbix_agentd.conf --tls-connect psk --tls-psk-file /etc/zabbix/zabbix-agent.psk --tls-psk-identity AGENT-PSK-001 -i $ZBX_DATA &>> $YUM_LOG 51 | ZBX_RESULT=`echo $?` 52 | 53 | rm $YUM_RESULT 54 | rm $ZBX_DATA 55 | 56 | echo $ZBX_RESULT 57 | -------------------------------------------------------------------------------- /files/zabbix-server/README.md: -------------------------------------------------------------------------------- 1 | === Zabbix Server Template 2 | 3 | Zabbix server internal monitoring: 4 | - internal write caches usage; 5 | - pollers usage; 6 | - worker processes usage; 7 | - queue monitoring. 8 | 9 | === Installation notes 10 | 11 | - Import template into web frontend. 12 | - Link template with Zabbix server hosts. 13 | -------------------------------------------------------------------------------- /gentoo/Manifest: -------------------------------------------------------------------------------- 1 | AUX zabbix-agentd-conf.d 739 SHA256 aa1dbd61a780fa31669c3d31484b0014dbf24667e6f796c0f099b370620d79f8 SHA512 7e5b875fcbe4544dad3715cced157e227e3de253a4f9339b39352e689627d0fe7c00502034df1919dbff463c8cf8cd0a26fff98e1dcfb45072431f1a862adf0d WHIRLPOOL ccd5e45018ea27d720bec92223e89ef671974aff0c9d85ae16571ba416148b02bce0a2063809b5def852921b6ebb951ca27fff718c6511aa1903329426ffe489 2 | DIST zabbix-extensions-1.tar.gz 41081 SHA256 8f14afe02ed3962af0a932c916bcd49b3da8c91ac92f1b5a47e80eb5f767dfcb SHA512 75e2434d97141ed42b99537783380ef74d9c9476debd5ae15b92c1bc099cd46d9f97c07bd513dd9440c21b2f317dfc14d5595fdb17e8cdd6f659717dec06f2d8 WHIRLPOOL d5d3c664719135374efa1d5db3ec23b2906005db0519643557aa68af421f2185e2cffd5e2685e9ce30c6f11c3519b56adeec6bc748b90f9214856744aa77ce42 3 | DIST zabbix-extensions-2.tar.gz 44828 SHA256 975aa4f65f45030277c02829c11c4724745730fc26d7fe436b682b6386a0c1a2 SHA512 d4b0cde91aa2c7addbe3bb3978578337eac7ed47c1ca81462c82b4ca8ef6749e2e3ee29abc68e19c1499027968c2d58930c4a9288c9b7b525e50a44560850722 WHIRLPOOL 9c99ef9019f1721aa0d9e60a495087450e45b5598d85cdb4335f0a2868a8bfdfd2eda681bf4ec18fafaf1e52f1ad0b27ae5d3ea10540e6f37f599888c87690ff 4 | DIST zabbix-extensions-3.tar.gz 45309 SHA256 8b0274f6ac1d93856a2a5bb748858cb2612f075e7a855302a5537f318f8bd356 SHA512 f93c8a66f43ef963bf05443871db42ed08910a73651768c4e4c1cc3caf2257f3781002d18f0fc6c44670b3b620c22f2682398975fec591a043802349edbfd12d WHIRLPOOL 9a5b92134bdbc5b93a5e1baab917483576be44056264c6cb4706276a3c340b19b05b0876208d6052ba51059d82c78604367ff64b9aff2db72aa730fdd7b4baa7 5 | DIST zabbix-extensions-4.tar.gz 47081 SHA256 fcc2b7a32d24542eb88fef7ca07699f04d48ddc8a100d8ee4753da82882a6e56 SHA512 b7134ab6b9dee7627fbda1905f6e86def51577073429a3aae039b32975708f690fd87f76db1c641f0980faee6b71fdbd3a0d0394b5f6db534446f8b3537f0c01 WHIRLPOOL 9bc533228b33833972d5ef549ea811c0a4ca9691ac65e26a482bdd0c7f8290a68380fb126f1e9e919275cc4763e5a8e63070f201f5a53ee7d04e84ea69136995 6 | DIST zabbix-extensions-5.tar.gz 47646 SHA256 a0efbf6cbb34d3fc618d8ac34f458573504a40e9da5eb7f234f8618232019c1c SHA512 27aa952c33d3db45edf0a058a882a841268fe88b67f988a63a00aa084dc819bffc07f5fe97e7d54d6926ec23df9af094341cb794eeb46800be471fadcdff127a WHIRLPOOL 7d8410d59e8468dae1bbc0f87684f0e895657393cb750bd7394a284a28633b392c88c1b1b3268f4f7fe1026702bdf13dda8cc85e90ec8d364bb27d8f17831266 7 | EBUILD zabbix-extensions-1-r1.ebuild 5677 SHA256 20b4a07402cc05af6d0ae67d6c4465ecc3b5744a6bf127870662a61d2a3532b2 SHA512 c09ce3184b7cb11f2328181e5389bc51c0f400ad4d952849c45f26d99cd7abcb443efc3b8a55c2655096a65c32c38dc2bff4087a2a9a189d230771275ca73b8b WHIRLPOOL 7dad93ec3bed63fa86b06be44121891c32fab80c74ab61fa4b52807327a3e34abd0995629d9ee2e8a0133d093c2498ff0a67985091c094e79af5c2bd0127a016 8 | EBUILD zabbix-extensions-2.ebuild 6220 SHA256 1aff773ccb92d9ab2f28a4710bd824f3733e53f1affdb68141f239383458de61 SHA512 7a2721bd7ba27d29c75b63738a9e359d155ba8171e9fef6d645530acb6131927c5c9aa9b3cd3cb61eb95770aff7c6795d55140354a141577fc8aecdca89368a4 WHIRLPOOL 113c32c60750b9d08175d8907989c2754f0f6be29e750424cadf07e68092c9d332e5f52e46ea6a095ad78cf89f6aa2b738611601949512b359e52e7d5ee60ea7 9 | EBUILD zabbix-extensions-3.ebuild 6230 SHA256 0db62289f39ac4d508606c30eb91a77aa2a82c48afd9b24888b2245cfd72829c SHA512 a87c996fd65bf497d5c6b1ef2f7df0a41a517a9631bf45980da15fa438f030b6895e1f8d733124972c61a8dda7cccd4540811b22939757f8af2c74c807b5d1d9 WHIRLPOOL 81da75116120e8d2e76cba99e8214e4df0705bf7127b7b15d1342732158016a87131faa9df04db3baa7b4edc75692a3145b3e6bcf2e76d85f63ab4303867c0f9 10 | EBUILD zabbix-extensions-4.ebuild 6803 SHA256 6d02d6753556c75d02c355be5469bf9fcd3e8e59e48089efabf9ab5a3b71c968 SHA512 75205723f5ee1cfbc13bec35d6d4d7400e796b34b751bd82576a1ce2c073243a54f53ed0c9908ed563ffb5e4a1a5a98e908d9479534afe08a619aa43cc8da5d5 WHIRLPOOL 3cbb0080bec3150ac5f1d2279b40f88b379c4801338ed1da407d1ea62dd3e7c827ffc86362cebc81675d4f2f7a104938d0893cd07e605cac459551e6190ad666 11 | EBUILD zabbix-extensions-5.ebuild 6883 SHA256 fdc9a977d0bd74fde3db858925f60b5f6abba848d1b04419ec5442c9372b90b7 SHA512 2a9bdde59b0549ef6257f6099c23039d0b6b19c362c0e77a56b1e026f546f674eaccc3b0680823ce1efdee790648a859fde620d6e6bd2e255fe282e1c028c003 WHIRLPOOL 17d706fe8d4ef9fc487e470a401772bd7b7caae06f530ddf3fa4edbef534da5d8841400304039767535d785955541970a3fe4d58af7225f9a1aa80aa877ada95 12 | MISC metadata.xml 1612 SHA256 de7324eb117f74d994fb750b05d27e3e18fc2491b2d9d1677b0b914c8ef85e88 SHA512 65e10c2cf2efb53628ede6182776b9f3b3e4af1956ad51e59132b408f8635d5a09c1bc00c3527bf1e94e9b4aba339e7e97361c83f1fce76949a20e1510dfa054 WHIRLPOOL 25d8d8f955cbb3042de326caaad68cd7ba0fd79a0fb1d12068c9d4a2d7ea595458cf8619465b894d42b5dd48b4f72a3ff7cea5cbe21afba1279b7f5dc7c886a9 13 | -------------------------------------------------------------------------------- /gentoo/files/zabbix-agentd-conf.d: -------------------------------------------------------------------------------- 1 | # Author: Abdulbjarov R. 2 | # Description: Reduce oom_score for zabbix-agentd processes avoid sudden kills by OOMKiller. 3 | 4 | start_post() { 5 | ebegin "adjust OOM score for ${RC_SVCNAME}" 6 | 7 | ewaitfile 5 /var/run/zabbix/zabbix_agentd.pid || return 0 8 | 9 | # Reduce oom_score_adj for master process 10 | PPID_Z="$(cat /var/run/zabbix/zabbix_agentd.pid)" 11 | local FILE_OOM_SCORE_ADJ="/proc/${PPID_Z}/oom_score_adj" 12 | [ -f "${FILE_OOM_SCORE_ADJ}" ] && echo '-1000' > "${FILE_OOM_SCORE_ADJ}" 13 | 14 | # Reduce oom_score_adj for worker processes 15 | for IPID_Z in $(ps --ppid ${PPID_Z} |grep zabbix |awk '{print $1}'); do 16 | echo '-1000' > "/proc/${IPID_Z}/oom_score_adj" 17 | done 18 | 19 | eend $? 20 | return 0 21 | } 22 | -------------------------------------------------------------------------------- /gentoo/metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | lesovsky@gmail.com 6 | Lesovsky Alexey 7 | 8 | 9 | Additional monitoring extensions that can extend the ZABBIX functionality. 10 | This modules written with BASH programming language and requires minimum dependencies. 11 | 12 | 13 | Facebook Flashcache monitoring extension get stats from /proc. 14 | Glusterfs client monitoring, auto-discovery and check mountpoints. 15 | Internal memcached stats through direct connection to the memcached. 16 | PgBouncer internal statistics. 17 | Postfix mail queue. 18 | PostgreSQL statistics based on pg_stat_* tables and other pg-related information. 19 | Redis internal stats and raw data from redis storage via redis-cli. 20 | Sphinx2 internal statistics. 21 | Skytools PGQ queues monitoring via psql. 22 | Unicorn application memory usage, process and application reply. 23 | Gathering Adaptec RAID controllers information via arcconf. 24 | Gathering RAID controllers information via MegaCLI. 25 | Gathering information from SmartArray RAID controllers via hpacucli. 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /gentoo/zabbix-extensions-1-r1.ebuild: -------------------------------------------------------------------------------- 1 | # Copyright 1999-2013 Gentoo Foundation 2 | # Distributed under the terms of the GNU General Public License v2 3 | # $Header: $ 4 | 5 | EAPI=5 6 | inherit eutils 7 | 8 | DESCRIPTION="Zabbix additional monitoring modules" 9 | HOMEPAGE="https://github.com/lesovsky/zabbix-extensions" 10 | ZBX_EXT_GIT_SHA1="11feddc" 11 | ZBX_EXT_GIT_URI="https://github.com/lesovsky/zabbix-extensions/tarball/${ZBX_EXT_GIT_SHA1}" 12 | SRC_URI="${ZBX_EXT_GIT_URI} -> ${P}.tar.gz" 13 | S="${WORKDIR}/lesovsky-zabbix-extensions-${ZBX_EXT_GIT_SHA1}" 14 | 15 | LICENSE="as-is" 16 | SLOT="0" 17 | KEYWORDS="~amd64 ~x86" 18 | IUSE="flashcache glusterfs-client memcached pgbouncer postfix postgres redis sphinx2 skytools unicorn" 19 | 20 | HWRAID="smartarray" 21 | 22 | for name in $HWRAID; do 23 | IUSE="${IUSE} hwraid_${name}" 24 | done 25 | 26 | DEPEND=">=net-analyzer/zabbix-2.0.0 27 | pgbouncer? ( dev-db/postgresql-base ) 28 | postgres? ( dev-db/postgresql-base ) 29 | redis? ( dev-db/redis ) 30 | sphinx2? ( dev-db/mysql ) 31 | skytools? ( dev-db/postgresql-base ) 32 | hwraid_smartarray? ( sys-block/hpacucli ) 33 | unicorn? ( net-misc/curl )" 34 | RDEPEND="${DEPEND}" 35 | 36 | src_install() { 37 | dodir \ 38 | /etc/zabbix/zabbix_agentd.d \ 39 | /etc/zabbix/scripts 40 | 41 | fowners zabbix:zabbix \ 42 | /etc/zabbix/scripts \ 43 | /etc/zabbix/zabbix_agentd.d 44 | fperms 0750 \ 45 | /etc/zabbix/scripts \ 46 | /etc/zabbix/zabbix_agentd.d 47 | 48 | insinto /etc/zabbix/zabbix_agentd.d 49 | doins "files/linux/linux-extended.conf" 50 | insinto /etc/zabbix/scripts/ 51 | doins \ 52 | "files/linux/scripts/check-open-descriptors.sh" \ 53 | "files/linux/scripts/mem-usage.sh" \ 54 | "files/linux/scripts/swap.discovery.sh" 55 | insinto /etc/cron.d 56 | doins "files/linux/zabbix.cron" 57 | 58 | if use redis; then 59 | insinto /etc/zabbix/zabbix_agentd.d 60 | doins "files/redis/redis.conf" 61 | fi 62 | 63 | if use memcached; then 64 | insinto /etc/zabbix/zabbix_agentd.d 65 | doins "files/memcached/memcached.conf" 66 | fi 67 | 68 | if use pgbouncer; then 69 | insinto /etc/zabbix/zabbix_agentd.d 70 | doins "files/pgbouncer/pgbouncer.conf" 71 | insinto /etc/zabbix/scripts/ 72 | doins \ 73 | "files/pgbouncer/scripts/pgbouncer.pool.discovery.sh" \ 74 | "files/pgbouncer/scripts/pgbouncer.stat.sh" 75 | fi 76 | 77 | if use postfix; then 78 | insinto /etc/zabbix/zabbix_agentd.d 79 | doins "files/postfix/postfix.conf" 80 | fi 81 | 82 | if use postgres; then 83 | insinto /etc/zabbix/zabbix_agentd.d 84 | doins "files/postgresql/postgresql.conf" 85 | insinto /etc/zabbix/scripts/ 86 | doins \ 87 | "files/postgresql/scripts/pgsql.autovacuum.freeze.sh" \ 88 | "files/postgresql/scripts/pgsql.buffercache.sh" \ 89 | "files/postgresql/scripts/pgsql.connections.sh" \ 90 | "files/postgresql/scripts/pgsql.db.discovery.sh" \ 91 | "files/postgresql/scripts/pgsql.db.size.sh" \ 92 | "files/postgresql/scripts/pgsql.dbstat.sh" \ 93 | "files/postgresql/scripts/pgsql.indexes.size.sh" \ 94 | "files/postgresql/scripts/pgsql.pgqd.lag.sh" \ 95 | "files/postgresql/scripts/pgsql.ping.sh" \ 96 | "files/postgresql/scripts/pgsql.relation.size.sh" \ 97 | "files/postgresql/scripts/pgsql.relation.stat.sh" \ 98 | "files/postgresql/scripts/pgsql.relation.tuples.sh" \ 99 | "files/postgresql/scripts/pgsql.streaming.lag.sh" \ 100 | "files/postgresql/scripts/pgsql.transactions.sh" \ 101 | "files/postgresql/scripts/pgsql.uptime.sh" \ 102 | "files/postgresql/scripts/pgsql.trigger.sh" \ 103 | "files/postgresql/scripts/pgsql.wal.write.sh" 104 | fi 105 | 106 | if use glusterfs-client; then 107 | insinto /etc/zabbix/zabbix_agentd.d 108 | doins "files/glusterfs-client/glusterfs.conf" 109 | insinto /etc/zabbix/scripts/ 110 | doins \ 111 | "files/glusterfs-client/scripts/glusterfs.discovery.sh" 112 | fi 113 | 114 | if use flashcache; then 115 | insinto /etc/zabbix/zabbix_agentd.d 116 | doins "files/flashcache/flashcache.conf" 117 | insinto /etc/zabbix/scripts/ 118 | doins \ 119 | "files/flashcache/scripts/flashcache.dm.discovery.sh" \ 120 | "files/flashcache/scripts/flashcache.vol.discovery.sh" 121 | fi 122 | 123 | if use sphinx2; then 124 | insinto /etc/zabbix/zabbix_agentd.d 125 | doins "files/sphinx2/sphinx2.conf" 126 | fi 127 | 128 | if use skytools; then 129 | insinto /etc/zabbix/zabbix_agentd.d 130 | doins "files/skytools/skytools.conf" 131 | insinto /etc/zabbix/scripts/ 132 | doins \ 133 | "files/skytools/scripts/skytools.pgqd.queue.discovery.sh" \ 134 | "files/skytools/scripts/skytools.pgqd.sh" 135 | fi 136 | 137 | if use hwraid_smartarray; then 138 | insinto /etc/zabbix/zabbix_agentd.d 139 | doins "${S}/files/hp-smart-array/hp-raid-smart-array.conf" 140 | insinto /etc/zabbix/scripts/ 141 | doins \ 142 | "files/hp-smart-array/scripts/hp-raid-data-processor.sh" \ 143 | "files/hp-smart-array/scripts/hp-raid-ctrl-discovery.sh" \ 144 | "files/hp-smart-array/scripts/hp-raid-ld-discovery.sh" \ 145 | "files/hp-smart-array/scripts/hp-raid-pd-discovery.sh" 146 | fi 147 | 148 | if use unicorn; then 149 | insinto /etc/zabbix/zabbix_agentd.d 150 | doins "files/unicorn/unicorn.conf" 151 | fi 152 | } 153 | 154 | pkg_postinst() { 155 | chown -R zabbix:zabbix \ 156 | "${ROOT}"/etc/zabbix/scripts/*.sh 157 | chmod 0750 \ 158 | "${ROOT}"/etc/zabbix/scripts/*.sh 159 | 160 | if use postgres || use skytools ; then 161 | elog 162 | elog "For PostgreSQL or Skytools monitoring need setup md5 auth with .pgpass for zabbix user." 163 | elog "For example:" 164 | elog "# echo 'localhost:5432:app_db:app_role:app_pass' > ~zabbix/.pgpass" 165 | elog "# chown zabbix:zabbix ~zabbix/.pgpass" 166 | elog "# chmod 600 ~zabbix/.pgpass" 167 | elog 168 | elog "More explained: http://www.thislinux.org/2012/10/postgresql-monitoring-via-zabbix.html" 169 | elog 170 | fi 171 | 172 | if use hwraid_smartarray; then 173 | elog 174 | elog "SmartArray monitoring extension uses hpacucli, zabbix-sender, and cron task." 175 | elog "Install following crontask into root crontab manually:" 176 | elog "*/10 * * * * /etc/zabbix/scripts/hp-raid-data-processor.sh" 177 | elog 178 | fi 179 | 180 | elog 181 | elog "After installation and before restart zabbix agent," 182 | elog "make sure that the following option enabled in zabbix_agentd.conf:" 183 | elog "Include=/etc/zabbix/zabbix_agentd.d/" 184 | elog 185 | } 186 | -------------------------------------------------------------------------------- /gentoo/zabbix-extensions-2.ebuild: -------------------------------------------------------------------------------- 1 | # Copyright 1999-2013 Gentoo Foundation 2 | # Distributed under the terms of the GNU General Public License v2 3 | # $Header: $ 4 | 5 | EAPI=5 6 | inherit eutils 7 | 8 | DESCRIPTION="Zabbix additional monitoring modules" 9 | HOMEPAGE="https://github.com/lesovsky/zabbix-extensions" 10 | ZBX_EXT_GIT_SHA1="5950a29" 11 | ZBX_EXT_GIT_URI="https://github.com/lesovsky/zabbix-extensions/tarball/${ZBX_EXT_GIT_SHA1}" 12 | SRC_URI="${ZBX_EXT_GIT_URI} -> ${P}.tar.gz" 13 | S="${WORKDIR}/lesovsky-zabbix-extensions-${ZBX_EXT_GIT_SHA1}" 14 | 15 | LICENSE="as-is" 16 | SLOT="0" 17 | KEYWORDS="~amd64 ~x86" 18 | IUSE="flashcache glusterfs-client memcached pgbouncer postfix postgres redis sphinx2 skytools unicorn" 19 | 20 | HWRAID="smartarray megacli" 21 | 22 | for name in $HWRAID; do 23 | IUSE="${IUSE} hwraid_${name}" 24 | done 25 | 26 | DEPEND=">=net-analyzer/zabbix-2.0.0 27 | pgbouncer? ( dev-db/postgresql-base ) 28 | postgres? ( dev-db/postgresql-base ) 29 | redis? ( dev-db/redis ) 30 | sphinx2? ( dev-db/mysql ) 31 | skytools? ( dev-db/postgresql-base ) 32 | hwraid_smartarray? ( sys-block/hpacucli ) 33 | hwraid_megacli? ( app-admin/sudo sys-block/megacli ) 34 | unicorn? ( net-misc/curl )" 35 | RDEPEND="${DEPEND}" 36 | 37 | src_install() { 38 | dodir \ 39 | /etc/zabbix/zabbix_agentd.d \ 40 | /etc/zabbix/scripts 41 | 42 | fowners zabbix:zabbix \ 43 | /etc/zabbix/scripts \ 44 | /etc/zabbix/zabbix_agentd.d 45 | fperms 0755 \ 46 | /etc/zabbix/scripts \ 47 | /etc/zabbix/zabbix_agentd.d 48 | 49 | insinto /etc/zabbix/zabbix_agentd.d 50 | doins "files/linux/linux-extended.conf" 51 | insinto /etc/zabbix/scripts/ 52 | doins \ 53 | "files/linux/scripts/check-open-descriptors.sh" \ 54 | "files/linux/scripts/mem-usage.sh" \ 55 | "files/linux/scripts/swap.discovery.sh" 56 | insinto /etc/cron.d 57 | doins "files/linux/zabbix.cron" 58 | 59 | if use redis; then 60 | insinto /etc/zabbix/zabbix_agentd.d 61 | doins "files/redis/redis.conf" 62 | fi 63 | 64 | if use memcached; then 65 | insinto /etc/zabbix/zabbix_agentd.d 66 | doins "files/memcached/memcached.conf" 67 | fi 68 | 69 | if use pgbouncer; then 70 | insinto /etc/zabbix/zabbix_agentd.d 71 | doins "files/pgbouncer/pgbouncer.conf" 72 | insinto /etc/zabbix/scripts/ 73 | doins \ 74 | "files/pgbouncer/scripts/pgbouncer.pool.discovery.sh" \ 75 | "files/pgbouncer/scripts/pgbouncer.stat.sh" 76 | fi 77 | 78 | if use postfix; then 79 | insinto /etc/zabbix/zabbix_agentd.d 80 | doins "files/postfix/postfix.conf" 81 | fi 82 | 83 | if use postgres; then 84 | insinto /etc/zabbix/zabbix_agentd.d 85 | doins "files/postgresql/postgresql.conf" 86 | insinto /etc/zabbix/scripts/ 87 | doins \ 88 | "files/postgresql/scripts/pgsql.autovacuum.freeze.sh" \ 89 | "files/postgresql/scripts/pgsql.buffercache.sh" \ 90 | "files/postgresql/scripts/pgsql.connections.sh" \ 91 | "files/postgresql/scripts/pgsql.db.discovery.sh" \ 92 | "files/postgresql/scripts/pgsql.db.size.sh" \ 93 | "files/postgresql/scripts/pgsql.dbstat.sh" \ 94 | "files/postgresql/scripts/pgsql.indexes.size.sh" \ 95 | "files/postgresql/scripts/pgsql.pgqd.lag.sh" \ 96 | "files/postgresql/scripts/pgsql.ping.sh" \ 97 | "files/postgresql/scripts/pgsql.relation.size.sh" \ 98 | "files/postgresql/scripts/pgsql.relation.stat.sh" \ 99 | "files/postgresql/scripts/pgsql.relation.tuples.sh" \ 100 | "files/postgresql/scripts/pgsql.streaming.lag.sh" \ 101 | "files/postgresql/scripts/pgsql.transactions.sh" \ 102 | "files/postgresql/scripts/pgsql.uptime.sh" \ 103 | "files/postgresql/scripts/pgsql.trigger.sh" \ 104 | "files/postgresql/scripts/pgsql.wal.write.sh" 105 | fi 106 | 107 | if use glusterfs-client; then 108 | insinto /etc/zabbix/zabbix_agentd.d 109 | doins "files/glusterfs-client/glusterfs.conf" 110 | insinto /etc/zabbix/scripts/ 111 | doins \ 112 | "files/glusterfs-client/scripts/glusterfs.discovery.sh" 113 | fi 114 | 115 | if use flashcache; then 116 | insinto /etc/zabbix/zabbix_agentd.d 117 | doins "files/flashcache/flashcache.conf" 118 | insinto /etc/zabbix/scripts/ 119 | doins \ 120 | "files/flashcache/scripts/flashcache.dm.discovery.sh" \ 121 | "files/flashcache/scripts/flashcache.vol.discovery.sh" 122 | fi 123 | 124 | if use sphinx2; then 125 | insinto /etc/zabbix/zabbix_agentd.d 126 | doins "files/sphinx2/sphinx2.conf" 127 | fi 128 | 129 | if use skytools; then 130 | insinto /etc/zabbix/zabbix_agentd.d 131 | doins "files/skytools/skytools.conf" 132 | insinto /etc/zabbix/scripts/ 133 | doins \ 134 | "files/skytools/scripts/skytools.pgqd.queue.discovery.sh" \ 135 | "files/skytools/scripts/skytools.pgqd.sh" 136 | fi 137 | 138 | if use hwraid_smartarray; then 139 | insinto /etc/zabbix/zabbix_agentd.d 140 | doins "${S}/files/hp-smart-array/hp-raid-smart-array.conf" 141 | insinto /etc/zabbix/scripts/ 142 | doins \ 143 | "files/hp-smart-array/scripts/hp-raid-data-processor.sh" \ 144 | "files/hp-smart-array/scripts/hp-raid-ctrl-discovery.sh" \ 145 | "files/hp-smart-array/scripts/hp-raid-ld-discovery.sh" \ 146 | "files/hp-smart-array/scripts/hp-raid-pd-discovery.sh" 147 | fi 148 | 149 | if use hwraid_megacli; then 150 | insinto /etc/zabbix/zabbix_agentd.d 151 | doins "${S}/files/hwraid-megacli/megacli.conf" 152 | insinto /etc/zabbix/scripts/ 153 | doins \ 154 | "files/hwraid-megacli/scripts/megacli-adp-discovery.sh" \ 155 | "files/hwraid-megacli/scripts/megacli-ld-discovery.sh" \ 156 | "files/hwraid-megacli/scripts/megacli-pd-discovery.sh" \ 157 | "files/hwraid-megacli/scripts/megacli-raid-data-processor.sh" 158 | insinto /etc/cron.d 159 | doins "files/hwraid-megacli/zabbix.megacli" 160 | fi 161 | 162 | if use unicorn; then 163 | insinto /etc/zabbix/zabbix_agentd.d 164 | doins "files/unicorn/unicorn.conf" 165 | fi 166 | } 167 | 168 | pkg_postinst() { 169 | chown -R zabbix:zabbix \ 170 | "${ROOT}"/etc/zabbix/scripts/*.sh 171 | chmod 0755 \ 172 | "${ROOT}"/etc/zabbix/scripts/*.sh 173 | 174 | if use postgres || use skytools ; then 175 | elog 176 | elog "For PostgreSQL or Skytools monitoring need setup md5 auth with .pgpass for zabbix user." 177 | elog "For example:" 178 | elog "# echo 'localhost:5432:app_db:app_role:app_pass' > ~zabbix/.pgpass" 179 | elog "# chown zabbix:zabbix ~zabbix/.pgpass" 180 | elog "# chmod 600 ~zabbix/.pgpass" 181 | elog 182 | elog "More explained: http://www.thislinux.org/2012/10/postgresql-monitoring-via-zabbix.html" 183 | elog 184 | fi 185 | 186 | if use hwraid_smartarray; then 187 | elog 188 | elog "SmartArray monitoring extension uses hpacucli, zabbix-sender, and cron task." 189 | elog "Install following crontask into root crontab manually:" 190 | elog "*/10 * * * * /etc/zabbix/scripts/hp-raid-data-processor.sh" 191 | elog 192 | fi 193 | 194 | elog 195 | elog "After installation and before restart zabbix agent," 196 | elog "make sure that the following option enabled in zabbix_agentd.conf:" 197 | elog "Include=/etc/zabbix/zabbix_agentd.d/" 198 | elog 199 | } 200 | -------------------------------------------------------------------------------- /gentoo/zabbix-extensions-3.ebuild: -------------------------------------------------------------------------------- 1 | # Copyright 1999-2013 Gentoo Foundation 2 | # Distributed under the terms of the GNU General Public License v2 3 | # $Header: $ 4 | 5 | EAPI=5 6 | inherit eutils 7 | 8 | DESCRIPTION="Zabbix additional monitoring modules" 9 | HOMEPAGE="https://github.com/lesovsky/zabbix-extensions" 10 | ZBX_EXT_GIT_SHA1="3e84211" 11 | ZBX_EXT_GIT_URI="https://github.com/lesovsky/zabbix-extensions/tarball/${ZBX_EXT_GIT_SHA1}" 12 | SRC_URI="${ZBX_EXT_GIT_URI} -> ${P}.tar.gz" 13 | S="${WORKDIR}/lesovsky-zabbix-extensions-${ZBX_EXT_GIT_SHA1}" 14 | 15 | LICENSE="as-is" 16 | SLOT="0" 17 | KEYWORDS="~amd64 ~x86" 18 | IUSE="flashcache glusterfs-client memcached pgbouncer postfix postgres redis sphinx2 skytools unicorn" 19 | 20 | HWRAID="smartarray megacli" 21 | 22 | for name in $HWRAID; do 23 | IUSE="${IUSE} hwraid_${name}" 24 | done 25 | 26 | DEPEND=">=net-analyzer/zabbix-2.0.0 27 | pgbouncer? ( dev-db/postgresql-base ) 28 | postgres? ( dev-db/postgresql-base ) 29 | redis? ( dev-db/redis ) 30 | sphinx2? ( dev-db/mysql ) 31 | skytools? ( dev-db/postgresql-base ) 32 | hwraid_smartarray? ( sys-block/hpacucli ) 33 | hwraid_megacli? ( app-admin/sudo sys-block/megacli ) 34 | unicorn? ( net-misc/curl )" 35 | RDEPEND="${DEPEND}" 36 | 37 | src_install() { 38 | dodir \ 39 | /etc/zabbix/zabbix_agentd.d \ 40 | /etc/zabbix/scripts 41 | 42 | fowners zabbix:zabbix \ 43 | /etc/zabbix/scripts \ 44 | /etc/zabbix/zabbix_agentd.d 45 | fperms 0755 \ 46 | /etc/zabbix/scripts \ 47 | /etc/zabbix/zabbix_agentd.d 48 | 49 | insinto /etc/zabbix/zabbix_agentd.d 50 | doins "files/linux/linux-extended.conf" 51 | insinto /etc/zabbix/scripts/ 52 | doins \ 53 | "files/linux/scripts/check-open-descriptors.sh" \ 54 | "files/linux/scripts/mem-usage.sh" \ 55 | "files/linux/scripts/swap.discovery.sh" 56 | insinto /etc/cron.d 57 | doins "files/linux/zabbix.cron" 58 | 59 | if use redis; then 60 | insinto /etc/zabbix/zabbix_agentd.d 61 | doins "files/redis/redis.conf" 62 | fi 63 | 64 | if use memcached; then 65 | insinto /etc/zabbix/zabbix_agentd.d 66 | doins "files/memcached/memcached.conf" 67 | fi 68 | 69 | if use pgbouncer; then 70 | insinto /etc/zabbix/zabbix_agentd.d 71 | doins "files/pgbouncer/pgbouncer.conf" 72 | insinto /etc/zabbix/scripts/ 73 | doins \ 74 | "files/pgbouncer/scripts/pgbouncer.pool.discovery.sh" \ 75 | "files/pgbouncer/scripts/pgbouncer.stat.sh" 76 | fi 77 | 78 | if use postfix; then 79 | insinto /etc/zabbix/zabbix_agentd.d 80 | doins "files/postfix/postfix.conf" 81 | fi 82 | 83 | if use postgres; then 84 | insinto /etc/zabbix/zabbix_agentd.d 85 | doins "files/postgresql/postgresql.conf" 86 | insinto /etc/zabbix/scripts/ 87 | doins \ 88 | "files/postgresql/scripts/pgsql.autovacuum.freeze.sh" \ 89 | "files/postgresql/scripts/pgsql.buffercache.sh" \ 90 | "files/postgresql/scripts/pgsql.connections.sh" \ 91 | "files/postgresql/scripts/pgsql.db.discovery.sh" \ 92 | "files/postgresql/scripts/pgsql.db.size.sh" \ 93 | "files/postgresql/scripts/pgsql.dbstat.sh" \ 94 | "files/postgresql/scripts/pgsql.indexes.size.sh" \ 95 | "files/postgresql/scripts/pgsql.pgqd.lag.sh" \ 96 | "files/postgresql/scripts/pgsql.ping.sh" \ 97 | "files/postgresql/scripts/pgsql.relation.size.sh" \ 98 | "files/postgresql/scripts/pgsql.relation.stat.sh" \ 99 | "files/postgresql/scripts/pgsql.relation.tuples.sh" \ 100 | "files/postgresql/scripts/pgsql.streaming.lag.sh" \ 101 | "files/postgresql/scripts/pgsql.transactions.sh" \ 102 | "files/postgresql/scripts/pgsql.uptime.sh" \ 103 | "files/postgresql/scripts/pgsql.trigger.sh" \ 104 | "files/postgresql/scripts/pgsql.wal.write.sh" 105 | fi 106 | 107 | if use glusterfs-client; then 108 | insinto /etc/zabbix/zabbix_agentd.d 109 | doins "files/glusterfs-client/glusterfs.conf" 110 | insinto /etc/zabbix/scripts/ 111 | doins \ 112 | "files/glusterfs-client/scripts/glusterfs.discovery.sh" 113 | fi 114 | 115 | if use flashcache; then 116 | insinto /etc/zabbix/zabbix_agentd.d 117 | doins "files/flashcache/flashcache.conf" 118 | insinto /etc/zabbix/scripts/ 119 | doins \ 120 | "files/flashcache/scripts/flashcache.dm.discovery.sh" \ 121 | "files/flashcache/scripts/flashcache.vol.discovery.sh" 122 | fi 123 | 124 | if use sphinx2; then 125 | insinto /etc/zabbix/zabbix_agentd.d 126 | doins "files/sphinx2/sphinx2.conf" 127 | fi 128 | 129 | if use skytools; then 130 | insinto /etc/zabbix/zabbix_agentd.d 131 | doins "files/skytools/skytools.conf" 132 | insinto /etc/zabbix/scripts/ 133 | doins \ 134 | "files/skytools/scripts/skytools.pgqd.queue.discovery.sh" \ 135 | "files/skytools/scripts/skytools.pgqd.sh" 136 | fi 137 | 138 | if use hwraid_smartarray; then 139 | insinto /etc/zabbix/zabbix_agentd.d 140 | doins "files/hwraid-smartarray/hp-raid-smart-array.conf" 141 | insinto /etc/zabbix/scripts/ 142 | doins \ 143 | "files/hwraid-smartarray/scripts/hp-raid-data-processor.sh" \ 144 | "files/hwraid-smartarray/scripts/hp-raid-ctrl-discovery.sh" \ 145 | "files/hwraid-smartarray/scripts/hp-raid-ld-discovery.sh" \ 146 | "files/hwraid-smartarray/scripts/hp-raid-pd-discovery.sh" 147 | insinto /etc/cron.d 148 | doins "files/hwraid-smartarray/zabbix.smartarray" 149 | fi 150 | 151 | if use hwraid_megacli; then 152 | insinto /etc/zabbix/zabbix_agentd.d 153 | doins "files/hwraid-megacli/megacli.conf" 154 | insinto /etc/zabbix/scripts/ 155 | doins \ 156 | "files/hwraid-megacli/scripts/megacli-adp-discovery.sh" \ 157 | "files/hwraid-megacli/scripts/megacli-ld-discovery.sh" \ 158 | "files/hwraid-megacli/scripts/megacli-pd-discovery.sh" \ 159 | "files/hwraid-megacli/scripts/megacli-raid-data-processor.sh" 160 | insinto /etc/cron.d 161 | doins "files/hwraid-megacli/zabbix.megacli" 162 | fi 163 | 164 | if use unicorn; then 165 | insinto /etc/zabbix/zabbix_agentd.d 166 | doins "files/unicorn/unicorn.conf" 167 | fi 168 | } 169 | 170 | pkg_postinst() { 171 | chown -R zabbix:zabbix \ 172 | "${ROOT}"/etc/zabbix/scripts/*.sh 173 | chmod 0755 \ 174 | "${ROOT}"/etc/zabbix/scripts/*.sh 175 | 176 | if use postgres || use skytools ; then 177 | elog 178 | elog "For PostgreSQL or Skytools monitoring need setup md5 auth with .pgpass for zabbix user." 179 | elog "For example:" 180 | elog "# echo 'localhost:5432:app_db:app_role:app_pass' > ~zabbix/.pgpass" 181 | elog "# chown zabbix:zabbix ~zabbix/.pgpass" 182 | elog "# chmod 600 ~zabbix/.pgpass" 183 | elog 184 | elog "More explained: http://www.thislinux.org/2012/10/postgresql-monitoring-via-zabbix.html" 185 | elog 186 | fi 187 | 188 | if use hwraid_smartarray || use hwraid_megacli ; then 189 | elog 190 | elog "Hardware RAID monitoring extension uses crontask." 191 | elog "After install don't forget restart cron service manually." 192 | elog 193 | fi 194 | 195 | elog 196 | elog "After installation and before restart zabbix agent," 197 | elog "make sure that the following option enabled in zabbix_agentd.conf:" 198 | elog "Include=/etc/zabbix/zabbix_agentd.d/" 199 | elog 200 | } 201 | -------------------------------------------------------------------------------- /gentoo/zabbix-extensions-4.ebuild: -------------------------------------------------------------------------------- 1 | # Copyright 1999-2013 Gentoo Foundation 2 | # Distributed under the terms of the GNU General Public License v2 3 | # $Header: $ 4 | 5 | EAPI=5 6 | inherit eutils 7 | 8 | DESCRIPTION="Zabbix additional monitoring modules" 9 | HOMEPAGE="https://github.com/lesovsky/zabbix-extensions" 10 | ZBX_EXT_GIT_SHA1="317e1cf" 11 | ZBX_EXT_GIT_URI="https://github.com/lesovsky/zabbix-extensions/tarball/${ZBX_EXT_GIT_SHA1}" 12 | SRC_URI="${ZBX_EXT_GIT_URI} -> ${P}.tar.gz" 13 | S="${WORKDIR}/lesovsky-zabbix-extensions-${ZBX_EXT_GIT_SHA1}" 14 | 15 | LICENSE="as-is" 16 | SLOT="0" 17 | KEYWORDS="~amd64 ~x86" 18 | IUSE="flashcache glusterfs-client memcached pgbouncer postfix postgres redis sphinx2 skytools unicorn" 19 | 20 | HWRAID="adaptec smartarray megacli" 21 | 22 | for name in $HWRAID; do 23 | IUSE="${IUSE} hwraid_${name}" 24 | done 25 | 26 | DEPEND=">=net-analyzer/zabbix-2.0.0 27 | pgbouncer? ( dev-db/postgresql-base ) 28 | postgres? ( dev-db/postgresql-base ) 29 | redis? ( dev-db/redis ) 30 | sphinx2? ( dev-db/mysql ) 31 | skytools? ( dev-db/postgresql-base ) 32 | hwraid_adaptec? ( app-admin/sudo sys-block/storman ) 33 | hwraid_smartarray? ( app-admin/sudo sys-block/hpacucli ) 34 | hwraid_megacli? ( app-admin/sudo sys-block/megacli ) 35 | unicorn? ( net-misc/curl )" 36 | RDEPEND="${DEPEND}" 37 | 38 | src_install() { 39 | dodir \ 40 | /etc/zabbix/zabbix_agentd.d \ 41 | /etc/zabbix/scripts 42 | 43 | fowners zabbix:zabbix \ 44 | /etc/zabbix/scripts \ 45 | /etc/zabbix/zabbix_agentd.d 46 | fperms 0755 \ 47 | /etc/zabbix/scripts \ 48 | /etc/zabbix/zabbix_agentd.d 49 | 50 | insinto /etc/zabbix/zabbix_agentd.d 51 | doins "files/linux/linux-extended.conf" 52 | insinto /etc/zabbix/scripts/ 53 | doins \ 54 | "files/linux/scripts/check-open-descriptors.sh" \ 55 | "files/linux/scripts/mem-usage.sh" \ 56 | "files/linux/scripts/swap.discovery.sh" 57 | insinto /etc/cron.d 58 | doins "files/linux/zabbix.cron" 59 | 60 | if use redis; then 61 | insinto /etc/zabbix/zabbix_agentd.d 62 | doins "files/redis/redis.conf" 63 | fi 64 | 65 | if use memcached; then 66 | insinto /etc/zabbix/zabbix_agentd.d 67 | doins "files/memcached/memcached.conf" 68 | fi 69 | 70 | if use pgbouncer; then 71 | insinto /etc/zabbix/zabbix_agentd.d 72 | doins "files/pgbouncer/pgbouncer.conf" 73 | insinto /etc/zabbix/scripts/ 74 | doins \ 75 | "files/pgbouncer/scripts/pgbouncer.pool.discovery.sh" \ 76 | "files/pgbouncer/scripts/pgbouncer.stat.sh" 77 | fi 78 | 79 | if use postfix; then 80 | insinto /etc/zabbix/zabbix_agentd.d 81 | doins "files/postfix/postfix.conf" 82 | fi 83 | 84 | if use postgres; then 85 | insinto /etc/zabbix/zabbix_agentd.d 86 | doins "files/postgresql/postgresql.conf" 87 | insinto /etc/zabbix/scripts/ 88 | doins \ 89 | "files/postgresql/scripts/pgsql.autovacuum.freeze.sh" \ 90 | "files/postgresql/scripts/pgsql.buffercache.sh" \ 91 | "files/postgresql/scripts/pgsql.connections.sh" \ 92 | "files/postgresql/scripts/pgsql.db.discovery.sh" \ 93 | "files/postgresql/scripts/pgsql.db.size.sh" \ 94 | "files/postgresql/scripts/pgsql.dbstat.sh" \ 95 | "files/postgresql/scripts/pgsql.indexes.size.sh" \ 96 | "files/postgresql/scripts/pgsql.pgqd.lag.sh" \ 97 | "files/postgresql/scripts/pgsql.ping.sh" \ 98 | "files/postgresql/scripts/pgsql.relation.size.sh" \ 99 | "files/postgresql/scripts/pgsql.relation.stat.sh" \ 100 | "files/postgresql/scripts/pgsql.relation.tuples.sh" \ 101 | "files/postgresql/scripts/pgsql.streaming.lag.sh" \ 102 | "files/postgresql/scripts/pgsql.transactions.sh" \ 103 | "files/postgresql/scripts/pgsql.uptime.sh" \ 104 | "files/postgresql/scripts/pgsql.trigger.sh" \ 105 | "files/postgresql/scripts/pgsql.wal.write.sh" 106 | fi 107 | 108 | if use glusterfs-client; then 109 | insinto /etc/zabbix/zabbix_agentd.d 110 | doins "files/glusterfs-client/glusterfs.conf" 111 | insinto /etc/zabbix/scripts/ 112 | doins \ 113 | "files/glusterfs-client/scripts/glusterfs.discovery.sh" 114 | fi 115 | 116 | if use flashcache; then 117 | insinto /etc/zabbix/zabbix_agentd.d 118 | doins "files/flashcache/flashcache.conf" 119 | insinto /etc/zabbix/scripts/ 120 | doins \ 121 | "files/flashcache/scripts/flashcache.dm.discovery.sh" \ 122 | "files/flashcache/scripts/flashcache.vol.discovery.sh" 123 | fi 124 | 125 | if use sphinx2; then 126 | insinto /etc/zabbix/zabbix_agentd.d 127 | doins "files/sphinx2/sphinx2.conf" 128 | fi 129 | 130 | if use skytools; then 131 | insinto /etc/zabbix/zabbix_agentd.d 132 | doins "files/skytools/skytools.conf" 133 | insinto /etc/zabbix/scripts/ 134 | doins \ 135 | "files/skytools/scripts/skytools.pgqd.queue.discovery.sh" \ 136 | "files/skytools/scripts/skytools.pgqd.sh" 137 | fi 138 | 139 | if use hwraid_adaptec; then 140 | insinto /etc/zabbix/zabbix_agentd.d 141 | doins "files/hwraid-adaptec/adaptec.conf" 142 | insinto /etc/zabbix/scripts/ 143 | doins \ 144 | "files/hwraid-adaptec/scripts/adaptec-raid-data-processor.sh" \ 145 | "files/hwraid-adaptec/scripts/adaptec-adp-discovery.sh" \ 146 | "files/hwraid-adaptec/scripts/adaptec-ld-discovery.sh" \ 147 | "files/hwraid-adaptec/scripts/adaptec-pd-discovery.sh" 148 | insinto /etc/cron.d 149 | doins "files/hwraid-adaptec/zabbix.adaptec" 150 | fi 151 | 152 | if use hwraid_smartarray; then 153 | insinto /etc/zabbix/zabbix_agentd.d 154 | doins "files/hwraid-smartarray/hp-raid-smart-array.conf" 155 | insinto /etc/zabbix/scripts/ 156 | doins \ 157 | "files/hwraid-smartarray/scripts/hp-raid-data-processor.sh" \ 158 | "files/hwraid-smartarray/scripts/hp-raid-ctrl-discovery.sh" \ 159 | "files/hwraid-smartarray/scripts/hp-raid-ld-discovery.sh" \ 160 | "files/hwraid-smartarray/scripts/hp-raid-pd-discovery.sh" 161 | insinto /etc/cron.d 162 | doins "files/hwraid-smartarray/zabbix.smartarray" 163 | fi 164 | 165 | if use hwraid_megacli; then 166 | insinto /etc/zabbix/zabbix_agentd.d 167 | doins "files/hwraid-megacli/megacli.conf" 168 | insinto /etc/zabbix/scripts/ 169 | doins \ 170 | "files/hwraid-megacli/scripts/megacli-adp-discovery.sh" \ 171 | "files/hwraid-megacli/scripts/megacli-ld-discovery.sh" \ 172 | "files/hwraid-megacli/scripts/megacli-pd-discovery.sh" \ 173 | "files/hwraid-megacli/scripts/megacli-raid-data-processor.sh" 174 | insinto /etc/cron.d 175 | doins "files/hwraid-megacli/zabbix.megacli" 176 | fi 177 | 178 | if use unicorn; then 179 | insinto /etc/zabbix/zabbix_agentd.d 180 | doins "files/unicorn/unicorn.conf" 181 | fi 182 | } 183 | 184 | pkg_postinst() { 185 | chown -R zabbix:zabbix \ 186 | "${ROOT}"/etc/zabbix/scripts/*.sh 187 | chmod 0755 \ 188 | "${ROOT}"/etc/zabbix/scripts/*.sh 189 | 190 | if use postgres || use skytools ; then 191 | elog 192 | elog "For PostgreSQL or Skytools monitoring need setup md5 auth with .pgpass for zabbix user." 193 | elog "For example:" 194 | elog "# echo 'localhost:5432:app_db:app_role:app_pass' > ~zabbix/.pgpass" 195 | elog "# chown zabbix:zabbix ~zabbix/.pgpass" 196 | elog "# chmod 600 ~zabbix/.pgpass" 197 | elog 198 | elog "More explained: http://www.thislinux.org/2012/10/postgresql-monitoring-via-zabbix.html" 199 | elog 200 | fi 201 | 202 | if use hwraid_smartarray || use hwraid_megacli || use hwraid_adaptec; then 203 | elog 204 | elog "Hardware RAID monitoring extension uses crontask." 205 | elog "After install don't forget restart cron service manually." 206 | elog 207 | fi 208 | 209 | elog 210 | elog "After installation and before restart zabbix agent," 211 | elog "make sure that the following option enabled in zabbix_agentd.conf:" 212 | elog "Include=/etc/zabbix/zabbix_agentd.d/" 213 | elog 214 | } 215 | -------------------------------------------------------------------------------- /gentoo/zabbix-extensions-5.ebuild: -------------------------------------------------------------------------------- 1 | # Copyright 1999-2013 Gentoo Foundation 2 | # Distributed under the terms of the GNU General Public License v2 3 | # $Header: $ 4 | 5 | EAPI=5 6 | inherit eutils 7 | 8 | DESCRIPTION="Zabbix additional monitoring modules" 9 | HOMEPAGE="https://github.com/lesovsky/zabbix-extensions" 10 | ZBX_EXT_GIT_SHA1="131fef3" 11 | ZBX_EXT_GIT_URI="https://github.com/lesovsky/zabbix-extensions/tarball/${ZBX_EXT_GIT_SHA1}" 12 | SRC_URI="${ZBX_EXT_GIT_URI} -> ${P}.tar.gz" 13 | S="${WORKDIR}/lesovsky-zabbix-extensions-${ZBX_EXT_GIT_SHA1}" 14 | 15 | LICENSE="as-is" 16 | SLOT="0" 17 | KEYWORDS="~amd64 ~x86" 18 | IUSE="flashcache glusterfs-client memcached pgbouncer postfix postgres redis sphinx2 skytools unicorn" 19 | 20 | HWRAID="adaptec smartarray megacli" 21 | 22 | for name in $HWRAID; do 23 | IUSE="${IUSE} hwraid_${name}" 24 | done 25 | 26 | DEPEND=">=net-analyzer/zabbix-2.0.0 27 | pgbouncer? ( dev-db/postgresql-base ) 28 | postgres? ( dev-db/postgresql-base ) 29 | redis? ( dev-db/redis ) 30 | sphinx2? ( dev-db/mysql ) 31 | skytools? ( dev-db/postgresql-base ) 32 | hwraid_adaptec? ( app-admin/sudo sys-block/storman ) 33 | hwraid_smartarray? ( app-admin/sudo sys-block/hpacucli ) 34 | hwraid_megacli? ( app-admin/sudo sys-block/megacli ) 35 | unicorn? ( net-misc/curl )" 36 | RDEPEND="${DEPEND}" 37 | 38 | src_install() { 39 | dodir \ 40 | /etc/zabbix/zabbix_agentd.d \ 41 | /usr/libexec/zabbix-extensions/scripts 42 | 43 | newconfd "${FILESDIR}"/zabbix-agentd-conf.d zabbix-agentd 44 | insinto /etc/zabbix/zabbix_agentd.d 45 | doins "files/linux/linux-extended.conf" 46 | insinto /usr/libexec/zabbix-extensions/scripts/ 47 | doins \ 48 | "files/linux/scripts/check-open-descriptors.sh" \ 49 | "files/linux/scripts/mem-usage.sh" \ 50 | "files/linux/scripts/swap.discovery.sh" 51 | insinto /etc/cron.d 52 | doins "files/linux/zabbix.cron" 53 | 54 | if use redis; then 55 | insinto /etc/zabbix/zabbix_agentd.d 56 | doins "files/redis/redis.conf" 57 | fi 58 | 59 | if use memcached; then 60 | insinto /etc/zabbix/zabbix_agentd.d 61 | doins "files/memcached/memcached.conf" 62 | fi 63 | 64 | if use pgbouncer; then 65 | insinto /etc/zabbix/zabbix_agentd.d 66 | doins "files/pgbouncer/pgbouncer.conf" 67 | insinto /usr/libexec/zabbix-extensions/scripts/ 68 | doins \ 69 | "files/pgbouncer/scripts/pgbouncer.pool.discovery.sh" \ 70 | "files/pgbouncer/scripts/pgbouncer.stat.sh" 71 | fi 72 | 73 | if use postfix; then 74 | insinto /etc/zabbix/zabbix_agentd.d 75 | doins "files/postfix/postfix.conf" 76 | fi 77 | 78 | if use postgres; then 79 | insinto /etc/zabbix/zabbix_agentd.d 80 | doins "files/postgresql/postgresql.conf" 81 | insinto /usr/libexec/zabbix-extensions/scripts/ 82 | doins \ 83 | "files/postgresql/scripts/pgsql.autovacuum.freeze.sh" \ 84 | "files/postgresql/scripts/pgsql.buffercache.sh" \ 85 | "files/postgresql/scripts/pgsql.connections.sh" \ 86 | "files/postgresql/scripts/pgsql.db.discovery.sh" \ 87 | "files/postgresql/scripts/pgsql.db.size.sh" \ 88 | "files/postgresql/scripts/pgsql.dbstat.sh" \ 89 | "files/postgresql/scripts/pgsql.indexes.size.sh" \ 90 | "files/postgresql/scripts/pgsql.ping.sh" \ 91 | "files/postgresql/scripts/pgsql.relation.size.sh" \ 92 | "files/postgresql/scripts/pgsql.relation.stat.sh" \ 93 | "files/postgresql/scripts/pgsql.relation.tuples.sh" \ 94 | "files/postgresql/scripts/pgsql.streaming.lag.sh" \ 95 | "files/postgresql/scripts/pgsql.transactions.sh" \ 96 | "files/postgresql/scripts/pgsql.uptime.sh" \ 97 | "files/postgresql/scripts/pgsql.trigger.sh" \ 98 | "files/postgresql/scripts/pgsql.wal.write.sh" 99 | fi 100 | 101 | if use glusterfs-client; then 102 | insinto /etc/zabbix/zabbix_agentd.d 103 | doins "files/glusterfs-client/glusterfs.conf" 104 | insinto /usr/libexec/zabbix-extensions/scripts/ 105 | doins \ 106 | "files/glusterfs-client/scripts/glusterfs.discovery.sh" 107 | fi 108 | 109 | if use flashcache; then 110 | insinto /etc/zabbix/zabbix_agentd.d 111 | doins "files/flashcache/flashcache.conf" 112 | insinto /usr/libexec/zabbix-extensions/scripts/ 113 | doins \ 114 | "files/flashcache/scripts/flashcache.dm.discovery.sh" \ 115 | "files/flashcache/scripts/flashcache.vol.discovery.sh" 116 | fi 117 | 118 | if use sphinx2; then 119 | insinto /etc/zabbix/zabbix_agentd.d 120 | doins "files/sphinx2/sphinx2.conf" 121 | fi 122 | 123 | if use skytools; then 124 | insinto /etc/zabbix/zabbix_agentd.d 125 | doins "files/skytools/skytools.conf" 126 | insinto /usr/libexec/zabbix-extensions/scripts/ 127 | doins \ 128 | "files/skytools/scripts/skytools.pgqd.queue.discovery.sh" \ 129 | "files/skytools/scripts/skytools.pgqd.sh" 130 | fi 131 | 132 | if use hwraid_adaptec; then 133 | insinto /etc/zabbix/zabbix_agentd.d 134 | doins "files/hwraid-adaptec/adaptec.conf" 135 | insinto /usr/libexec/zabbix-extensions/scripts/ 136 | doins \ 137 | "files/hwraid-adaptec/scripts/adaptec-raid-data-processor.sh" \ 138 | "files/hwraid-adaptec/scripts/adaptec-adp-discovery.sh" \ 139 | "files/hwraid-adaptec/scripts/adaptec-ld-discovery.sh" \ 140 | "files/hwraid-adaptec/scripts/adaptec-pd-discovery.sh" 141 | insinto /etc/cron.d 142 | doins "files/hwraid-adaptec/zabbix.adaptec" 143 | fi 144 | 145 | if use hwraid_smartarray; then 146 | insinto /etc/zabbix/zabbix_agentd.d 147 | doins "files/hwraid-smartarray/hp-raid-smart-array.conf" 148 | insinto /usr/libexec/zabbix-extensions/scripts/ 149 | doins \ 150 | "files/hwraid-smartarray/scripts/hp-raid-data-processor.sh" \ 151 | "files/hwraid-smartarray/scripts/hp-raid-ctrl-discovery.sh" \ 152 | "files/hwraid-smartarray/scripts/hp-raid-ld-discovery.sh" \ 153 | "files/hwraid-smartarray/scripts/hp-raid-pd-discovery.sh" 154 | insinto /etc/cron.d 155 | doins "files/hwraid-smartarray/zabbix.smartarray" 156 | fi 157 | 158 | if use hwraid_megacli; then 159 | insinto /etc/zabbix/zabbix_agentd.d 160 | doins "files/hwraid-megacli/megacli.conf" 161 | insinto /usr/libexec/zabbix-extensions/scripts/ 162 | doins \ 163 | "files/hwraid-megacli/scripts/megacli-adp-discovery.sh" \ 164 | "files/hwraid-megacli/scripts/megacli-ld-discovery.sh" \ 165 | "files/hwraid-megacli/scripts/megacli-pd-discovery.sh" \ 166 | "files/hwraid-megacli/scripts/megacli-raid-data-processor.sh" 167 | insinto /etc/cron.d 168 | doins "files/hwraid-megacli/zabbix.megacli" 169 | fi 170 | 171 | if use unicorn; then 172 | insinto /etc/zabbix/zabbix_agentd.d 173 | doins "files/unicorn/unicorn.conf" 174 | fi 175 | } 176 | 177 | pkg_postinst() { 178 | chown -R zabbix:zabbix \ 179 | "${ROOT}"/usr/libexec/zabbix-extensions/scripts/ 180 | chmod 0754 \ 181 | "${ROOT}"/usr/libexec/zabbix-extensions/scripts/*.sh 182 | 183 | if use postgres || use skytools ; then 184 | elog 185 | elog "For PostgreSQL or Skytools monitoring need setup md5 auth with .pgpass for zabbix user." 186 | elog "For example:" 187 | elog "# echo 'localhost:5432:app_db:app_role:app_pass' > ~zabbix/.pgpass" 188 | elog "# chown zabbix:zabbix ~zabbix/.pgpass" 189 | elog "# chmod 600 ~zabbix/.pgpass" 190 | elog 191 | elog "More explained: http://www.thislinux.org/2012/10/postgresql-monitoring-via-zabbix.html" 192 | elog 193 | fi 194 | 195 | if use hwraid_smartarray || use hwraid_megacli || use hwraid_adaptec; then 196 | elog 197 | elog "Hardware RAID monitoring extension uses crontask." 198 | elog "After install don't forget restart cron service manually." 199 | elog 200 | fi 201 | 202 | elog 203 | elog "After installation and before restart zabbix agent," 204 | elog "make sure that the following option enabled in zabbix_agentd.conf:" 205 | elog "Include=/etc/zabbix/zabbix_agentd.d/" 206 | elog 207 | } 208 | -------------------------------------------------------------------------------- /icons/normal/database-postgres.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/database-postgres.png -------------------------------------------------------------------------------- /icons/normal/server-accounting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/server-accounting.png -------------------------------------------------------------------------------- /icons/normal/server-database-gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/server-database-gray.png -------------------------------------------------------------------------------- /icons/normal/server-database-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/server-database-green.png -------------------------------------------------------------------------------- /icons/normal/server-database-mysql.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/server-database-mysql.png -------------------------------------------------------------------------------- /icons/normal/server-database-postgres.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/server-database-postgres.png -------------------------------------------------------------------------------- /icons/normal/server-database-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/server-database-yellow.png -------------------------------------------------------------------------------- /icons/normal/server-directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/server-directory.png -------------------------------------------------------------------------------- /icons/normal/server-email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/server-email.png -------------------------------------------------------------------------------- /icons/normal/server-pack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/server-pack.png -------------------------------------------------------------------------------- /icons/normal/server-status-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/server-status-disabled.png -------------------------------------------------------------------------------- /icons/normal/server-status-maintenance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/server-status-maintenance.png -------------------------------------------------------------------------------- /icons/normal/server-status-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/server-status-ok.png -------------------------------------------------------------------------------- /icons/normal/server-status-problem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/server-status-problem.png -------------------------------------------------------------------------------- /icons/normal/server-web-secure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/server-web-secure.png -------------------------------------------------------------------------------- /icons/normal/server-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/normal/server-web.png -------------------------------------------------------------------------------- /icons/small/database-postgres.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/database-postgres.png -------------------------------------------------------------------------------- /icons/small/server-accounting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-accounting.png -------------------------------------------------------------------------------- /icons/small/server-database-gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-database-gray.png -------------------------------------------------------------------------------- /icons/small/server-database-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-database-green.png -------------------------------------------------------------------------------- /icons/small/server-database-mysql.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-database-mysql.png -------------------------------------------------------------------------------- /icons/small/server-database-postgres.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-database-postgres.png -------------------------------------------------------------------------------- /icons/small/server-database-replica-gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-database-replica-gray.png -------------------------------------------------------------------------------- /icons/small/server-database-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-database-yellow.png -------------------------------------------------------------------------------- /icons/small/server-directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-directory.png -------------------------------------------------------------------------------- /icons/small/server-email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-email.png -------------------------------------------------------------------------------- /icons/small/server-pack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-pack.png -------------------------------------------------------------------------------- /icons/small/server-status-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-status-disabled.png -------------------------------------------------------------------------------- /icons/small/server-status-maintenance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-status-maintenance.png -------------------------------------------------------------------------------- /icons/small/server-status-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-status-ok.png -------------------------------------------------------------------------------- /icons/small/server-status-problem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-status-problem.png -------------------------------------------------------------------------------- /icons/small/server-web-secure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-web-secure.png -------------------------------------------------------------------------------- /icons/small/server-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lesovsky/zabbix-extensions/68e1ddaa0a25e42f5d98a84baa0328a37c919d9f/icons/small/server-web.png --------------------------------------------------------------------------------