RTMP | 34 |#clients | 35 |Video | 36 |Audio | 37 |In bytes | 38 |Out bytes | 39 |In bits/s | 40 |Out bits/s | 41 |State | 42 |Time | 43 |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Accepted: |
46 | codec | 47 |bits/s | 48 |size | 49 |fps | 50 |codec | 51 |bits/s | 52 |freq | 53 |chan | 54 |
55 | |
59 |
60 | |
64 |
65 | |
71 |
72 | |
78 | 79 | |
80 | |
84 |
5 | # 6 | 7 | # Discovery 8 | UserParameter=redis.discovery, /etc/zabbix/scripts/redis-stats.py localhost list_key_space_db 9 | 10 | # Return Redis statistics 11 | UserParameter=redis[*], /etc/zabbix/scripts/redis-stats.py $1 $2 $3 12 | -------------------------------------------------------------------------------- /Templates/SMART/README.md: -------------------------------------------------------------------------------- 1 | #based on https://github.com/v-zhuravlev/zbx-smartctl 2 | 3 | #Description 4 | This is the template for Zabbix providing SMART monitoring for HDD using smartctl utility. 5 | *main* branch has the templates for Zabbix 3.0, 2.4 and 2.2. Only devices with SMART enabled will be discovered. 6 | 7 | #Installation: 8 | ##Linux/BSD/Mac OSX: 9 | - Make sure that smartmontools utils are installed: 10 | - install the script smartctl-disks-discovery.pl in /etc/zabbix/scripts/ 11 | - test the script by running it. You should receive JSON object in the script output 12 | - add the following permissions into /etc/sudoers: 13 | ``` 14 | zabbix ALL= (ALL) NOPASSWD: /usr/sbin/smartctl,/etc/zabbix/scripts/smartctl-disks-discovery.pl,/etc/zabbix/scripts/smart.thresh.check.sh 15 | ``` 16 | Add the following lines in zabbix_agentd.conf file: 17 | ``` 18 | #############SMARTMON 19 | #UserParameter=uHDD[*], sudo smartctl -A $1| grep -i "$2"| tail -1| awk '{print $10}' 20 | UserParameter=uHDD[*], sudo smartctl -A $1| grep -i "$2"| tail -1| cut -c 88-|cut -f1 -d' ' 21 | UserParameter=uHDD.model.[*],sudo smartctl -i $1 |grep -i "Device Model"| cut -f2 -d: |tr -d " " 22 | UserParameter=uHDD.sn.[*],sudo smartctl -i $1 |grep -i "Serial Number"| cut -f2 -d: |tr -d " " 23 | UserParameter=uHDD.health.[*],sudo smartctl -H $1 |grep -i "test"| cut -f2 -d: |tr -d " " 24 | #UserParameter=uHDD.errorlog.[*],sudo smartctl -l error $1 | grep -i "ATA Error Count" | cut -f2 -d: |tr -d " "); if [[ ! -z "$a" ]]; then echo $a; else echo 0; fi 25 | UserParameter=uHDD.errorlog.[*],sudo smartctl -l error $1 |grep -i "ATA Error Count"| cut -f2 -d: |tr -d " " 26 | UserParameter=uHDD.discovery,sudo /etc/zabbix/scripts/smartctl-disks-discovery.pl 27 | UserParameter=uHDD.thresh.check[*], sudo /etc/zabbix/scripts/smart.thresh.check.sh 28 | 29 | ``` 30 | ###Building deb package 31 | You can create .deb package `zabbix-agent-extra-smartctl` for Debian/Ubuntu distributions: 32 | ```shell 33 | dpkg-buildpackage -tc -Zgzip 34 | 35 | ``` 36 | #License 37 | GPL v3 or newer. 38 | 39 | #More info: 40 | http://habrahabr.ru/company/zabbix/blog/196218/ 41 | http://www.lanana.org/docs/device-list/devices-2.6+.txt 42 | https://www.smartmontools.org/wiki/Supported_RAID-Controllers 43 | -------------------------------------------------------------------------------- /Templates/SMART/smart.thresh.check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # add zabbix-user to /etc/sudoers to execute this scpirt without sudo 3 | # zabbix ALL= (ALL) NOPASSWD: /usr/sbin/smartctl, /etc/zabbix/scripts/smart.thresh.check.sh 4 | 5 | DISK=$1 6 | ATTRIBUTE=$2 7 | DIFF=0 8 | 9 | # Current value 10 | VALUE=$((10#$(sudo smartctl -A $DISK | grep -i "$ATTRIBUTE" | tail -1 | awk '{ print $4 }'))) # $((10#...)) - this is needed to correctly decimal calculation 11 | # THRESH 12 | THRESH=$((10#$(sudo smartctl -A $DISK | grep -i "$ATTRIBUTE" | tail -1 | awk '{ print $6 }'))) # $((10#...)) - this is needed to correctly decimal calculation 13 | 14 | let "DIFF = $VALUE - $THRESH" 15 | 16 | echo $DIFF -------------------------------------------------------------------------------- /Templates/SMART/smartctl-disks-discovery.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | #must be run as root 4 | $first = 1; 5 | 6 | #add path if needed into $smartctl_cmd 7 | $smartctl_cmd = "smartctl"; 8 | 9 | my @disks; 10 | if ($^O eq 'darwin') { # if MAC OSX 11 | 12 | while (glob( '/dev/disk*' )) { 13 | if ($_ =~ /\/(disk+[0-9])$/) {push @disks,$1;} 14 | } 15 | } 16 | else { 17 | for (`$smartctl_cmd --scan-open`) { 18 | #splitting lines like "/dev/sda -d scsi # /dev/sda, SCSI device" 19 | my @device = split / /, $_; 20 | #Adding full value from smartctl --scan to get SMART from not only /dev/sd devices but /dev/bus/0 -d megaraid,01 too 21 | $disk = "@device[0] @device[1] @device[2]"; 22 | push @disks,$disk; 23 | } 24 | } 25 | 26 | #print "Disks are @disks"; 27 | print "{\n"; 28 | print "\t\"data\":[\n\n"; 29 | 30 | @serials; 31 | DISKLOOP:foreach my $disk (@disks) { 32 | #DISK LOOP 33 | $smart_enabled = 0; 34 | 35 | chomp($disk); 36 | #SMART STATUS LOOP 37 | foreach $line (`$smartctl_cmd -i $disk`) { 38 | #Some disks have "Number" and some "number", so 39 | if ($line =~ /^Serial (N|n)umber: +(.+)$/) { 40 | #print "Serial number is ".$2."\n"; 41 | if (grep /$2/,@serials) { 42 | #print "disk already exist skipping\n"; 43 | next DISKLOOP; 44 | } 45 | else { 46 | push @serials,$2; 47 | } 48 | } elsif ($line =~ /^SMART.+?: +(.+)$/) { 49 | #print "$1\n"; 50 | 51 | if ( $1 =~ /Enabled/ ) { 52 | $smart_enabled = 1; 53 | } 54 | #if SMART is disabled then try to enable it (also offline tests etc) 55 | elsif ( $1 =~ /Disabled/ ) { 56 | foreach (`smartctl -s on -o on -S on $disk`) { 57 | if (/SMART Enabled/) { $smart_enabled = 1; } 58 | } 59 | } 60 | } 61 | } 62 | 63 | print ",\n" if not $first; 64 | $first = 0; 65 | print "\t\t{\n"; 66 | print "\t\t\t\"{#DISKNAME}\":\"$disk\",\n"; 67 | print "\t\t\t\"{#SMART_ENABLED}\":\"$smart_enabled\"\n"; 68 | print "\t\t}"; 69 | 70 | } 71 | 72 | print "\n\t]\n"; 73 | print "}\n"; 74 | -------------------------------------------------------------------------------- /Templates/SMART/zabbix_smartctl.conf: -------------------------------------------------------------------------------- 1 | #############SMARTMON 2 | #UserParameter=uHDD[*], sudo smartctl -A $1| grep -i "$2"| tail -1| awk '{print $10}' 3 | UserParameter=uHDD[*], sudo smartctl -A $1| grep -i "$2"| tail -1| cut -c 88-|cut -f1 -d' ' 4 | UserParameter=uHDD.model.[*],sudo smartctl -i $1 |grep -i "Device Model"| cut -f2 -d: |tr -d " " 5 | UserParameter=uHDD.sn.[*],sudo smartctl -i $1 |grep -i "Serial Number"| cut -f2 -d: |tr -d " " 6 | UserParameter=uHDD.health.[*],sudo smartctl -H $1 |grep -i "test"| cut -f2 -d: |tr -d " " 7 | #UserParameter=uHDD.errorlog.[*],sudo smartctl -l error $1 | grep -i "ATA Error Count" | cut -f2 -d: |tr -d " "); if [[ ! -z "$a" ]]; then echo $a; else echo 0; fi 8 | UserParameter=uHDD.errorlog.[*],sudo smartctl -l error $1 |grep -i "ATA Error Count"| cut -f2 -d: |tr -d " " 9 | UserParameter=uHDD.discovery,sudo /etc/zabbix/scripts/smartctl-disks-discovery.pl 10 | UserParameter=uHDD.thresh.check[*], sudo /etc/zabbix/scripts/smart.thresh.check.sh -------------------------------------------------------------------------------- /Templates/SSL Certificates/check-ssl-expire.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # source https://gist.github.com/crashdump/5683952 5 | # 6 | 7 | __author__ = "Adrien Pujol - http://www.crashdump.fr/" 8 | __copyright__ = "Copyright 2013, Adrien Pujol" 9 | __license__ = "Mozilla Public License" 10 | __version__ = "0.3" 11 | __email__ = "adrien.pujol@crashdump.fr" 12 | __status__ = "Development" 13 | __doc__ = "Check a TLS certificate validity." 14 | 15 | import argparse 16 | import socket 17 | from datetime import datetime 18 | import time 19 | try: 20 | # Try to load pyOpenSSL first 21 | # aptitude install python-dev && pip install pyopenssl 22 | from OpenSSL import SSL 23 | PYOPENSSL = True 24 | except ImportError: 25 | # Else, fallback on standard ssl lib (doesn't support SNI) 26 | import ssl 27 | PYOPENSSL = False 28 | 29 | CA_CERTS = "/etc/ssl/certs/ca-certificates.crt" 30 | 31 | 32 | def exit_error(errcode, errtext): 33 | print errtext 34 | exit(errcode) 35 | 36 | 37 | def pyopenssl_check_callback(connection, x509, errnum, errdepth, ok): 38 | ''' callback for pyopenssl ssl check''' 39 | if x509.get_subject().commonName == HOST: 40 | if x509.has_expired(): 41 | exit_error(1, 'Error: Certificate has expired!') 42 | else: 43 | print pyopenssl_check_expiration(x509.get_notAfter()) 44 | 45 | if not ok: 46 | return False 47 | return ok 48 | 49 | 50 | def pyopenssl_check_expiration(asn1): 51 | ''' Return the numbers of day before expiration. False if expired.''' 52 | try: 53 | expire_date = datetime.strptime(asn1, "%Y%m%d%H%M%SZ") 54 | except: 55 | exit_error(1, 'Certificate date format unknow.') 56 | 57 | expire_in = expire_date - datetime.now() 58 | if expire_in.days > 0: 59 | return expire_in.days 60 | else: 61 | return False 62 | 63 | 64 | def pyssl_check_hostname(cert, hostname): 65 | ''' Return True if valid. False is invalid ''' 66 | if 'subjectAltName' in cert: 67 | for typ, val in cert['subjectAltName']: 68 | # Wilcard 69 | if typ == 'DNS' and val.startswith('*'): 70 | if val[2:] == hostname.split('.', 1)[1]: 71 | return True 72 | # Normal hostnames 73 | elif typ == 'DNS' and val == hostname: 74 | return True 75 | else: 76 | return False 77 | 78 | 79 | def pyssl_check_expiration(cert): 80 | ''' Return the numbers of day before expiration. False if expired. ''' 81 | if 'notAfter' in cert: 82 | try: 83 | expire_date = datetime.strptime(cert['notAfter'], 84 | "%b %d %H:%M:%S %Y %Z") 85 | except: 86 | exit_error(1, 'Certificate date format unknow.') 87 | expire_in = expire_date - datetime.now() 88 | if expire_in.days > 0: 89 | return expire_in.days 90 | else: 91 | return False 92 | 93 | 94 | def main(): 95 | parser = argparse.ArgumentParser() 96 | parser.add_argument('host', help='specify an host to connect to') 97 | parser.add_argument('-p', '--port', help='specify a port to connect to', 98 | type=int, default=443) 99 | args = parser.parse_args() 100 | 101 | global HOST, PORT 102 | HOST = args.host 103 | PORT = args.port 104 | 105 | # Check the DNS name 106 | try: 107 | socket.getaddrinfo(HOST, PORT)[0][4][0] 108 | except socket.gaierror as e: 109 | exit_error(1, e) 110 | 111 | # Connect to the host and get the certificate 112 | sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 113 | sock.connect((HOST, PORT)) 114 | 115 | # If handled by python SSL library 116 | if not PYOPENSSL: 117 | try: 118 | ssl_sock = ssl.wrap_socket(sock, cert_reqs=ssl.CERT_REQUIRED, 119 | ca_certs=CA_CERTS, 120 | ciphers=("HIGH:-aNULL:-eNULL:" 121 | "-PSK:RC4-SHA:RC4-MD5")) 122 | 123 | cert = ssl_sock.getpeercert() 124 | if not pyssl_check_hostname(cert, HOST): 125 | print 'Error: Hostname does not match!' 126 | 127 | print pyssl_check_expiration(cert) 128 | 129 | sock = ssl_sock.unwrap() 130 | 131 | except ssl.SSLError as e: 132 | exit_error(1, e) 133 | 134 | # If handled by pyOpenSSL module 135 | else: 136 | try: 137 | ctx = SSL.Context(SSL.TLSv1_METHOD) 138 | ctx.set_verify(SSL.VERIFY_PEER | SSL.VERIFY_FAIL_IF_NO_PEER_CERT, 139 | pyopenssl_check_callback) 140 | ctx.load_verify_locations(CA_CERTS) 141 | 142 | ssl_sock = SSL.Connection(ctx, sock) 143 | ssl_sock.set_connect_state() 144 | ssl_sock.set_tlsext_host_name(HOST) 145 | ssl_sock.do_handshake() 146 | 147 | x509 = ssl_sock.get_peer_certificate() 148 | x509name = x509.get_subject() 149 | if x509name.commonName != HOST: 150 | print 'Error: Hostname does not match!' 151 | 152 | ssl_sock.shutdown() 153 | 154 | except SSL.Error as e: 155 | exit_error(1, e) 156 | 157 | sock.close() 158 | 159 | 160 | if __name__ == "__main__": 161 | main() -------------------------------------------------------------------------------- /Templates/SSL Certificates/check-ssl-expire.template.xml: -------------------------------------------------------------------------------- 1 | 2 |3 | 138 | -------------------------------------------------------------------------------- /Templates/SSL Certificates/ssl.cert.conf: -------------------------------------------------------------------------------- 1 | #UserParameter=ssl.cert.expire, /etc/zabbix/scripts/check-ssl-expire.py $(grep Hostname /etc/zabbix/zabbix_agentd.conf | grep ^# -v | cut -f2 -d=) 2 | #UserParameter=ssl.cert.expire[*], python /etc/zabbix/scripts/check-ssl-expire.py -p $2 $1 2>/dev/null 3 | UserParameter=ssl.cert.expire[*], /etc/zabbix/scripts/ssl-cert-check.sh -s $1 -p $2 -n | awk '{print $NF}' | cut -f2 -d= -------------------------------------------------------------------------------- /Templates/Tarantool/README.txt: -------------------------------------------------------------------------------- 1 | based on https://github.com/PushOk/tarantool_zabbix 2 | In /etc/zabbix/zabbix_agentd.conf follows: 3 | UnsafeUserParameters=1 4 | This allows special symbols in UserParameters: \ ' " ` * ? [ ] { } ~ $ ! & ; ( ) < > | # @ 5 | 6 | 7 | and set in Zabbix GUI macros to your server: 8 | {$TARANTOOLCTL} like so user:password@localhost:3301 -------------------------------------------------------------------------------- /Templates/Tarantool/tarantool-params.conf: -------------------------------------------------------------------------------- 1 | UserParameter=tarantool-stats[*],/etc/zabbix/scripts/tarantool/tarantool-stats.sh $1 $2 $3 2 | UserParameter=tarantool-slab[*],/etc/zabbix/scripts/tarantool/tarantool-slab.sh $1 $2 3 | -------------------------------------------------------------------------------- /Templates/Tarantool/tarantool-slab.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "box.slab.info()" | tarantoolctl connect $1 2>/dev/null |grep "$2:" | head -n 1| awk -F':' '{print $2}' |sed -e"s/[ |\%]//g" 4 | -------------------------------------------------------------------------------- /Templates/Tarantool/tarantool-stats.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "box.stat()" | tarantoolctl connect $1 2>/dev/null |grep $2 -A 2 |grep $3| awk -F':' '{print $2}' |sed -e"s/ //g" 4 | -------------------------------------------------------------------------------- /Templates/WebSockets/README.txt: -------------------------------------------------------------------------------- 1 | monitoring web-socket's connection -------------------------------------------------------------------------------- /Templates/WebSockets/web.socket.check.conf: -------------------------------------------------------------------------------- 1 | UserParameter=web.socket.check[*], /etc/zabbix/scripts/web.socket.check.py $1 -------------------------------------------------------------------------------- /Templates/WebSockets/web.socket.check.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Checking possibility of socket connection 3 | 4 | import sys 5 | from websocket import create_connection 6 | 7 | host = sys.argv[1] 8 | 9 | #open connection, try to send message, recieve and close 10 | try: 11 | ws = create_connection("wss://%s" % (host)) 12 | ws.send("ping") 13 | result = ws.recv() 14 | ws.close() 15 | connectionState = 1 16 | except Exception: 17 | connectionState = 0 18 | 19 | print connectionState -------------------------------------------------------------------------------- /Templates/WebSockets/websocket.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |3.0 4 |2017-08-07T10:05:20Z 5 |6 | 10 |7 | 9 |Templates/Custom 8 |11 | 12 | Template SSL Cert Expire 13 | 85 |Template SSL Cert Expire 14 |15 | 16 | 20 |17 | 19 |Templates/Custom 18 |21 | 25 |22 | 24 |SSL certificate 23 |26 | 70 |- 27 |
69 |SSL certificate validity: {$SSL.SITE} 28 |0 29 |30 | 0 31 |32 | ssl.cert.expire[{$SSL.SITE},{$SSL.PORT}] 33 |86400 34 |14 35 |365 36 |0 37 |0 38 |39 | days 40 |0 41 |42 | 43 | 0 44 |0 45 |46 | 0 47 |48 | 1 49 |50 | 51 | 52 | 0 53 |0 54 |55 | 56 | 57 | 58 | 59 | 60 | 0 61 |62 | 66 |63 | 65 |SSL certificate 64 |67 | 68 | 71 | 72 | 81 |73 | 76 |{$SSL.PORT} 74 |443 75 |77 | 80 |{$SSL.SITE} 78 |localhost 79 |82 | 83 | 84 | 86 | 137 |87 | 96 |{Template SSL Cert Expire:ssl.cert.expire[{$SSL.SITE},{$SSL.PORT}].nodata(86500)}=1 88 |SSL certificate on {$SSL.SITE}. No new data in the last 24h 89 |90 | 0 91 |2 92 |No data received for > 24h. Check the script. 93 |0 94 |95 | 97 | 106 |{Template SSL Cert Expire:ssl.cert.expire[{$SSL.SITE},{$SSL.PORT}].last(0)}<1 98 |SSL certificate on {$SSL.SITE} expired 99 |100 | 0 101 |5 102 |103 | 0 104 |105 | 107 | 121 |{Template SSL Cert Expire:ssl.cert.expire[{$SSL.SITE},{$SSL.PORT}].last(0)}<30 108 |SSL certificate on {$SSL.SITE} expires in less than 30 days ({ITEM.LASTVALUE} left) 109 |110 | 0 111 |3 112 |113 | 0 114 |115 | 120 |116 | 119 |SSL certificate on {$SSL.SITE} expired 117 |{Template SSL Cert Expire:ssl.cert.expire[{$SSL.SITE},{$SSL.PORT}].last(0)}<1 118 |122 | 136 |{Template SSL Cert Expire:ssl.cert.expire[{$SSL.SITE},{$SSL.PORT}].last(0)}<50 123 |SSL certificate on {$SSL.SITE} expires in less than 50 days ({ITEM.LASTVALUE} left) 124 |125 | 0 126 |1 127 |128 | 0 129 |130 | 135 |131 | 134 |SSL certificate on {$SSL.SITE} expires in less than 30 days ({ITEM.LASTVALUE} left) 132 |{Template SSL Cert Expire:ssl.cert.expire[{$SSL.SITE},{$SSL.PORT}].last(0)}<30 133 |WebSocket Test 4 | 64 | 65 |WebSocket Test
66 | 67 | 68 | -------------------------------------------------------------------------------- /Templates/WebSockets/websocket.template.xml: -------------------------------------------------------------------------------- 1 | 2 |3 | 89 | --------------------------------------------------------------------------------3.0 4 |2017-05-11T08:53:02Z 5 |6 | 10 |7 | 9 |Templates/Custom 8 |11 | 12 | Websocket Check 13 | 76 |Websocket Check 14 |15 | 16 | 20 |17 | 19 |Templates/Custom 18 |21 | 25 |22 | 24 |websocket 23 |26 | 70 |- 27 |
69 |web.socket.check 28 |0 29 |30 | 0 31 |32 | web.socket.check[api.looch.tv/chat?user=1] 33 |120 34 |7 35 |365 36 |0 37 |3 38 |39 | 40 | 0 41 |42 | 43 | 0 44 |0 45 |46 | 0 47 |48 | 1 49 |50 | 51 | 52 | 0 53 |0 54 |55 | 56 | 57 | 58 | 59 | 60 | 0 61 |62 | 66 |63 | 65 |websocket 64 |67 | 68 | 71 | 72 | 73 | 74 | 75 | 77 | 88 |78 | 87 |{Websocket Check:web.socket.check[api.looch.tv/chat?user=1].last()}<>1 79 |Check api.chat websocket 80 |81 | 1 82 |3 83 |84 | 0 85 |86 |