├── azia ├── azia.conf ├── README.markdown └── azia ├── templates ├── icecast_stats │ ├── icecast.conf │ ├── README │ ├── icecast_stats.pl │ └── icecast.xml ├── postgres_stats │ ├── postgres.conf │ ├── README │ └── postgres_stats.pl └── zabbix_internals │ └── README ├── Zabbix_Official_Templates_2.2.0 ├── PaxHeaders.4431 │ ├── Template_App_MySQL-2.2.0.xml │ ├── Template_ICMP_Ping-2.2.0.xml │ ├── Template_JMX_Tomcat-2.2.0.xml │ ├── Template_OS_AIX-2.2.0.xml │ ├── Template_OS_HP-UX-2.2.0.xml │ ├── Template_OS_Linux-2.2.0.xml │ ├── Template_OS_Mac_OS_X-2.2.0.xml │ ├── Template_App_FTP_Service-2.2.0.xml │ ├── Template_JMX_Generic-2.2.0.xml │ ├── Template_OS_Solaris-2.2.0.xml │ ├── Template_OS_Windows-2.2.0.xml │ ├── Template_SNMP_Device-2.2.0.xml │ ├── Template_SNMP_Disks-2.2.0.xml │ ├── Template_SNMP_Generic-2.2.0.xml │ ├── Template_SNMP_OS_Linux-2.2.0.xml │ ├── Template_Virt_VMware-2.2.0.xml │ ├── Template_App_HTTPS_Service-2.2.0.xml │ ├── Template_App_HTTP_Service-2.2.0.xml │ ├── Template_App_IMAP_Service-2.2.0.xml │ ├── Template_App_LDAP_Service-2.2.0.xml │ ├── Template_App_NNTP_Service-2.2.0.xml │ ├── Template_App_NTP_Service-2.2.0.xml │ ├── Template_App_POP_Service-2.2.0.xml │ ├── Template_App_SMTP_Service-2.2.0.xml │ ├── Template_App_SSH_Service-2.2.0.xml │ ├── Template_App_Telnet_Service-2.2.0.xml │ ├── Template_App_Zabbix_Agent-2.2.0.xml │ ├── Template_App_Zabbix_Proxy-2.2.0.xml │ ├── Template_App_Zabbix_Server-2.2.0.xml │ ├── Template_IPMI_Intel_SR1530-2.2.0.xml │ ├── Template_IPMI_Intel_SR1630-2.2.0.xml │ ├── Template_SNMP_Interfaces-2.2.0.xml │ ├── Template_SNMP_OS_Windows-2.2.0.xml │ ├── Template_SNMP_Processors-2.2.0.xml │ ├── Template_Virt_VMware_Guest-2.2.0.xml │ └── Template_Virt_VMware_Hypervisor-2.2.0.xml ├── Template_SNMP_Device-2.2.0.xml ├── Template_SNMP_OS_Linux-2.2.0.xml ├── Template_SNMP_OS_Windows-2.2.0.xml ├── Template_App_FTP_Service-2.2.0.xml ├── Template_App_NTP_Service-2.2.0.xml ├── Template_App_POP_Service-2.2.0.xml ├── Template_App_SSH_Service-2.2.0.xml ├── Template_App_HTTP_Service-2.2.0.xml ├── Template_App_IMAP_Service-2.2.0.xml ├── Template_App_LDAP_Service-2.2.0.xml ├── Template_App_NNTP_Service-2.2.0.xml ├── Template_App_SMTP_Service-2.2.0.xml ├── Template_App_HTTPS_Service-2.2.0.xml ├── Template_App_Telnet_Service-2.2.0.xml ├── Template_SNMP_Processors-2.2.0.xml ├── Template_App_Zabbix_Agent-2.2.0.xml ├── Template_ICMP_Ping-2.2.0.xml ├── Template_SNMP_Generic-2.2.0.xml ├── Template_Virt_VMware-2.2.0.xml ├── Template_SNMP_Disks-2.2.0.xml └── Template_SNMP_Interfaces-2.2.0.xml ├── lld ├── zabbix.disks.tps ├── lld.conf └── zabbix.blockdevices.discovery ├── README.markdown ├── scripts ├── traptozabbix ├── dnt.py ├── housekeeping.sh ├── disable_unsupported.pl └── autoaddfs.pl ├── saci ├── saci.conf ├── README.markdown └── saci └── Zabbix_Official_Templates_2.0.0 ├── Template_SNMP_Device-2.0.0.xml ├── Template_SNMP_OS_Linux-2.0.0.xml ├── Template_SNMP_OS_Windows-2.0.0.xml ├── Template_SNMP_Processors-2.0.0.xml ├── Template_App_Zabbix_Agent-2.0.0.xml ├── Template_SNMP_Generic-2.0.0.xml └── Template_SNMP_Disks-2.0.0.xml /azia/azia.conf: -------------------------------------------------------------------------------- 1 | server = zabbix.homelinux 2 | user = apiuser 3 | password = apipass 4 | -------------------------------------------------------------------------------- /templates/icecast_stats/icecast.conf: -------------------------------------------------------------------------------- 1 | #Stats per Mount Pount 2 | UserParameter=icecast[*],/usr/local/bin/zabbix/icecast_stats $1 $2 3 | -------------------------------------------------------------------------------- /templates/postgres_stats/postgres.conf: -------------------------------------------------------------------------------- 1 | #Stats of postgres database 2 | UserParameter=postgres[*],sudo -u postgres /usr/local/bin/zabbix/postgres.stats $1 $2 3 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_App_MySQL-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 29 mtime=1384272820.30049745 2 | 30 atime=1384272824.301644244 3 | 30 ctime=1384272820.304497597 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_ICMP_Ping-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272824.293643951 2 | 30 atime=1384272824.302644281 3 | 30 ctime=1384272824.295644024 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_JMX_Tomcat-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 29 mtime=1384272822.37857369 2 | 30 atime=1384272824.304644354 3 | 30 ctime=1384272822.382573837 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_OS_AIX-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272820.922520271 2 | 30 atime=1384272824.304644354 3 | 30 ctime=1384272820.924520344 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_OS_HP-UX-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272821.375536891 2 | 30 atime=1384272824.306644427 3 | 30 ctime=1384272821.377536964 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_OS_Linux-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272818.372426713 2 | 30 atime=1384272824.306644427 3 | 30 ctime=1384272818.374426786 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_OS_Mac_OS_X-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 29 mtime=1384272821.76255109 2 | 30 atime=1384272824.307644464 3 | 28 ctime=1384272821.7655512 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_App_FTP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272822.962595117 2 | 30 atime=1384272824.301644244 3 | 29 ctime=1384272822.96459519 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_JMX_Generic-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272822.193566903 2 | 30 atime=1384272824.302644281 3 | 30 ctime=1384272822.196567013 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_OS_Solaris-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272821.593544889 2 | 30 atime=1384272824.308644501 3 | 30 ctime=1384272821.594544926 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_OS_Windows-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272821.942557694 2 | 30 atime=1384272824.308644501 3 | 30 ctime=1384272821.945557804 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_SNMP_Device-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272819.345462412 2 | 30 atime=1384272824.309644538 3 | 30 ctime=1384272819.348462522 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_SNMP_Disks-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272819.596471621 2 | 30 atime=1384272824.309644538 3 | 30 ctime=1384272819.599471731 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_SNMP_Generic-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272819.217457715 2 | 30 atime=1384272824.309644538 3 | 30 ctime=1384272819.221457862 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_SNMP_OS_Linux-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 29 mtime=1384272819.71447595 2 | 30 atime=1384272824.310644574 3 | 29 ctime=1384272819.71747606 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_Virt_VMware-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 29 mtime=1384272822.51757879 2 | 30 atime=1384272824.310644574 3 | 30 ctime=1384272822.518578827 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_App_HTTPS_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272823.202603922 2 | 30 atime=1384272824.301644244 3 | 30 ctime=1384272823.203603959 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_App_HTTP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272823.080599446 2 | 30 atime=1384272824.301644244 3 | 29 ctime=1384272823.08259952 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_App_IMAP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272823.316608105 2 | 30 atime=1384272824.301644244 3 | 30 ctime=1384272823.320608252 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_App_LDAP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272823.434612434 2 | 30 atime=1384272824.301644244 3 | 30 ctime=1384272823.437612545 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_App_NNTP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272823.574617571 2 | 30 atime=1384272824.301644244 3 | 30 ctime=1384272823.575617608 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_App_NTP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272823.688621754 2 | 30 atime=1384272824.301644244 3 | 30 ctime=1384272823.691621864 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_App_POP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272823.817626486 2 | 30 atime=1384272824.301644244 3 | 30 ctime=1384272823.818626523 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_App_SMTP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272823.931630669 2 | 30 atime=1384272824.301644244 3 | 30 ctime=1384272823.933630742 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_App_SSH_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272824.048634962 2 | 30 atime=1384272824.301644244 3 | 30 ctime=1384272824.051635072 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_App_Telnet_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272824.170639438 2 | 30 atime=1384272824.301644244 3 | 30 ctime=1384272824.172639511 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_App_Zabbix_Agent-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272818.921446855 2 | 30 atime=1384272824.301644244 3 | 30 ctime=1384272818.924446965 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_App_Zabbix_Proxy-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272818.802442489 2 | 30 atime=1384272824.301644244 3 | 30 ctime=1384272818.805442599 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_App_Zabbix_Server-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384285530.395465177 2 | 30 atime=1384285982.634089379 3 | 30 ctime=1384285530.395465177 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_IPMI_Intel_SR1530-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272819.994486223 2 | 30 atime=1384272824.302644281 3 | 30 ctime=1384272819.997486333 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_IPMI_Intel_SR1630-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 29 mtime=1384272820.16149235 2 | 30 atime=1384272824.302644281 3 | 30 ctime=1384272820.163492423 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_SNMP_Interfaces-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272819.089453019 2 | 30 atime=1384272824.309644538 3 | 30 ctime=1384272819.091453093 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_SNMP_OS_Windows-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272819.469466961 2 | 30 atime=1384272824.310644574 3 | 30 ctime=1384272819.472467071 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_SNMP_Processors-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272819.831480243 2 | 30 atime=1384272824.310644574 3 | 30 ctime=1384272819.835480389 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_Virt_VMware_Guest-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272822.682584844 2 | 30 atime=1384272824.310644574 3 | 30 ctime=1384272822.685584954 4 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/PaxHeaders.4431/Template_Virt_VMware_Hypervisor-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 30 mtime=1384272822.840590641 2 | 30 atime=1384272824.310644574 3 | 30 ctime=1384272822.844590788 4 | -------------------------------------------------------------------------------- /lld/zabbix.disks.tps: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | STATS=$(/usr/bin/iostat -d 1 1 $1 | grep -v Device | grep -v Linux | awk '{print $2}' | sed 's/,/./g') 3 | 4 | if [ -z $STATS ] ; then 5 | echo "NOT SUPPORTED" 6 | else 7 | echo $STATS 8 | fi 9 | -------------------------------------------------------------------------------- /lld/lld.conf: -------------------------------------------------------------------------------- 1 | ## User Parameter for low level discovery 2 | ## Block Devices TPS and block devices discovery 3 | UserParameter=disks.tps[*],/usr/local/bin/zabbix.disks.tps $1 4 | UserParameter=block.devices.discovery,/usr/local/bin/zabbix.blockdevices.discovery 5 | -------------------------------------------------------------------------------- /lld/zabbix.blockdevices.discovery: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | 4 | print "{\n"; 5 | print "\t\"data\":[\n\n"; 6 | 7 | for (`/usr/bin/iostat -d 1 1 | grep -v Device | grep -v Linux| awk '{print \$1}' | sed '/^\$/d' `) 8 | { 9 | chomp $_ ; 10 | print "\t{\n"; 11 | print "\t\t\"{#BLOCKDEVICE}\":\"$_\",\n"; 12 | print "\t}\n"; 13 | } 14 | print "\n\t]\n"; 15 | print "}\n"; 16 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | Collection of stuffs for [zabbix] [1] 2 | ====================================== 3 | 4 | Here, you will find pieces of work done in [zabbix] [1]. 5 | 6 | Theres **SACI**, a nice plugin to integrate [zabbix] [1] and [OTRS][2], 7 | the **azia**, a cli to add, remove and list stuffs in [zabbix][1] and 8 | some templates and scripts used for automated tasks. 9 | 10 | Just clone and have fun. 11 | 12 | [1]: http://zabbix.com "Zabbix" 13 | [2]: http://otrs.org "OTRS" 14 | -------------------------------------------------------------------------------- /templates/zabbix_internals/README: -------------------------------------------------------------------------------- 1 | This is template I use for small, medium and large Zabbix Installs. 2 | It show me the queue status, cache status, values per second, 3 | Itens supported and unsupported. 4 | 5 | I also use this template to understand my client's zabbix install and 6 | determine what type of zabbix tuning is needed. Usefull when used in 7 | conjunction with my or other Postgres and General Linux Server templates. 8 | 9 | After import, go outside, take a walk or go to the near Music Instruments 10 | Shop and play a nice and sweet Gibson ES-335. :-) 11 | -------------------------------------------------------------------------------- /scripts/traptozabbix: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | #AGPL 4 | 5 | # This is a snmptrapd handler script to convert snmp traps into zabbix 6 | # traps. 7 | 8 | use strict ; 9 | use warnings; 10 | my ($zabbixserver, $zabbixkey, $value ) = @ARGV ; 11 | 12 | 13 | #Path for zabbix_sender command 14 | 15 | my $zabbix_sender = "/usr/bin/zabbix_sender" ; 16 | my $zabbix_config = "/etc/zabbix/zabbix_agentd.conf" ; 17 | 18 | #Stripping hostname. The same are used in zabbix. 19 | 20 | my $hostname = ; 21 | chomp($hostname); 22 | 23 | system("$zabbix_sender -c $zabbix_config -z $zabbixserver -s $hostname -k $zabbixkey -o $value") ; 24 | 25 | -------------------------------------------------------------------------------- /saci/saci.conf: -------------------------------------------------------------------------------- 1 | #Your subject to open tickets. 2 | open_subject = "PROBLEM" 3 | 4 | #Your subject to close tickets. 5 | close_subject = "OK" 6 | 7 | #SOAP user and password in OTRS 8 | soap_user = "otrs" 9 | soap_password = "otrs" 10 | 11 | #Queue, lock and priority options 12 | open_queue = "Raw" 13 | lock = "unlock" 14 | priority = "3 normal" 15 | open_state = "new" 16 | mail_customer = "customer@company.com" 17 | 18 | #UserID and OwnerID must be passed to OTRS. 19 | open_user = 1 20 | open_owner = 1 21 | close_user = 1 22 | 23 | responsible = "responsible@company.com" 24 | mail_from = "zabbix@company.com" 25 | mail_to = "sysadmins@company.com" 26 | close_state = "closed" 27 | -------------------------------------------------------------------------------- /scripts/dnt.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | from getpass import getpass 3 | from pyzabbix import ZabbixAPI 4 | ZABBIX_SERVER = 'http://192.168.1.102/zabbix' 5 | zapi = ZabbixAPI(ZABBIX_SERVER) 6 | zapi.login('apiuser', 'apipass') 7 | 8 | #Get a hostlist 9 | hostlist = zapi.host.get(output='extend') 10 | 11 | 12 | for host in hostlist: 13 | print "Clean not templated items from", host['name'] 14 | itemlist = zapi.item.get(output='extend', filter={"hostid": host['hostid']} ) 15 | 16 | #Templateid is "0" for non-templated, something else for templated item 17 | for i in itemlist: 18 | if i['templateid'] == "0": 19 | zapi.item.delete(i['itemid']) 20 | print i['name'], " - deleted" 21 | else: 22 | print i['name'], " - preserved" 23 | -------------------------------------------------------------------------------- /templates/icecast_stats/README: -------------------------------------------------------------------------------- 1 | To put this script to work, you must: 2 | 3 | 0 - Read the script. It's very short an simple. 4 | 5 | 1 - Put above line in your crontab: 6 | wget --user=user --password=password http://your_icecast_address:8080/admin/stats.xml -O /tmp/stats.xml 7 | 8 | 2 - Put the script in /usr/local/bin/zabbix/icecast_stats (or where you want. After all, you are the Sysadmin, right? :-) ) 9 | with execute permission 10 | 11 | 3 - Put the content of icecast.conf in your zabbix configuration file. 12 | 13 | 4 - Install the XML::Simple perl module. If you use Debian, this package resolve: libxml-simple-perl 14 | If you don't use Debian, you should use your package system or CPAN for install XML::Simple module. 15 | 16 | 5 - Create the itens inside Zabbix and watch for results. 17 | 18 | 6 - Enjoy. :D 19 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_SNMP_Device-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:39Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.0.0/Template_SNMP_Device-2.0.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2012-06-08T18:27:15Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_SNMP_OS_Linux-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:39Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_SNMP_OS_Windows-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:39Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.0.0/Template_SNMP_OS_Linux-2.0.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2012-06-08T18:27:16Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.0.0/Template_SNMP_OS_Windows-2.0.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2012-06-08T18:27:15Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /saci/README.markdown: -------------------------------------------------------------------------------- 1 | SACI plugin for [zabbix] [1] 2 | ============================== 3 | 4 | If you want Zabbix opening and closing tickets through [OTRS] [2] api, you want 5 | install and test SACI plugin. 6 | 7 | **SACI** is resulted from need of integration between these great open source tools. 8 | 9 | To make a multi scenario plugin, I'm using AppConfig perl module. 10 | If you can't or dont want install AppConfig perl module, , you can hack the SACI 11 | to make options hardcoded. 12 | 13 | Well, to make this magic works: 14 | 15 | 1. Install `SOAP::LITE`, `Data::Dumper` and `AppConfig` perl modules (distribution packages or by CPAN, your call here! ) 16 | 17 | 2. Configure all saci variables and test using follow commands: 18 | 19 | *PROBLEM* and *OK* are your trigger subject given by zabbix {TRIGGER.STATUS) macro. 20 | 21 | The body of trigger must be *{HOSTNAME}:{TRIGGER.NAME}*. 22 | 23 | ```` bash 24 | $ perl saci saci.conf PROBLEM hostname trigger_name 25 | $ perl saci saci.conf OK hostname trigger_name 26 | ```` 27 | 28 | 3. Configure Zabbix Media to use saci script. 29 | 30 | 4. Configure your user to use saci media, and use the path for config path in 'send to' field. 31 | 32 | 5. Configure the actions and be happy. =) 33 | 34 | 35 | [1]: http://zabbix.com "Zabbix" 36 | [2]: http://otrs.org "OTRS" 37 | -------------------------------------------------------------------------------- /azia/README.markdown: -------------------------------------------------------------------------------- 1 | The 'Another [Zabbix][1] Interface Administration' 2 | ================================================== 3 | 4 | **Azia** is the acronym for 'Another Zabbix Interface Administration', 5 | but you can use 'Armoured Zombies Initiating Assault' or 'Adventure 6 | Zork is Amazing'. Zombies and Zork have your own role in a SysAdmins life, 7 | but Zabbix are fun (and very important) in your own way. ;) 8 | 9 | The primary function of azia is provide access to Zabbix using unix environment. 10 | You can add, list or remove things using the unix shell. Have a non interactive 11 | cli is important to create and improve routines of maintenance and monitoring. 12 | 13 | You'll need provide an user and password for Zabbix API, support for executing 14 | perl scripts and [`ZabbixAPI.pm`][2] and [`JSON`][3] and [`LWP::UserAgent`][4] modules. 15 | 16 | `JSON` and `LWP::UserAgent` can be obtained by [`CPAN`] [5] or your unix package management. 17 | 18 | The `ZabbixAPI.pm` can be fetched from [Mikeda's] [6] github repository in: 19 | 20 | After install modules, adjust your configuration file. 21 | 22 | If you don't pass the configuration file parameter with -c flag, the script 23 | will look at /etc/azia.conf file. 24 | 25 | 26 | Note: azia is brazilian portuguese for 'heartburn'. 27 | 28 | [1]: http://zabbix.com "Zabbix" 29 | [2]: https://github.com/mikeda/ZabbixAPI.git "ZabbixAPI.pm" 30 | [3]: http://search.cpan.org/~makamaka/JSON-2.53/lib/JSON.pm "JSON" 31 | [4]: http://search.cpan.org/~gaas/libwww-perl-6.02/lib/LWP/UserAgent.pm "LWP" 32 | [5]: http://www.cpan.org/ "CPAN" 33 | [5]: https://github.com/mikeda "Mikeda repository" 34 | 35 | 36 | -------------------------------------------------------------------------------- /templates/postgres_stats/README: -------------------------------------------------------------------------------- 1 | The script provides data collection for your PgSQL databases. 2 | In Zabbix template, the items started with db_prefix are for 3 | individual database stats. For example, if you need the number of 4 | total commits for zabbix database, you must enter with key: 5 | "postgres[db_commits,zabbix]" in your zabbix configuration. 6 | 7 | To make this scripts works, you must execute some easy steps: 8 | 9 | 1 - Read the script. It's nice and I will be glad. ( Even if you don't like perl. ) 10 | 11 | 2 - Put the script under /usr/local/bin/zabbix or in any directory, 12 | and don't forget to set permissions for postgres user/group. 13 | 14 | 3 - Put the bellow content inside your /etc/sudoers file: 15 | 16 | # User Zabbix Session: needed for run some checks with Zabbix users. 17 | zabbix ALL = (postgres) NOPASSWD: /usr/local/bin/zabbix/postgres_stats 18 | 19 | 4 - Install the contrib package for postgres, and install these sqls: 20 | (You don't need reload the database :-) ) 21 | pg_buffercache.sql 22 | pg_freespacemap.sql 23 | pgstattuple.sql 24 | 25 | 5 - Install the libdbi-perl and libdbd-pg-perl packages if you use Debian/Ubuntu, 26 | or install these modules using CPAN if your package system don't provides them. 27 | 28 | 6 - Import the postgres.xml template in your zabbix installation. 29 | (We don't have graphs until this time). 30 | 31 | 7 - Put the content of postgres.conf in your zabbix agent configuration file. 32 | 33 | 8 - Set the monitoring itens for global and individual databases. 34 | 35 | 9 - Test, and send some bugs if you find one. (or corretion, who knows...) 36 | 37 | 10 - Go outside, take a walk or some beers with someone nice. 38 | -------------------------------------------------------------------------------- /scripts/housekeeping.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Manual housekeeping for mediums and large installations 3 | # running with PostgreSQL, suffering with housekeeping curse. :D 4 | # 5 | # Copyright (C) <2011>-<2013> , 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | 21 | 22 | #Setting atual date 23 | echo $(date +%d/%m/%Y-%H:%M) 24 | 25 | #One year and month ago in Unix Timestamp 26 | ONE_YEAR_AGO=$(expr `date +%s` - 31536000) 27 | ONE_MONTH_AGO=$(expr `date +%s` - 2678400) 28 | 29 | #Queries for one month ago 30 | MONTH_TABLES="history history_uint history_str history_text history_log" 31 | for table in $MONTH_TABLES 32 | do 33 | DELETES=$( /usr/bin/psql --dbname zabbix -c "delete from $table where clock < $ONE_MONTH_AGO ;" ) 34 | echo " $DELETES from table $table " 35 | done 36 | 37 | 38 | 39 | #Queries for one year ago 40 | YEAR_TABLES="alerts trends trends_uint" 41 | for table in $YEAR_TABLES 42 | do 43 | DELETES=$(/usr/bin/psql --dbname zabbix -c "delete from $table where clock < $ONE_YEAR_AGO ;") 44 | echo " $DELETE from table $table " 45 | done 46 | 47 | -------------------------------------------------------------------------------- /templates/icecast_stats/icecast_stats.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # Script to parse and print Icecast stats xml file. 3 | # 4 | # Copyright (C) <2011> , 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | # 19 | 20 | use XML::Simple; 21 | use Data::Dumper; 22 | use strict ; 23 | use warnings ; 24 | 25 | my $result = XMLin("/tmp/icecast_stats.xml",KeyAttr => {source => "+mount"}); 26 | my ($mount_point, $option ) = @ARGV ; 27 | 28 | if ( $mount_point eq "global" ) { 29 | print $result->{$option} . "\n" ; } 30 | elsif ( $mount_point and $option ) { 31 | print $result->{source}->{$mount_point}->{$option} . "\n" ; } 32 | elsif ($mount_point eq "debug" ) { 33 | print Dumper($result). "\n" ; } 34 | 35 | unless ($mount_point) { 36 | print "Usage instructions:" . "\n"; 37 | print "$0 global listeners -> Obtain global listeners number" . "\n" ; 38 | print "$0 global listener_connections -> Obtain global listeners_connections number" . "\n" ; 39 | print "$0 /mountpoint listeners -> Obtain mountpoint listeners number" . "\n" ; 40 | print "$0 /mountpoint peak_listeners -> Obtain mountpoint peak_listener number" . "\n" ; 41 | print "$0 debug -> Show the parsed XML file. Useful to see all values allowed ;)" . "\n" ; } 42 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_App_FTP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:43Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 75 | 76 | 77 | 78 | {Template App FTP Service:net.tcp.service[ftp].max(#3)}=0 79 | FTP service is down on {HOST.NAME} 80 | 81 | 0 82 | 3 83 | 84 | 0 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_App_NTP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:43Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 75 | 76 | 77 | 78 | {Template App NTP Service:net.tcp.service[ntp].max(#3)}=0 79 | NTP service is down on {HOST.NAME} 80 | 81 | 0 82 | 3 83 | 84 | 0 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_App_POP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:43Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 75 | 76 | 77 | 78 | {Template App POP Service:net.tcp.service[pop].max(#3)}=0 79 | POP service is down on {HOST.NAME} 80 | 81 | 0 82 | 3 83 | 84 | 0 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_App_SSH_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:44Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 75 | 76 | 77 | 78 | {Template App SSH Service:net.tcp.service[ssh].max(#3)}=0 79 | SSH service is down on {HOST.NAME} 80 | 81 | 0 82 | 3 83 | 84 | 0 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_App_HTTP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:43Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 75 | 76 | 77 | 78 | {Template App HTTP Service:net.tcp.service[http].max(#3)}=0 79 | HTTP service is down on {HOST.NAME} 80 | 81 | 0 82 | 3 83 | 84 | 0 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_App_IMAP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:43Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 75 | 76 | 77 | 78 | {Template App IMAP Service:net.tcp.service[imap].max(#3)}=0 79 | IMAP service is down on {HOST.NAME} 80 | 81 | 0 82 | 3 83 | 84 | 0 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_App_LDAP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:43Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 75 | 76 | 77 | 78 | {Template App LDAP Service:net.tcp.service[ldap].max(#3)}=0 79 | LDAP service is down on {HOST.NAME} 80 | 81 | 0 82 | 3 83 | 84 | 0 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_App_NNTP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:43Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 75 | 76 | 77 | 78 | {Template App NNTP Service:net.tcp.service[nntp].max(#3)}=0 79 | NNTP service is down on {HOST.NAME} 80 | 81 | 0 82 | 3 83 | 84 | 0 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_App_SMTP_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:44Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 75 | 76 | 77 | 78 | {Template App SMTP Service:net.tcp.service[smtp].max(#3)}=0 79 | SMTP service is down on {HOST.NAME} 80 | 81 | 0 82 | 3 83 | 84 | 0 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_App_HTTPS_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:43Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 75 | 76 | 77 | 78 | {Template App HTTPS Service:net.tcp.service[https].max(#3)}=0 79 | HTTPS service is down on {HOST.NAME} 80 | 81 | 0 82 | 3 83 | 84 | 0 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_App_Telnet_Service-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:44Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 75 | 76 | 77 | 78 | {Template App Telnet Service:net.tcp.service[telnet].max(#3)}=0 79 | Telnet service is down on {HOST.NAME} 80 | 81 | 0 82 | 3 83 | 84 | 0 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /scripts/disable_unsupported.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # Script to disable unsuported itens. No funny headers today. 3 | # 4 | # Copyright (C) <2011> , 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | 20 | use JSON ; 21 | use JSON::RPC::Client ; 22 | use Data::Dumper ; 23 | use strict ; 24 | use warnings ; 25 | 26 | #JSON Authentication and server variables - Adjust for your environment 27 | my ($zabbix, $api_user, $api_passwd) = ("http://zabbix.homelinux/zabbix/api_jsonrpc.php", "apiuser", "apipass" ) ; 28 | 29 | #Setting user agent 30 | my $client = new JSON::RPC::Client ; 31 | $client->ua->credentials("$zabbix", 'Transmission RPC Server', $api_user ) ; 32 | 33 | #Setting Authentication 34 | my $auth = { 35 | jsonrpc => "2.0", 36 | method => "user.authenticate", 37 | params => { 38 | user => "$api_user", 39 | password => "$api_passwd", 40 | }, 41 | id => 1, 42 | } ; 43 | 44 | #Execute authentication and retrieve auth string 45 | my $authentication = $client->call($zabbix,$auth); 46 | $auth = $authentication->result ; 47 | 48 | 49 | my @itemids = item_search($zabbix,$auth,$client) ; 50 | foreach my $itemid (@itemids) { 51 | disable($zabbix, $auth, $client, $itemid) ; 52 | print "The item $itemid is now disabled \n" 53 | } 54 | 55 | ##Functions 56 | sub item_search { 57 | my ($zabbix, $auth, $client) = @_ ; 58 | my $query = { 59 | jsonrpc => "2.0", 60 | method => "item.get", 61 | params => { 62 | output => "short", 63 | filter => { 64 | status => 3, 65 | }, 66 | }, 67 | auth => $auth, 68 | id => 1, 69 | }; 70 | my $unsup_items = parse($zabbix, $client, $query) ; 71 | my $total = scalar @{$unsup_items} ; 72 | print "Found $total items unsupported. \n"; 73 | my @itemids ; 74 | foreach ( my $count=0 ; $count < $total ; $count++ ) { 75 | push(@itemids, @{$unsup_items}[$count]->{"itemid"} ) ; 76 | } 77 | return @itemids ; 78 | } 79 | 80 | sub disable { 81 | my ($zabbix, $auth, $client, $itemid) = @_ ; 82 | my $query = { 83 | jsonrpc => "2.0", 84 | method => "item.update", 85 | params => { 86 | itemid => $itemid, 87 | status => 1, 88 | }, 89 | auth => $auth, 90 | id => 1, 91 | }; 92 | parse($zabbix, $client, $query); 93 | } 94 | 95 | sub parse { 96 | my ($zabbix, $client, $query ) = @_ ; 97 | my $json_query = $client->call($zabbix,$query); 98 | my $json_result = $json_query->result ; 99 | return $json_result ; 100 | } 101 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_SNMP_Processors-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:39Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.0.0/Template_SNMP_Processors-2.0.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2012-06-08T18:27:16Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /templates/icecast_stats/icecast.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 0 6 | 1 7 | 8 | 127.0.0.1 9 | 10050 10 | 3 11 | 0 12 | 127.0.0.1 13 | 623 14 | 0 15 | 2 16 | 17 | 18 | 19 | Templates 20 | 21 | 22 | 23 | 24 | Icecast global listeners 25 | 26 | 120 27 | 90 28 | 365 29 | 1 30 | 0 31 | 32 | 0 33 | 0 34 | 0 35 | 0 36 | 37 | 38 | 0 39 | 40 | 41 | 42 | 43 | 44 | localhost 45 | 46 | 47 | 161 48 | 49 | 0 50 | 51 | 52 | 53 | Icecast 54 | 55 | 56 | 57 | Icecast /mount_point listeners 58 | 59 | 120 60 | 90 61 | 365 62 | 1 63 | 0 64 | 65 | 0 66 | 0 67 | 0 68 | 0 69 | 70 | 71 | 0 72 | 73 | 74 | 75 | 76 | 77 | localhost 78 | 79 | 80 | 161 81 | 82 | 0 83 | 84 | 85 | 86 | Icecast 87 | 88 | 89 | 90 | Icecast /mount_point listeners 91 | 92 | 120 93 | 90 94 | 365 95 | 1 96 | 0 97 | 98 | 0 99 | 0 100 | 0 101 | 0 102 | 103 | 104 | 0 105 | 106 | 107 | 108 | 109 | 110 | localhost 111 | 112 | 113 | 161 114 | 115 | 0 116 | 117 | 118 | 119 | Icecast 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /azia/azia: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # azia is an interface to manipulating itens inside zabbix without 4 | # access database directly. Azia don't have, and I'll provide any 5 | # kind of graphical, text or interactive interface, but you're free 6 | # to do it if you want. =) 7 | 8 | # Copyright (C) <2011> , 9 | # 10 | # 11 | # This program is free software: you can redistribute it and/or modify 12 | # it under the terms of the GNU Affero General Public License as 13 | # published by the Free Software Foundation, either version 3 of the 14 | # License, or (at your option) any later version. 15 | # 16 | # This program is distributed in the hope that it will be useful, 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | # GNU Affero General Public License for more details. 20 | # 21 | # You should have received a copy of the GNU Affero General Public License 22 | # along with this program. If not, see . 23 | # 24 | 25 | 26 | # TODO: 27 | # List ( hosts, items, triggers and maintenance periods) 28 | # Delete ( groups, items, triggers, maintenance period and all ) 29 | # Maintenance(hosts, groups) 30 | # Remove (from groups, from templates) 31 | 32 | use warnings; 33 | use strict; 34 | use Data::Dumper; 35 | use AppConfig qw/:argcount/; 36 | use Getopt::Long; 37 | use ZabbixAPI; 38 | 39 | # Used to call sub routines 40 | my $add ; 41 | my $delete ; 42 | my $list ; 43 | my $help ; 44 | my $verbose ; 45 | my $maintenance ; 46 | 47 | # Used to receive values 48 | my $ip ; 49 | my $hostname ; 50 | my @templates; 51 | my @groups ; 52 | my @configs ; 53 | my $port ; 54 | my $config_file; 55 | unless ($port) { $port = 10050 ; } 56 | unless ($config_file) { $config_file = "/etc/azia.conf" ; } 57 | 58 | GetOptions ( 59 | 'a|add' => \$add, 60 | 'c|config=s' => \$config_file, 61 | 'd|delete' => \$delete, 62 | 'g|groups=s@' => \@groups, 63 | 'h|hostname=s' => \$hostname, 64 | 'i|ip=s' => \$ip, 65 | 'l|list' => \$list, 66 | 'm|maintenance' => \$maintenance, 67 | 'p|port=s' => \$port, 68 | 't|templates=s@' => \@templates, 69 | 'help' => \$help, 70 | 'verbose' => \$verbose, 71 | ); 72 | 73 | if ($help) { help() ; exit 0 } 74 | 75 | 76 | my $config = AppConfig->new() ; 77 | 78 | $config->define( 79 | 'SERVER', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 80 | 'USER', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 81 | 'PASSWORD', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 82 | ); 83 | 84 | #Parsing config file 85 | $config->file($config_file) ; 86 | 87 | #Calling Zabbix API 88 | my $zabbix = ZabbixAPI->new("http://".$config->SERVER()."/zabbix/"); 89 | $zabbix->auth($config->USER(), $config->PASSWORD() ); 90 | 91 | if ($add) { 92 | unless ($hostname) { help() ; exit 0 } 93 | else { 94 | my $groupids = $zabbix->hostgroup_get( 95 | { filter => { name => \@groups } }, 'groupid' ); 96 | 97 | my $templateids = $zabbix->template_get( 98 | { filter => { host => \@templates } }, 'templateid' ); 99 | 100 | my $result = $zabbix->host_create({ 101 | host => $hostname, 102 | ip => $ip, 103 | port => $port, 104 | useip => 1, 105 | groups => [ 106 | map {{groupid => $_}} @$groupids 107 | ], 108 | templates => [ 109 | map {{templateid => $_}} @$templateids 110 | ], 111 | }); 112 | } 113 | } 114 | 115 | elsif ($delete) { 116 | unless ($hostname) { help() ; exit 0 } 117 | else { 118 | my $hostid = $zabbix->host_get( 119 | { filter => { host => $hostname } }, 120 | 'hostid' ); 121 | 122 | my $result = $zabbix->host_delete( 123 | { hostid => @$hostid, } ); 124 | } 125 | } 126 | 127 | elsif ($list) { print "List: Must be created \n" ; exit 0 } 128 | elsif ($maintenance) { print "Maintenance: Must be created \n" ; exit 0 } 129 | else { help() ; exit 0 } 130 | 131 | sub help { 132 | print "Usage: azia -a -h machine -i 192.168.1.1 -g routers -t routing_template -t \"Linux Firewall\" \n"; 133 | print "Create, delete, list or put hosts in maintenance mode Zabbix. \n"; 134 | print "-a --add \t Add host to Zabbix. \n"; 135 | print "-d --delete \t Delete host from Zabbix. \n"; 136 | print "-c --config \t Config file for azia. If you don't use -c \n"; 137 | print "\t\t option, /etc/azia.conf will be used. \n"; 138 | print " \n"; 139 | print "-l --list \t List hosts from Zabbix. \n"; 140 | print "-i --ip \t Ip address from host. Used with -a. \n"; 141 | print "-h --hostname \t Hostname from host. Used with -a. \n"; 142 | print "\n"; 143 | print "-t --templates \t Templates to be used with -a. \n"; 144 | print "\t\t You can specify multiple templates using -t template_1 \n"; 145 | print "\t\t -t template_2. If your templates have spaces in name, they \n"; 146 | print "\t\t must be quoted. The same is applyed to -g option. \n"; 147 | print "\n"; 148 | print "-g --groups \t Groups from host. Used with -a. \n"; 149 | print "-p --port \t Port from host. Optional, used with -a. \n"; 150 | print "\t\t If you don't use -p option, port 10050 will be used. \n"; 151 | print "\n"; 152 | print "-m --maintenance \t Put your host in maintenance mode. \n"; 153 | } 154 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_App_Zabbix_Agent-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:39Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 159 | 160 | 161 | 162 | {Template App Zabbix Agent:agent.hostname.diff(0)}>0 163 | Host name of zabbix_agentd was changed on {HOST.NAME} 164 | 165 | 0 166 | 1 167 | 168 | 0 169 | 170 | 171 | 172 | {Template App Zabbix Agent:agent.version.diff(0)}>0 173 | Version of zabbix_agent(d) was changed on {HOST.NAME} 174 | 175 | 0 176 | 1 177 | 178 | 0 179 | 180 | 181 | 182 | {Template App Zabbix Agent:agent.ping.nodata(5m)}=1 183 | Zabbix agent on {HOST.NAME} is unreachable for 5 minutes 184 | 185 | 0 186 | 3 187 | 188 | 0 189 | 190 | 191 | 192 | 193 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_ICMP_Ping-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:44Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 159 | 160 | 161 | 162 | {Template ICMP Ping:icmppingloss.min(5m)}>20 163 | Ping loss is too high on {HOST.NAME} 164 | 165 | 0 166 | 2 167 | 168 | 0 169 | 170 | 171 | {HOST.NAME} is unavailable by ICMP 172 | {Template ICMP Ping:icmpping.max(#3)}=0 173 | 174 | 175 | 176 | 177 | {Template ICMP Ping:icmppingsec.avg(5m)}>0.15 178 | Response time is too high on {HOST.NAME} 179 | 180 | 0 181 | 2 182 | 183 | 0 184 | 185 | 186 | {HOST.NAME} is unavailable by ICMP 187 | {Template ICMP Ping:icmpping.max(#3)}=0 188 | 189 | 190 | 191 | 192 | {Template ICMP Ping:icmpping.max(#3)}=0 193 | {HOST.NAME} is unavailable by ICMP 194 | 195 | 0 196 | 3 197 | 198 | 0 199 | 200 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /saci/saci: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # -- 3 | # Sistema Automato de Cadastro de Incidentes (Automated System for Incident Register) 4 | # Who is saci? http://en.wikipedia.org/wiki/Saci_(Brazilian_folklore) 5 | # 6 | # Copyright (C) <2011> , 7 | # 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU Affero General Public License as 10 | # published by the Free Software Foundation, either version 3 of the 11 | # License, or (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU Affero General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU Affero General Public License 19 | # along with this program. If not, see . 20 | # 21 | 22 | use strict; 23 | use warnings; 24 | use Data::Dumper ; 25 | use AppConfig qw/:argcount/ ; 26 | 27 | use SOAP::Lite('autodispatch', proxy => "http://otrs.company.com/otrs/rpc.pl"); 28 | my $rpc_connect = Core->new() ; 29 | my $config = AppConfig->new() ; 30 | 31 | $config->define( 32 | 'SOAP_USER', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 33 | 'SOAP_PASSWORD', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 34 | 'OPEN_SUBJECT', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 35 | 'OPEN_QUEUE', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 36 | 'LOCK', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 37 | 'PRIORITY', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 38 | 'OPEN_STATE', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 39 | 'OPEN_OWNER', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 40 | 'OPEN_USER', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 41 | 'RESPONSIBLE', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 42 | 'MAIL_DOMAIN' => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 43 | 'MAIL_FROM', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 44 | 'MAIL_TO', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 45 | 'MAIL_CUSTOMER', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 46 | 'CLOSE_STATE', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 47 | 'CLOSE_USER', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 48 | 'CLOSE_SUBJECT', => { ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "none", }, 49 | ); 50 | 51 | my $config_file = shift @ARGV ; 52 | my $trigger_subject = shift @ARGV ; 53 | my $trigger_body = join(" ", @ARGV) ; 54 | 55 | unless($config_file) { $config_file = "saci.conf" } ; 56 | $config->file($config_file) ; 57 | 58 | my $soap_user = $config->SOAP_USER() ; 59 | my $soap_password = $config->SOAP_PASSWORD() ; 60 | my $open_subject = $config->OPEN_SUBJECT() ; 61 | my $open_queue = $config->OPEN_QUEUE() ; 62 | my $lock = $config->LOCK() ; 63 | my $priority = $config->PRIORITY() ; 64 | my $open_state = $config->OPEN_STATE() ; 65 | my $mail_customer = $config->MAIL_CUSTOMER() ; 66 | my $open_owner = $config->OPEN_OWNER() ; 67 | my $responsible = $config->RESPONSIBLE() ; 68 | my $mail_from = $config->MAIL_FROM() ; 69 | my $mail_to = $config->MAIL_TO() ; 70 | my $open_user = $config->OPEN_USER() ; 71 | my $close_state = $config->CLOSE_STATE ; 72 | my $close_user = $config->CLOSE_USER() ; 73 | my $close_subject = $config->CLOSE_SUBJECT() ; 74 | my ( $hostname, $trigger_name ) = split(/:/, $trigger_body) ; 75 | 76 | if ( $trigger_subject eq $open_subject ) { 77 | my @ticket_ids = search_ticket($hostname, $trigger_name) ; 78 | unless (@ticket_ids ) { 79 | open_ticket( $hostname, $trigger_name) } 80 | } 81 | 82 | if ( $trigger_subject eq $close_subject ) { 83 | my @ticket_ids = search_ticket($hostname, $trigger_name) ; 84 | if (@ticket_ids) { 85 | close_ticket(@ticket_ids) } 86 | } 87 | 88 | #-- Functions 89 | 90 | sub open_ticket { 91 | my ( $hostname, $trigger_name ) = @_ ; 92 | my $ticket_number = $rpc_connect->Dispatch( $soap_user, $soap_password, 'TicketObject','TicketCreateNumber'); 93 | my %ticket_data = ( 94 | TN => $ticket_number, 95 | Title => "$hostname: $trigger_name", 96 | Queue => $open_queue, 97 | Lock => $lock, 98 | Priority => $priority, 99 | State => $open_state, 100 | Customer => $mail_customer, 101 | CustomerUser => $mail_customer, 102 | OwnerID => $open_owner, 103 | UserID => $open_owner, 104 | Responsible => $responsible, 105 | ) ; 106 | my $ticket_id = $rpc_connect->Dispatch( $soap_user, $soap_password, 'TicketObject', 'TicketCreate', %ticket_data ) ; 107 | 108 | my %article_data = ( 109 | TicketID => $ticket_id, 110 | ArticleType => 'phone', 111 | SenderType => 'agent', 112 | From => $mail_from, 113 | To => $mail_to, 114 | Subject => "$hostname: $trigger_name", 115 | Body => "$hostname: $trigger_name", 116 | ContentType => 'text/plain; UTF-8', 117 | HistoryType => 'OwnerUpdate', 118 | HistoryComment => 'Auto Ticket', 119 | UserID => 1, 120 | NoAgentNotify => 0, 121 | AutoResponseType => 'auto reply', 122 | ); 123 | $rpc_connect->Dispatch( $soap_user, $soap_password, 'TicketObject', 'ArticleCreate', %article_data) ; 124 | } 125 | 126 | 127 | sub search_ticket { 128 | my ( $hostname, $trigger_name ) = @_ ; 129 | my %ticket_filter = ( 130 | Result => 'ARRAY' || 'HASH' || 'COUNT', 131 | StateType => 'Open', 132 | UserID => $open_user, 133 | Lock => $lock, 134 | Queue => $open_queue, 135 | OwnerID => $open_owner , 136 | ContentSearch => 'AND', 137 | Title => "$hostname: $trigger_name", 138 | ) ; 139 | my @found_ticket_ids = $rpc_connect->Dispatch( $soap_user, $soap_password, 'TicketObject', 'TicketSearch', %ticket_filter ) ; 140 | return @found_ticket_ids ; 141 | } 142 | 143 | sub close_ticket { 144 | my @ticket_ids = @_ ; 145 | foreach my $ticket_id (@ticket_ids) { 146 | my %ticket_status = ( 147 | State => $close_state, 148 | UserID => $close_user, 149 | TicketID => $ticket_id, 150 | ); 151 | $rpc_connect->Dispatch( $soap_user, $soap_password, 'TicketObject', 'TicketStateSet', %ticket_status ); 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.0.0/Template_App_Zabbix_Agent-2.0.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2012-06-08T18:27:13Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 150 | 151 | 152 | 153 | {Template App Zabbix Agent:agent.hostname.diff(0)}>0 154 | Host name of zabbix_agentd was changed on {HOSTNAME} 155 | 156 | 0 157 | 1 158 | 159 | 0 160 | 161 | 162 | 163 | {Template App Zabbix Agent:agent.version.diff(0)}>0 164 | Version of zabbix_agent(d) was changed on {HOSTNAME} 165 | 166 | 0 167 | 1 168 | 169 | 0 170 | 171 | 172 | 173 | {Template App Zabbix Agent:agent.ping.nodata(5m)}=1 174 | Zabbix agent on {HOSTNAME} is unreachable for 5 minutes 175 | 176 | 0 177 | 3 178 | 179 | 0 180 | 181 | 182 | 183 | 184 | -------------------------------------------------------------------------------- /scripts/autoaddfs.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # A script to parse fstab and create items and triggers inside Zabbix NMS 3 | # This is a work in progress, so, read the autoaddfs.README and cross your fingers 4 | # and don't blame me if this mess up your zabbix configuration. 5 | # 6 | # Copyright (C) <2011> , 7 | # 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | 21 | 22 | use JSON ; 23 | use JSON::RPC::Client ; 24 | use Data::Dumper ; 25 | use strict ; 26 | use warnings ; 27 | 28 | my @items ; 29 | #Get Itens to be created before all hard work ;) 30 | my $input_fh, " ) { 33 | #Super killer regex stolen from Gandalf ( @dcsobral ) :-) 34 | if ( $line =~ /^\s*[^#]\S*\s+(\S+)\s+(ext|nfs)/ ) { 35 | push @items, $1 ; 36 | } 37 | } 38 | close $input_fh ; 39 | 40 | #JSON Authentication and server variables - Adjust for your environment 41 | my ($zabbix, $api_user, $api_passwd) = ("http://zabbix.homelinux/zabbix/api_jsonrpc.php", "apiuser", "apipass" ) ; 42 | 43 | #Setting user agent 44 | my $client = new JSON::RPC::Client ; 45 | $client->ua->credentials("$zabbix", 'Transmission RPC Server', $api_user ) ; 46 | 47 | #Setting Authentication 48 | my $auth = { 49 | jsonrpc => "2.0", 50 | method => "user.authenticate", 51 | params => { 52 | user => "$api_user", 53 | password => "$api_passwd", 54 | }, 55 | id => 1, 56 | } ; 57 | 58 | #Execute authentication and retrieve auth string 59 | my $authentication = $client->call($zabbix,$auth); 60 | $auth = $authentication->result ; 61 | 62 | #FQDN generated by system command (yes, my zabbix hosts are named by fqdn) 63 | my $fqdn = `/bin/hostname -f` ; 64 | chomp ($fqdn) ; 65 | 66 | #Get the hostid 67 | my $hostid = get_hostid($zabbix,$auth,$client,$fqdn) ; 68 | 69 | #I'm able to recover a application id for filesystem, or whatever I need, 70 | #but I can't create item setting applications (like documentation says.) 71 | #Maybe a Zabbix API bug, maybe zombies joking with me. Who knows? 72 | 73 | #my $application = "Filesystem" ; 74 | #my $applicationid = get_applicationid($zabbix,$auth,$client,$hostid,$application) ; 75 | 76 | foreach my $item (@items) { 77 | chomp ($item) ; 78 | # A little homenage to my friend Gandalf, who patientily had show nice 79 | # things and gave me nice ideas. 80 | print "Calling the wizards to execute all hard work. =) \n" ; 81 | my $itemid = check_existence($zabbix,$auth,$client,$item,$hostid) ; 82 | unless ($itemid) { 83 | my $created_itemid = create_item($zabbix,$auth,$client,$item,$hostid) ; 84 | #I will put this ugly part into a hash someday... 85 | my @value = qw(20 10) ; 86 | my @priority = qw(2 3) ; 87 | create_trigger($zabbix,$auth,$client,$item,$fqdn,$value[0],$priority[0]) ; 88 | create_trigger($zabbix,$auth,$client,$item,$fqdn,$value[1],$priority[1]) ; 89 | } 90 | } 91 | 92 | exit 0 ; 93 | 94 | #The wizards :-) 95 | 96 | sub get_hostid { 97 | my ($zabbix, $auth, $client, $fqdn) = @_ ; 98 | my $query = { 99 | jsonrpc => "2.0", 100 | method => "host.get", 101 | params => { 102 | output => "extend", 103 | filter => { 104 | host => $fqdn, 105 | }, 106 | }, 107 | auth => $auth, 108 | id => 1, 109 | } ; 110 | my $key = "\"hostid\"" ; 111 | my $hostid = parse($zabbix,$client,$query,$key) ; 112 | unless ($hostid) { 113 | print "Unable to find $fqdn in Zabbix Server\n" ; 114 | print "Exiting before the room explode :-) \n" ; 115 | exit 0 ; } 116 | return $hostid ; 117 | } 118 | 119 | sub get_applicationid { 120 | my ( $zabbix, $auth, $client, $hostid, $application ) = @_ ; 121 | chomp ($application) ; 122 | my $query = { 123 | jsonrpc => "2.0", 124 | method => "application.get", 125 | params => { 126 | output => "extend", 127 | filter => { 128 | hostid => $hostid, 129 | }, 130 | search => { 131 | name => $application, 132 | }, 133 | }, 134 | auth => $auth, 135 | id => 1, 136 | } ; 137 | my $key = "\"applicationid\"" ; 138 | my $applicationid = parse($zabbix,$client,$query,$key) ; 139 | return $applicationid ; 140 | } 141 | sub check_existence { 142 | my ($zabbix, $auth, $client, $item, $hostid) = @_ ; 143 | my $query = { 144 | jsonrpc => "2.0", 145 | method => "item.get", 146 | params => { 147 | output => "extend", 148 | filter => { 149 | hostid => $hostid, 150 | }, 151 | search => { 152 | key_ => "vfs.fs.size[$item,pfree]", 153 | }, 154 | }, 155 | auth => $auth, 156 | id => 1, 157 | } ; 158 | my $key = "\"itemid\"" ; 159 | my $itemid = parse($zabbix,$client,$query,$key) ; 160 | if ($itemid) { 161 | print " The $item already created. Run before the zombies eat your brain\n" ; 162 | } 163 | else { 164 | return $itemid ; 165 | } 166 | } 167 | 168 | sub create_item { 169 | my ( $zabbix, $auth, $client, $item, $hostid ) = @_ ; 170 | my $query = { 171 | jsonrpc => "2.0", 172 | method => "item.create", 173 | params => { 174 | description => "Free Disk Space on \$1 in %", 175 | key_ => "vfs.fs.size[$item,pfree]", 176 | hostid => $hostid, 177 | value_type => 0, 178 | delay => 3600, 179 | }, 180 | auth => $auth, 181 | id => 1, 182 | } ; 183 | my $key = "\"itemids\"" ; 184 | my $itemid = parse($zabbix,$client,$query,$key) ; 185 | return $itemid ; 186 | } 187 | 188 | sub create_trigger { 189 | my ($zabbix, $auth, $client, $item, $fqdn, $value, $priority ) = @_ ; 190 | my $query = { 191 | jsonrpc => "2.0", 192 | method => "trigger.create", 193 | params => { 194 | description => "Low free diskspace on {HOSTNAME} volume $item < $value", 195 | expression => "{$fqdn:vfs.fs.size[$item,pfree].last(0)}<$value", 196 | status => 0, 197 | priority => $priority, 198 | }, 199 | auth => $auth, 200 | id => 1, 201 | } ; 202 | my $key = "\"triggerid\"" ; 203 | my $triggerid = parse($zabbix,$client,$query,$key) ; 204 | return $triggerid ; 205 | } 206 | 207 | sub parse { 208 | my ($zabbix, $client, $query, $key) = @_ ; 209 | my $json_query = $client->call($zabbix,$query); 210 | my $json_result = $json_query->result ; 211 | my @result = ( split /,/, (encode_json $json_result)) ; 212 | foreach my $returned_item (@result) { 213 | if ($returned_item =~ /$key/) { 214 | $returned_item =~ s/\D//g ; 215 | return $returned_item ; 216 | } 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /templates/postgres_stats/postgres_stats.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # A script to collect and print various metrics for PostgreSQL database. The 3 | # primary intent is use in conjunction with Zabbix NMS, but you're free to use what 4 | # you want. 5 | # 6 | # Copyright (C) <2011> , 7 | # 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | # 21 | # This work is based on Zabbix Template Collection < http://trac.greenmice.info/ztc/ > 22 | # from Vladimir Rusinov, and on work of "bashman" user in zabbix forum < http://www.zabbix.com/forum/showthread.php?t=8009 > 23 | 24 | use DBI; 25 | use warnings; 26 | use strict; 27 | 28 | my ( $fetch, $dbname ) = @ARGV; 29 | my $dbuser = "postgres"; 30 | 31 | unless ($fetch ) { 32 | help_message(); 33 | exit 1; 34 | } 35 | 36 | unless( $dbname ) { 37 | $dbname = "postgres"; 38 | } 39 | 40 | #Connecting to the database. See man DBD::Pg for more help 41 | my $dbh = DBI->connect("dbi:Pg:dbname=$dbname", "$dbuser", ); 42 | 43 | my %options = ( 44 | 'server_process' => ( "SELECT SUM(numbackends) FROM pg_stat_database" ), 45 | 'locks' => ( "SELECT COUNT(*) FROM pg_locks" ), 46 | 'connections_total' => ( "SELECT COUNT(*) FROM pg_stat_activity" ), 47 | 'connections_idle' => ( "SELECT COUNT(*) FROM pg_stat_activity WHERE current_query = ''" ), 48 | 'connections_idle_tnx' => ( "SELECT COUNT(*) FROM pg_stat_activity WHERE current_query = ' in transaction'" ), 49 | 'connections_waiting' => ( "SELECT COUNT(*) FROM pg_stat_activity WHERE waiting<>'f'" ), 50 | 'buffers_clear' => ( "SELECT COUNT(*) FROM pg_buffercache WHERE isdirty='f'" ), 51 | 'buffers_dirty' => ( "SELECT COUNT(*) FROM pg_buffercache WHERE isdirty='t'" ), 52 | 'buffers_used' => ( "SELECT COUNT(*) FROM pg_buffercache WHERE reldatabase IS NOT NULL " ), 53 | 'buffers_total' => ( "SELECT COUNT(*) FROM pg_buffercache" ), 54 | 'blocks_hit' => ( "SELECT SUM(blks_hit) FROM pg_stat_database" ), 55 | 'blocks_read' => ( "SELECT SUM(blks_read) FROM pg_stat_database" ), 56 | 'commits' => ( "SELECT SUM(xact_commit) FROM pg_stat_database" ), 57 | 'rollbacks' => ( "SELECT SUM(xact_rollback) FROM pg_stat_database" ), 58 | 'tuples_deleted' => ( "SELECT SUM(tup_deleted) FROM pg_stat_database" ), 59 | 'tuples_inserted' => ( "SELECT SUM(tup_inserted) FROM pg_stat_database" ), 60 | 'tuples_returned' => ( "SELECT SUM(tup_returned) FROM pg_stat_database" ), 61 | 'tuples_updated' => ( "SELECT SUM(tup_updated) FROM pg_stat_database" ), 62 | 'tuples_fetched' => ( "SELECT SUM(tup_fetched) FROM pg_stat_database" ), 63 | 'size' => ( "SELECT SUM(pg_database_size(datid)) as total_size FROM pg_stat_database" ), 64 | 'max_idle_tnx' => ( "SELECT EXTRACT (EPOCH FROM MAX(age(NOW(), query_start))) as d FROM pg_stat_activity WHERE current_query=' in transaction'" ), 65 | 'max_running_tnx' => ( "SELECT EXTRACT (EPOCH FROM MAX(age(NOW(), query_start))) \ 66 | as d FROM pg_stat_activity WHERE current_query<>' in transaction' AND current_query<>''" ), 67 | 'wall_files' => ( "SELECT COUNT(*) FROM pg_ls_dir('pg_xlog') WHERE pg_ls_dir ~ E'^[0-9A-F]{24}\$'" ), 68 | 'hit_ratio' => ( "SELECT CAST(blks_hit/(blks_read+blks_hit+0.000001)*100.0 as numeric(5,2)) as cache FROM pg_stat_database where datname = '$dbname'"), 69 | 'db_blocks_hit' => ( "SELECT SUM(blks_hit) FROM pg_stat_database where datname = '$dbname' " ), 70 | 'db_blocks_read' => ( "SELECT SUM(blks_read) FROM pg_stat_database where datname = '$dbname'" ), 71 | 'db_commits' => ( "SELECT SUM(xact_commit) FROM pg_stat_database where datname = '$dbname'" ), 72 | 'db_rollbacks' => ( "SELECT SUM(xact_rollback) FROM pg_stat_database where datname = '$dbname'" ), 73 | 'db_tuples_deleted' => ( "SELECT SUM(tup_deleted) FROM pg_stat_database where datname = '$dbname'" ), 74 | 'db_tuples_inserted' => ( "SELECT SUM(tup_inserted) FROM pg_stat_database where datname = '$dbname'" ), 75 | 'db_tuples_returned' => ( "SELECT SUM(tup_returned) FROM pg_stat_database where datname = '$dbname'" ), 76 | 'db_tuples_updated' => ( "SELECT SUM(tup_updated) FROM pg_stat_database where datname = '$dbname'" ), 77 | 'db_tuples_fetched' => ( "SELECT SUM(tup_fetched) FROM pg_stat_database where datname = '$dbname'" ), 78 | 'db_size' => ( "SELECT (pg_database_size('$dbname'))" ), 79 | ); 80 | 81 | return_row($dbh->prepare($options{$fetch})); 82 | 83 | sub return_row { 84 | my ($result) = @_ ; 85 | $result->execute(); 86 | my @row = ($result->fetchrow_array); 87 | print "@row \n" ; 88 | } 89 | 90 | sub help_message { 91 | print " You should pass one valid parameter: \n"; 92 | print " $0 server_process - Total conections in server processes \n"; 93 | print " $0 locks - Total number of used locks \n"; 94 | print " $0 connections_total - Total number of listeners \n"; 95 | print " $0 connections_idle - Number of connections in idle stat \n"; 96 | print " $0 connections_idle_tnx - Number of connections idle in trasaction \n"; 97 | print " $0 connections_waiting - Number of connections waiting \n"; 98 | print " $0 buffers_clear - Number of buffers clear \n"; 99 | print " $0 buffers_dirty - Number of buffers dirty \n"; 100 | print " $0 buffers_used - Number of buffers used \n"; 101 | print " $0 buffers_total - Total number of buffers \n"; 102 | print " $0 blocks_hit - Total Number of blocks hit \n"; 103 | print " $0 blocks_read - Total Number of blocks read in disk \n"; 104 | print " $0 commits - Total number of commits \n"; 105 | print " $0 rollbacks - Total number of rollbacks\n"; 106 | print " $0 tuples_deleted - Total number of tuples deleted \n"; 107 | print " $0 tuples_inserted - Total number of tuples inserted \n"; 108 | print " $0 tuples_returned - Total number of tuples returned \n"; 109 | print " $0 tuples_updated - Total number of tuples updated \n"; 110 | print " $0 tuples_fetched - Total number of tuples fetched \n"; 111 | print " $0 size - Sum of size of all databases \n"; 112 | print " $0 max_idle_tnx - Max time for transaction in idle state, in seconds \n "; 113 | print " $0 max_running_tnx - Max time of running transaction, in seconds \n"; 114 | print " $0 wall_files - Total number of wall files \n"; 115 | print " $0 hit_ratio [dbname] - Hit ratio for postgres database, if anyone specified \n"; 116 | print " $0 db_blocks_hit dbname - Number of blocks hit for specified database \n"; 117 | print " $0 db_blocks_read dbname - Number of blocks read in disk for specified database\n"; 118 | print " $0 db_commits dbname - Number of commits for specified database \n "; 119 | print " $0 db_rollbacks dbname - Number of Rollbacks for specified database \n"; 120 | print " $0 db_tuples_deleted dbname - Number of tuples deleted for specified database \n"; 121 | print " $0 db_tuples_inserted dbname - Number of tuples inserted for specified database \n"; 122 | print " $0 db_tuples_returned dbname - Number of tuples returned for specified database \n"; 123 | print " $0 db_tuples_updated dbname - Number of tuples returned for specified database \n"; 124 | print " $0 db_tuples_fetched db_name - Number of tuples fetched for specified database \n"; 125 | print " $0 db_size - Size of specified database \n"; 126 | print " If you want more, take a look at \"http://www.postgresql.org/docs/9.0/interactive/monitoring-stats.html\" \n"; 127 | } 128 | 129 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_SNMP_Generic-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:39Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 241 | 242 | 243 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.0.0/Template_SNMP_Generic-2.0.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2012-06-08T18:27:14Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 226 | 227 | 228 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_Virt_VMware-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:42Z 5 | 6 | 7 | Hypervisors 8 | 9 | 10 | Templates 11 | 12 | 13 | Virtual machines 14 | 15 | 16 | 17 | 363 | 364 | 365 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_SNMP_Disks-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:39Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 372 | 373 | 374 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.0.0/Template_SNMP_Disks-2.0.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2012-06-08T18:27:15Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 350 | 351 | 352 | -------------------------------------------------------------------------------- /Zabbix_Official_Templates_2.2.0/Template_SNMP_Interfaces-2.2.0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2.0 4 | 2013-11-12T16:13:39Z 5 | 6 | 7 | Templates 8 | 9 | 10 | 11 | 503 | 504 | 505 | --------------------------------------------------------------------------------