├── ZenPacks ├── JanGaraj │ ├── ZabbixAgent │ │ ├── parsers │ │ │ ├── __init__.py │ │ │ └── ZabbixAgentJSON.py │ │ ├── libexec │ │ │ ├── zabbix_get_zenoss_centos5 │ │ │ ├── zabbix_get_zenoss_ubuntu14 │ │ │ ├── zabbix_get_zenoss_opensuse12 │ │ │ ├── zabbix_get_zenoss │ │ │ ├── zabbix_get_zenoss.py │ │ │ └── zabbix_get_zenoss.c │ │ ├── __init__.py │ │ └── LICENSE.txt │ └── __init__.py └── __init__.py ├── .gitignore ├── image_ZabbixOSLinux-Graphs1.png ├── image_ZabbixOSLinux-Graphs2.png ├── image_ZabbixOSLinux-Graphs3.png ├── image_ZabbixOSLinux-Graphs4.png ├── image_CPU_utilization_one_second_pooling.png ├── ZenPacks.JanGaraj.ZabbixAgent-0.7.0-py2.7.egg ├── MANIFEST.in ├── setup.py ├── README.md └── LICENSE /ZenPacks/JanGaraj/ZabbixAgent/parsers/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ZenPacks/__init__.py: -------------------------------------------------------------------------------- 1 | __import__('pkg_resources').declare_namespace(__name__) 2 | -------------------------------------------------------------------------------- /ZenPacks/JanGaraj/__init__.py: -------------------------------------------------------------------------------- 1 | __import__('pkg_resources').declare_namespace(__name__) 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.pyc 3 | *.pyo 4 | build 5 | src 6 | setuptools* 7 | *.egg 8 | *.egg-info 9 | *EGG-INFO* 10 | *dist -------------------------------------------------------------------------------- /image_ZabbixOSLinux-Graphs1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent/master/image_ZabbixOSLinux-Graphs1.png -------------------------------------------------------------------------------- /image_ZabbixOSLinux-Graphs2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent/master/image_ZabbixOSLinux-Graphs2.png -------------------------------------------------------------------------------- /image_ZabbixOSLinux-Graphs3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent/master/image_ZabbixOSLinux-Graphs3.png -------------------------------------------------------------------------------- /image_ZabbixOSLinux-Graphs4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent/master/image_ZabbixOSLinux-Graphs4.png -------------------------------------------------------------------------------- /image_CPU_utilization_one_second_pooling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent/master/image_CPU_utilization_one_second_pooling.png -------------------------------------------------------------------------------- /ZenPacks.JanGaraj.ZabbixAgent-0.7.0-py2.7.egg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent/master/ZenPacks.JanGaraj.ZabbixAgent-0.7.0-py2.7.egg -------------------------------------------------------------------------------- /ZenPacks/JanGaraj/ZabbixAgent/libexec/zabbix_get_zenoss_centos5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent/master/ZenPacks/JanGaraj/ZabbixAgent/libexec/zabbix_get_zenoss_centos5 -------------------------------------------------------------------------------- /ZenPacks/JanGaraj/ZabbixAgent/libexec/zabbix_get_zenoss_ubuntu14: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent/master/ZenPacks/JanGaraj/ZabbixAgent/libexec/zabbix_get_zenoss_ubuntu14 -------------------------------------------------------------------------------- /ZenPacks/JanGaraj/ZabbixAgent/libexec/zabbix_get_zenoss_opensuse12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent/master/ZenPacks/JanGaraj/ZabbixAgent/libexec/zabbix_get_zenoss_opensuse12 -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | # This graft causes all files located under the ZenPacks/ subdirectory to be 2 | # included in the built ZenPack .egg. Files located in the top-level directory 3 | # of the ZenPack will not be explicitly included. 4 | # 5 | # You can read more about the format and available options available in this 6 | # MANIFEST.in file at the following URL. 7 | # http://docs.python.org/distutils/sourcedist.html 8 | graft ZenPacks 9 | -------------------------------------------------------------------------------- /ZenPacks/JanGaraj/ZabbixAgent/__init__.py: -------------------------------------------------------------------------------- 1 | # Nothing is required in this __init__.py, but it is an excellent place to do 2 | # many things in a ZenPack. 3 | # 4 | # The example below which is commented out by default creates a custom subclass 5 | # of the ZenPack class. This allows you to define custom installation and 6 | # removal routines for your ZenPack. If you don't need this kind of flexibility 7 | # you should leave the section commented out and let the standard ZenPack 8 | # class be used. 9 | # 10 | # Code included in the global scope of this file will be executed at startup 11 | # in any Zope client. This includes Zope itself (the web interface) and zenhub. 12 | # This makes this the perfect place to alter lower-level stock behavior 13 | # through monkey-patching. 14 | 15 | import Globals 16 | from Products.ZenModel.ZenPack import ZenPack as ZenPackBase 17 | from Products.ZenUtils.Utils import unused 18 | import os 19 | 20 | unused(Globals) 21 | 22 | 23 | class ZenPack(ZenPackBase): 24 | 25 | # All zProperties defined here will automatically be created when the 26 | # ZenPack is installed. 27 | packZProperties = [ 28 | ('zZabbixPort', 10050, 'int') 29 | ] 30 | 31 | def install(self, dmd): 32 | ZenPackBase.install(self, dmd) 33 | # TODO libexec binary selection 34 | pass 35 | 36 | def remove(self, dmd, leaveObjects=False): 37 | if not leaveObjects: 38 | # When a ZenPack is removed the remove method will be called with 39 | # leaveObjects set to False. This means that you likely want to 40 | # make sure that leaveObjects is set to false before executing 41 | # your custom removal code. 42 | pass 43 | 44 | ZenPackBase.remove(self, dmd, leaveObjects=leaveObjects) 45 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | ################################ 2 | # These variables are overwritten by Zenoss when the ZenPack is exported 3 | # or saved. Do not modify them directly here. 4 | # NB: PACKAGES is deprecated 5 | NAME = "ZenPacks.JanGaraj.ZabbixAgent" 6 | VERSION = "0.7.0" 7 | AUTHOR = "Jan Garaj" 8 | LICENSE = "GPLv2" 9 | NAMESPACE_PACKAGES = ['ZenPacks', 'ZenPacks.JanGaraj'] 10 | PACKAGES = ['ZenPacks', 'ZenPacks.JanGaraj', 'ZenPacks.JanGaraj.ZabbixAgent'] 11 | INSTALL_REQUIRES = [] 12 | COMPAT_ZENOSS_VERS = "" 13 | PREV_ZENPACK_NAME = "" 14 | # STOP_REPLACEMENTS 15 | ################################ 16 | # Zenoss will not overwrite any changes you make below here. 17 | 18 | import os 19 | from subprocess import Popen, PIPE 20 | from setuptools import setup, find_packages 21 | 22 | # Run "make build" if a GNUmakefile is present. 23 | if os.path.isfile('GNUmakefile'): 24 | print 'GNUmakefile found. Running "make build" ..' 25 | p = Popen('make build', stdout=PIPE, stderr=PIPE, shell=True) 26 | print p.communicate()[0] 27 | if p.returncode != 0: 28 | raise Exception('"make build" exited with an error: %s' % p.returncode) 29 | 30 | setup( 31 | # This ZenPack metadata should usually be edited with the Zenoss 32 | # ZenPack edit page. Whenever the edit page is submitted it will 33 | # overwrite the values below (the ones it knows about) with new values. 34 | name=NAME, 35 | version=VERSION, 36 | author=AUTHOR, 37 | license=LICENSE, 38 | 39 | # This is the version spec which indicates what versions of Zenoss 40 | # this ZenPack is compatible with 41 | compatZenossVers=COMPAT_ZENOSS_VERS, 42 | 43 | # previousZenPackName is a facility for telling Zenoss that the name 44 | # of this ZenPack has changed. If no ZenPack with the current name is 45 | # installed then a zenpack of this name if installed will be upgraded. 46 | prevZenPackName=PREV_ZENPACK_NAME, 47 | 48 | # Indicate to setuptools which namespace packages the zenpack 49 | # participates in 50 | namespace_packages=NAMESPACE_PACKAGES, 51 | 52 | # Tell setuptools what packages this zenpack provides. 53 | packages=find_packages(), 54 | 55 | # Tell setuptools to figure out for itself which files to include 56 | # in the binary egg when it is built. 57 | include_package_data=True, 58 | 59 | # The MANIFEST.in file is the recommended way of including additional files 60 | # in your ZenPack. package_data is another. 61 | #package_data = {} 62 | 63 | # Indicate dependencies on other python modules or ZenPacks. This line 64 | # is modified by zenoss when the ZenPack edit page is submitted. Zenoss 65 | # tries to put add/delete the names it manages at the beginning of this 66 | # list, so any manual additions should be added to the end. Things will 67 | # go poorly if this line is broken into multiple lines or modified to 68 | # dramatically. 69 | install_requires=INSTALL_REQUIRES, 70 | 71 | # Every ZenPack egg must define exactly one zenoss.zenpacks entry point 72 | # of this form. 73 | entry_points={ 74 | 'zenoss.zenpacks': '%s = %s' % (NAME, NAME), 75 | }, 76 | 77 | # All ZenPack eggs must be installed in unzipped form. 78 | zip_safe=False, 79 | ) 80 | -------------------------------------------------------------------------------- /ZenPacks/JanGaraj/ZabbixAgent/parsers/ZabbixAgentJSON.py: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2012, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | 14 | """JSON 15 | 16 | General purpose JSON parser for handling JSON objects matching the following 17 | template. This allows many datapoints for many components to be collected 18 | from a single COMMAND datasource. It also allows for collection of many 19 | events from a single COMMAND datasource. 20 | 21 | { 22 | "values": { 23 | "component_id_1": { 24 | "datapoint1": 123.4, 25 | "datapoint2": 987.6 26 | }, 27 | 28 | "component_id_2": { 29 | "datapoint1": 56.7, 30 | "datapoint2": 54.3 31 | } 32 | }, 33 | 34 | "events": [ 35 | { 36 | "severity": 2, 37 | "other_field_1": "value for other field", 38 | "summary": "event summary" 39 | }, 40 | 41 | { 42 | "severity": 3, 43 | "other_field_1": "another value for other field", 44 | "summary": "another event summary" 45 | } 46 | ] 47 | } 48 | 49 | """ 50 | 51 | import json 52 | 53 | from Products.ZenRRD.CommandParser import CommandParser 54 | 55 | 56 | def stringify_keys(dictionary): 57 | """Convert all keys of given dictionary to strings. 58 | 59 | During serialization and deserialization between the collector and hub we 60 | need to enforce that dictionary keys are plan, not unicode, strings. 61 | 62 | """ 63 | fixed_dictionary = {} 64 | for k, v in dictionary.items(): 65 | fixed_dictionary[str(k)] = v 66 | 67 | return fixed_dictionary 68 | 69 | 70 | class ZabbixAgentJSON(CommandParser): 71 | 72 | def processResults(self, cmd, result): 73 | data = None 74 | 75 | try: 76 | data = json.loads(cmd.result.output) 77 | except Exception, ex: 78 | # See NOTE below. If this event ever occurs it will not auto-clear. 79 | result.events.append({ 80 | 'severity': cmd.severity, 81 | 'summary': 'error parsing command output', 82 | 'eventKey': cmd.command, 83 | 'eventClass': cmd.eventClass, 84 | 'command_output': cmd.result.output, 85 | 'exception': str(ex), 86 | }) 87 | 88 | return 89 | # NOTE: It might be a good idea to send a clear event for the potential 90 | # parse error above. However, this would end up flooding clear events 91 | # that are almost always useless. I've chosen to trust the executed 92 | # plugin to always return JSON data of some sort. 93 | 94 | # Pass incoming events straight through. 95 | result.events.extend(map(stringify_keys, data.get('events', []))) 96 | 97 | # Map incoming values to their components and datapoints. 98 | if len(data.get('values', {}).keys()) > 0: 99 | for point in cmd.points: 100 | if point.component not in data['values']: 101 | continue 102 | 103 | if point.id not in data['values'][point.component]: 104 | continue 105 | 106 | result.values.append(( 107 | point, data['values'][point.component][point.id])) 108 | 109 | return result 110 | -------------------------------------------------------------------------------- /ZenPacks/JanGaraj/ZabbixAgent/libexec/zabbix_get_zenoss: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | ** Zabbix get utility for Zenoss (python version) 5 | ** - output format is prepared for Zenoss JSON parser 6 | ** Copyright (C) 2014 Jan Garaj - www.jangaraj.com 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 2 of the License, or 11 | ** (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 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, write to the Free Software 20 | ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | """ 22 | 23 | from optparse import OptionParser, TitledHelpFormatter 24 | from ConfigParser import SafeConfigParser 25 | import socket 26 | import struct 27 | import sys 28 | 29 | VERSION = "0.0.1" 30 | moptions = ('host', 'key', 'component', 'datapoint') 31 | # zabbix_get constants 32 | GET_SENDER_TIMEOUT = 60 33 | ZBX_NOTSUPPORTED = "ZBX_NOTSUPPORTED" 34 | ZBX_MEBIBYTE = 1048576 35 | ZBX_MAX_RECV_DATA_SIZE = (128 * ZBX_MEBIBYTE) 36 | 37 | def buildParams(cfg, parser): 38 | """ Add options """ 39 | parser.add_option('-s', '--host', dest='host', type="string", help='*Specify host name or IP address of a host') 40 | parser.add_option('-k', '--key', dest='key', type="string", help='*Specify key of item to retrieve value for') 41 | parser.add_option('-d', '--datapoint', dest='datapoint', type="string", help='*Zenoss datapoint name') 42 | parser.add_option('-c', '--component', dest='component', type="string", help='Zenoss component name. Default is empty string', default='') 43 | parser.add_option('-p', '--port', dest='port', type="int", help='Specify port number of agent running on the host. Default is 10050', default=10050) 44 | 45 | return parser 46 | 47 | def readCommadLine(arguments, usage): 48 | """Read the command line - returns options""" 49 | parser = OptionParser(usage, version="%s" % VERSION, formatter=TitledHelpFormatter(width=255, indent_increment=4)) 50 | cfg = SafeConfigParser() 51 | buildParams(cfg, parser) 52 | options, args = parser.parse_args(arguments) 53 | for option in moptions: 54 | if getattr(options, option) is None: 55 | print "\nA mandatory option is missing\n" 56 | parser.print_help() 57 | sys.exit(1) 58 | 59 | return options 60 | 61 | def str2packed(data): 62 | header_field = struct.pack('<4sBQ', 'ZBXD', 1, len(data)) 63 | return header_field + data 64 | 65 | def packed2str(packed_data): 66 | header, version, length = struct.unpack('<4sBQ', packed_data[:13]) 67 | (data, ) = struct.unpack('<%ds'%length, packed_data[13:13+length]) 68 | return data 69 | 70 | def zabbix_get(options): 71 | """Call zabbix agent and print value/problems""" 72 | # IPv4 validation 73 | try: 74 | socket.inet_pton(socket.AF_INET, options.host) 75 | conoptions = [((socket.AF_INET), (options.host, options.port))] 76 | except socket.error: 77 | # IPv6 validation 78 | try: 79 | socket.inet_pton(socket.AF_INET6, options.host) 80 | conoptions = [((socket.AF_INET6), (options.host, options.port))] 81 | except socket.error: 82 | # host is not valid IP - try to resolve hostname 83 | try: 84 | conoptions = [(o[0], o[4]) for o in socket.getaddrinfo(options.host, options.port, socket.AF_UNSPEC, socket.SOCK_STREAM)] 85 | except socket.gaierror, err: 86 | print '{"events":[{"severity":4,"summary":"Can\'t resolve hostname %s","message":"%s","eventClass":"/Status/ZabbixAgent","eventKey":"connection"}]}' % (options.host, err[1]) 87 | sys.exit(1) 88 | except socket.herror, err: 89 | print '{"events":[{"severity":4,"summary":"Address-related error for hostname %s","message":"%s","eventClass":"/Status/ZabbixAgent","eventKey":"connection"}]}' % (options.host, err[1]) 90 | sys.exit(1) 91 | 92 | family, hostport = conoptions[0] 93 | s = socket.socket(family, socket.SOCK_STREAM) 94 | s.settimeout(GET_SENDER_TIMEOUT) 95 | try: 96 | s.connect(hostport) 97 | except socket.timeout: 98 | print '{"events":[{"severity":4,"summary":"Connection timeout to %s","message":"Current timeout setting is %s","eventClass":"/Status/ZabbixAgent","eventKey":"connection"}]}' % (options.host, GET_SENDER_TIMEOUT) 99 | sys.exit(1) 100 | except socket.error, err: 101 | print '{"events":[{"severity":4,"summary":"Connection error to %s:%s","message":"%s","eventClass":"/Status/ZabbixAgent","eventKey":"connection"}]}' % (options.host, options.port, err[1]) 102 | sys.exit(1) 103 | 104 | s.sendall(str2packed(options.key)) 105 | 106 | data = '' 107 | while True: 108 | buff = s.recv(1024) 109 | if not buff: 110 | break 111 | data += buff 112 | 113 | data = packed2str(data) 114 | if data == ZBX_NOTSUPPORTED: 115 | print '{"events":[{"severity":4,"summary":"Zabbix metric %s: ZBX_NOTSUPPORTED","message":"%s","eventClass":"/Status/ZabbixAgent","eventKey":"%s"}]}' % (options.key, data, options.key) 116 | else: 117 | print '{"values":{"%s":{"%s":%s}},"events":[{"severity":0,"summary":"Clearing previous problems","message":"Clearing previous problems","eventClass":"/Status/ZabbixAgent","eventKey":"%s"},{"severity":0,"summary":"Clearing previous problems","message":"Clearing previous problems","eventClass":"/Status/ZabbixAgent","eventKey":"connection"}]}' % (options.component, options.datapoint, data, options.key) 118 | s.close() 119 | return 0 120 | 121 | def main(arguments): 122 | """The main function""" 123 | 124 | usage = """ 125 | %prog [options] 126 | 127 | Zabbix get utility for Zenoss - output format is prepared for Zenoss JSON parser. 128 | 129 | Example: zabbix_get_zenoss.py -s 127.0.0.1 -d system.cpu.load.all.avg1 -k \"system.cpu.load[all,avg1]\"""" 130 | 131 | conf = readCommadLine(arguments, usage) 132 | return zabbix_get(conf) 133 | 134 | if __name__ == '__main__': 135 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /ZenPacks/JanGaraj/ZabbixAgent/libexec/zabbix_get_zenoss.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | ** Zabbix get utility for Zenoss (python version) 5 | ** - output format is prepared for Zenoss JSON parser 6 | ** Copyright (C) 2014 Jan Garaj - www.jangaraj.com 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 2 of the License, or 11 | ** (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 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, write to the Free Software 20 | ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | """ 22 | 23 | from optparse import OptionParser, TitledHelpFormatter 24 | from ConfigParser import SafeConfigParser 25 | import socket 26 | import struct 27 | import sys 28 | 29 | VERSION = "0.0.1" 30 | moptions = ('host', 'key', 'component', 'datapoint') 31 | # zabbix_get constants 32 | GET_SENDER_TIMEOUT = 60 33 | ZBX_NOTSUPPORTED = "ZBX_NOTSUPPORTED" 34 | ZBX_MEBIBYTE = 1048576 35 | ZBX_MAX_RECV_DATA_SIZE = (128 * ZBX_MEBIBYTE) 36 | 37 | def buildParams(cfg, parser): 38 | """ Add options """ 39 | parser.add_option('-s', '--host', dest='host', type="string", help='*Specify host name or IP address of a host') 40 | parser.add_option('-k', '--key', dest='key', type="string", help='*Specify key of item to retrieve value for') 41 | parser.add_option('-d', '--datapoint', dest='datapoint', type="string", help='*Zenoss datapoint name') 42 | parser.add_option('-c', '--component', dest='component', type="string", help='Zenoss component name. Default is empty string', default='') 43 | parser.add_option('-p', '--port', dest='port', type="int", help='Specify port number of agent running on the host. Default is 10050', default=10050) 44 | 45 | return parser 46 | 47 | def readCommadLine(arguments, usage): 48 | """Read the command line - returns options""" 49 | parser = OptionParser(usage, version="%s" % VERSION, formatter=TitledHelpFormatter(width=255, indent_increment=4)) 50 | cfg = SafeConfigParser() 51 | buildParams(cfg, parser) 52 | options, args = parser.parse_args(arguments) 53 | for option in moptions: 54 | if getattr(options, option) is None: 55 | print "\nA mandatory option is missing\n" 56 | parser.print_help() 57 | sys.exit(1) 58 | 59 | return options 60 | 61 | def str2packed(data): 62 | header_field = struct.pack('<4sBQ', 'ZBXD', 1, len(data)) 63 | return header_field + data 64 | 65 | def packed2str(packed_data): 66 | header, version, length = struct.unpack('<4sBQ', packed_data[:13]) 67 | (data, ) = struct.unpack('<%ds'%length, packed_data[13:13+length]) 68 | return data 69 | 70 | def zabbix_get(options): 71 | """Call zabbix agent and print value/problems""" 72 | # IPv4 validation 73 | try: 74 | socket.inet_pton(socket.AF_INET, options.host) 75 | conoptions = [((socket.AF_INET), (options.host, options.port))] 76 | except socket.error: 77 | # IPv6 validation 78 | try: 79 | socket.inet_pton(socket.AF_INET6, options.host) 80 | conoptions = [((socket.AF_INET6), (options.host, options.port))] 81 | except socket.error: 82 | # host is not valid IP - try to resolve hostname 83 | try: 84 | conoptions = [(o[0], o[4]) for o in socket.getaddrinfo(options.host, options.port, socket.AF_UNSPEC, socket.SOCK_STREAM)] 85 | except socket.gaierror, err: 86 | print '{"events":[{"severity":4,"summary":"Can\'t resolve hostname %s","message":"%s","eventClass":"/Status/ZabbixAgent","eventKey":"connection"}]}' % (options.host, err[1]) 87 | sys.exit(1) 88 | except socket.herror, err: 89 | print '{"events":[{"severity":4,"summary":"Address-related error for hostname %s","message":"%s","eventClass":"/Status/ZabbixAgent","eventKey":"connection"}]}' % (options.host, err[1]) 90 | sys.exit(1) 91 | 92 | family, hostport = conoptions[0] 93 | s = socket.socket(family, socket.SOCK_STREAM) 94 | s.settimeout(GET_SENDER_TIMEOUT) 95 | try: 96 | s.connect(hostport) 97 | except socket.timeout: 98 | print '{"events":[{"severity":4,"summary":"Connection timeout to %s","message":"Current timeout setting is %s","eventClass":"/Status/ZabbixAgent","eventKey":"connection"}]}' % (options.host, GET_SENDER_TIMEOUT) 99 | sys.exit(1) 100 | except socket.error, err: 101 | print '{"events":[{"severity":4,"summary":"Connection error to %s:%s","message":"%s","eventClass":"/Status/ZabbixAgent","eventKey":"connection"}]}' % (options.host, options.port, err[1]) 102 | sys.exit(1) 103 | 104 | s.sendall(str2packed(options.key)) 105 | 106 | data = '' 107 | while True: 108 | buff = s.recv(1024) 109 | if not buff: 110 | break 111 | data += buff 112 | 113 | data = packed2str(data) 114 | if data == ZBX_NOTSUPPORTED: 115 | print '{"events":[{"severity":4,"summary":"Zabbix metric %s: ZBX_NOTSUPPORTED","message":"%s","eventClass":"/Status/ZabbixAgent","eventKey":"%s"}]}' % (options.key, data, options.key) 116 | else: 117 | print '{"values":{"%s":{"%s":%s}},"events":[{"severity":0,"summary":"Clearing previous problems","message":"Clearing previous problems","eventClass":"/Status/ZabbixAgent","eventKey":"%s"},{"severity":0,"summary":"Clearing previous problems","message":"Clearing previous problems","eventClass":"/Status/ZabbixAgent","eventKey":"connection"}]}' % (options.component, options.datapoint, data, options.key) 118 | s.close() 119 | return 0 120 | 121 | def main(arguments): 122 | """The main function""" 123 | 124 | usage = """ 125 | %prog [options] 126 | 127 | Zabbix get utility for Zenoss - output format is prepared for Zenoss JSON parser. 128 | 129 | Example: zabbix_get_zenoss.py -s 127.0.0.1 -d system.cpu.load.all.avg1 -k \"system.cpu.load[all,avg1]\"""" 130 | 131 | conf = readCommadLine(arguments, usage) 132 | return zabbix_get(conf) 133 | 134 | if __name__ == '__main__': 135 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /ZenPacks/JanGaraj/ZabbixAgent/libexec/zabbix_get_zenoss.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Zabbix get utility for Zenoss (C version) 3 | ** Output format is prepared for Zenoss JSON parser 4 | ** Source code is just slightly modified zabbix_get source code, 5 | ** so you will need zabbix source for compilation. 6 | ** Jan Garaj - www.jangaraj.com 7 | ** 8 | ** Zabbix 9 | ** Copyright (C) 2001-2014 Zabbix SIA 10 | ** 11 | ** This program is free software; you can redistribute it and/or modify 12 | ** it under the terms of the GNU General Public License as published by 13 | ** the Free Software Foundation; either version 2 of the License, or 14 | ** (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 General Public License for more details. 20 | ** 21 | ** You should have received a copy of the GNU General Public License 22 | ** along with this program; if not, write to the Free Software 23 | ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 24 | **/ 25 | #include "threads.h" 26 | #include "comms.h" 27 | #include "zbxgetopt.h" 28 | 29 | char *key = NULL; 30 | const char *progname = NULL; 31 | const char title_message[] = "Zabbix get for Zenoss"; 32 | const char syslog_app_name[] = "zabbix_get_zenoss"; 33 | const char usage_message[] = "[-hV] -s [-p ] [-I ] -k -c -d "; 34 | 35 | const char *help_message[] = { 36 | "Options:", 37 | " -s --host Specify host name or IP address of a host", 38 | " -p --port Specify port number of agent running on the host. Default is 10050", 39 | " -I --source-address Specify source IP address", 40 | "", 41 | " -k --key Specify key of item to retrieve value for", 42 | "", 43 | " -c --component Zenoss component name. Default is empty string", 44 | " -d --datapoint Zenoss datapoint name", 45 | "", 46 | " -h --help Give this help", 47 | " -V --version Display version number", 48 | "", 49 | "Example: zabbix_get_zenoss -s 127.0.0.1 -p 10050 -d system.cpu.load.all.avg1 -k \"system.cpu.load[all,avg1]\"", 50 | NULL /* end of text */ 51 | }; 52 | 53 | /* COMMAND LINE OPTIONS */ 54 | 55 | /* long options */ 56 | struct zbx_option longopts[] = 57 | { 58 | {"host", 1, NULL, 's'}, 59 | {"port", 1, NULL, 'p'}, 60 | {"key", 1, NULL, 'k'}, 61 | {"source-address", 1, NULL, 'I'}, 62 | {"component", 1, NULL, 'c'}, 63 | {"datapoint", 1, NULL, 'd'}, 64 | {"help", 0, NULL, 'h'}, 65 | {"version", 0, NULL, 'V'}, 66 | {NULL} 67 | }; 68 | 69 | /* short options */ 70 | static char shortopts[] = "s:p:k:I:c:d:hV"; 71 | 72 | /* end of COMMAND LINE OPTIONS */ 73 | 74 | #if !defined(_WINDOWS) 75 | 76 | /****************************************************************************** 77 | * * 78 | * Function: get_signal_handler * 79 | * * 80 | * Purpose: process signals * 81 | * * 82 | * Parameters: sig - signal ID * 83 | * * 84 | * Return value: * 85 | * * 86 | * Comments: * 87 | * * 88 | ******************************************************************************/ 89 | static void get_signal_handler(int sig) 90 | { 91 | if (SIGALRM == sig) 92 | printf("{\"events\":[{\"severity\":4,\"summary\":\"Zabbix metric error %s: Timeout while executing operation\",\"eventClass\":\"/Status/ZabbixAgent\"}]}", key); 93 | 94 | exit(EXIT_FAILURE); 95 | } 96 | 97 | #endif /* not WINDOWS */ 98 | 99 | /****************************************************************************** 100 | * * 101 | * Function: get_value * 102 | * * 103 | * Purpose: connect to Zabbix agent, receive and print value * 104 | * * 105 | * Parameters: host - server name or IP address * 106 | * port - port number * 107 | * key - item's key * 108 | * component - Zenoss component name * 109 | * datapoint - Zenoss datapoint name * 110 | * * 111 | ******************************************************************************/ 112 | static void get_value(const char *source_ip, const char *host, unsigned short port, const char *key, const char *component, const char *datapoint) 113 | { 114 | zbx_sock_t s; 115 | int ret; 116 | char request[1024]; 117 | 118 | if (SUCCEED == (ret = zbx_tcp_connect(&s, source_ip, host, port, GET_SENDER_TIMEOUT))) 119 | { 120 | zbx_snprintf(request, sizeof(request), "%s\n", key); 121 | 122 | if (SUCCEED == (ret = zbx_tcp_send(&s, request))) 123 | { 124 | if (SUCCEED == (ret = SUCCEED_OR_FAIL(zbx_tcp_recv_ext(&s, ZBX_TCP_READ_UNTIL_CLOSE, 0)))) 125 | { 126 | if (0 == strcmp(s.buffer, ZBX_NOTSUPPORTED)) 127 | { 128 | zbx_rtrim(s.buffer + sizeof(ZBX_NOTSUPPORTED), "\r\n"); 129 | printf("{\"events\":[{\"severity\":4,\"summary\":\"Zabbix metric %s: ZBX_NOTSUPPORTED\",\"message\":\"%s\",\"eventClass\":\"/Status/ZabbixAgent\",\"eventKey\":\"%s\"}]}", key, s.buffer, key); 130 | } 131 | else 132 | { 133 | zbx_rtrim(s.buffer, "\r\n"); 134 | printf("{\"values\":{\"%s\":{\"%s\":%s}},\"events\":[{\"severity\":0,\"summary\":\"Clearing previous problems\",\"message\":\"Clearing previous problems\",\"eventClass\":\"/Status/ZabbixAgent\",\"eventKey\":\"%s\"},{\"severity\":0,\"summary\":\"Clearing previous problems\",\"message\":\"Clearing previous problems\",\"eventClass\":\"/Status/ZabbixAgent\",\"eventKey\":\"connection\"}]}", component, datapoint, s.buffer, key); 135 | } 136 | } 137 | } 138 | 139 | zbx_tcp_close(&s); 140 | } 141 | 142 | if (FAIL == ret) 143 | printf("{\"events\":[{\"severity\":4,\"summary\":\"Connection error to %s:%d\",\"message\":\"%s\",\"eventClass\":\"/Status/ZabbixAgent\",\"eventKey\":\"connection\"}]}", host, port, zbx_tcp_strerror()); 144 | } 145 | 146 | /****************************************************************************** 147 | * * 148 | * Function: main * 149 | * * 150 | * Purpose: main function * 151 | * * 152 | * Parameters: * 153 | * * 154 | * Return value: * 155 | * * 156 | * Comments: * 157 | * * 158 | ******************************************************************************/ 159 | int main(int argc, char **argv) 160 | { 161 | unsigned short port = 10050; 162 | int ret = SUCCEED; 163 | char *host = NULL, *source_ip = NULL, *component = NULL, *datapoint = NULL, ch; 164 | 165 | progname = get_program_name(argv[0]); 166 | 167 | /* parse the command-line */ 168 | while ((char)EOF != (ch = (char)zbx_getopt_long(argc, argv, shortopts, longopts, NULL))) 169 | { 170 | switch (ch) 171 | { 172 | case 'k': 173 | key = strdup(zbx_optarg); 174 | break; 175 | case 'c': 176 | component = strdup(zbx_optarg); 177 | break; 178 | case 'd': 179 | datapoint = strdup(zbx_optarg); 180 | break; 181 | case 'p': 182 | port = (unsigned short)atoi(zbx_optarg); 183 | break; 184 | case 's': 185 | host = strdup(zbx_optarg); 186 | break; 187 | case 'I': 188 | source_ip = strdup(zbx_optarg); 189 | break; 190 | case 'h': 191 | help(); 192 | exit(EXIT_SUCCESS); 193 | break; 194 | case 'V': 195 | version(); 196 | exit(EXIT_SUCCESS); 197 | break; 198 | default: 199 | usage(); 200 | exit(EXIT_FAILURE); 201 | break; 202 | } 203 | } 204 | 205 | if (NULL == host || NULL == key) 206 | { 207 | usage(); 208 | ret = FAIL; 209 | } 210 | 211 | if (NULL == component) 212 | { 213 | component = strdup(""); 214 | } 215 | 216 | if (SUCCEED == ret) 217 | { 218 | #if !defined(_WINDOWS) 219 | signal(SIGINT, get_signal_handler); 220 | signal(SIGTERM, get_signal_handler); 221 | signal(SIGQUIT, get_signal_handler); 222 | signal(SIGALRM, get_signal_handler); 223 | #endif 224 | get_value(source_ip, host, port, key, component, datapoint); 225 | } 226 | 227 | zbx_free(host); 228 | zbx_free(key); 229 | zbx_free(component); 230 | zbx_free(datapoint); 231 | 232 | return ret; 233 | } 234 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ZenPacks.JanGaraj.ZabbixAgent 2 | ============================= 3 | 4 | About 5 | ===== 6 | 7 | This ZenPack unlocks Zabbix agent functionality in Zenoss. The best benefit is 8 | that Zabbix agent is available for wide range of OS (UNIX, Windows, ...). Default 9 | Zabbix templates adapted for Zenoss are included. 10 | 11 | Please donate to author, so he can continue to publish other awesome projects 12 | for free: 13 | 14 | [![Paypal donate button](http://jangaraj.com/img/github-donate-button02.png)] 15 | (https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8LB6J222WRUZ4) 16 | 17 | **Please test it and provide your feedback.** 18 | ![ZabbixOSLinux Template graphs](https://raw.githubusercontent.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent/master/image_ZabbixOSLinux-Graphs1.png) 19 | 20 | Requirements 21 | ============ 22 | 23 | Zenoss 24 | ------ 25 | 26 | You must first have, or install, Zenoss 4. This ZenPack was tested against 27 | Zenoss 4.2.5. You can download the free Core version of Zenoss 28 | from http://community.zenoss.org/community/download. 29 | 30 | Zabbix agent 31 | ------------ 32 | 33 | Visit [Zabbix download page](http://www.zabbix.com/download.php) and choose the right free pre-compiled Zabbix agent version. 34 | Or if package `zabbix-agent` exists in your distribution repository, you can use it. 35 | ZenPack doesn't have any condition for Zabbix agent version. 36 | Please check [Zabbix documentation](https://www.zabbix.com/documentation) if you have a problem with installation. 37 | Please configure also agent (usually zabbix_agentd.conf file). Edit line with `Server` config: 38 | 39 | `Server=` 40 | 41 | Incoming connections are accepted only from the hosts listed in this settings. Then (re)start agent. 42 | 43 | Network 44 | ------- 45 | 46 | Zenoss collector/master must have access to Zabbix agents (default port 10050) on monitored devices. 47 | 48 | Installation 49 | ============ 50 | 51 | Normal Installation (packaged egg) 52 | ---------------------------------- 53 | 54 | Download the egg file. 55 | Copy this file to your Zenoss server and run the following commands as the zenoss 56 | user. 57 | 58 | ``` 59 | zenpack --install ZenPacks.JanGaraj.ZabbixAgent-0.7.0.egg 60 | zenoss restart 61 | ``` 62 | 63 | 64 | Developer Installation (link mode) 65 | ---------------------------------- 66 | 67 | If you wish to further develop and possibly contribute back to the ZabbixAgent 68 | ZenPack you should clone the [git repository] 69 | (https://github.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent.git), 70 | then install the ZenPack in developer mode using the following commands. 71 | 72 | ``` 73 | git clone git://github.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent.git 74 | zenpack --link --install ZenPacks.JanGaraj.ZabbixAgent 75 | zenoss restart 76 | ``` 77 | 78 | zProperties 79 | =========== 80 | 81 | ZenPack creates zProperty *zZabbixPort* with default value 10050 (default Zabbix 82 | agent port). If your Zabbix agent is configured with another listen port, 83 | change *zZabbixPort* accordingly. 84 | 85 | Usage 86 | ===== 87 | 88 | Go to the specific device (yes, it needs to already be added) and bind right 89 | template(s). 90 | 91 | Installing the ZenPack will add the following items to your Zenoss system: 92 | 93 | Monitoring Templates 94 | -------------------- 95 | 96 | Templates are "imported" from Zabbix and adapted for Zenoss, because Zenoss 97 | doesn't support all Zabbix features (especially non numeric metric). Please bear 98 | in mind, that CPU is default component template for all Devices. 99 | Set it up only for devices, where Zabbix Agent is installed. 100 | 101 | - /Devices/rrdTemplates/CPU (Component Template) 102 | - /Devices/rrdTemplates/ZabbixAppFTPService 103 | - /Devices/rrdTemplates/ZabbixAppHTTPService 104 | - /Devices/rrdTemplates/ZabbixAppHTTPSService 105 | - /Devices/rrdTemplates/ZabbixAppIMAPService 106 | - /Devices/rrdTemplates/ZabbixAppLDAPService 107 | - /Devices/rrdTemplates/ZabbixAppMySQL 108 | - /Devices/rrdTemplates/ZabbixAppNNTPService 109 | - /Devices/rrdTemplates/ZabbixAppNTPService 110 | - /Devices/rrdTemplates/ZabbixAppPOPService 111 | - /Devices/rrdTemplates/ZabbixAppSMTPService 112 | - /Devices/rrdTemplates/ZabbixAppSSHService 113 | - /Devices/rrdTemplates/ZabbixAppTelnetService 114 | - /Devices/rrdTemplates/ZabbixAppZabbixAgent 115 | - /Devices/rrdTemplates/ZabbixOSAIX 116 | - /Devices/rrdTemplates/ZabbixOSFreeBSD 117 | - /Devices/rrdTemplates/ZabbixOSHP-UX 118 | - /Devices/rrdTemplates/ZabbixOSLinux 119 | - /Devices/rrdTemplates/ZabbixOSMacOSX 120 | - /Devices/rrdTemplates/ZabbixOSOpenBSD 121 | - /Devices/rrdTemplates/ZabbixOSSolaris 122 | - /Devices/rrdTemplates/ZabbixOSWindows 123 | 124 | Event Classes 125 | ------------- 126 | 127 | - /Events/Status/ZabbixAgent 128 | 129 | Creatig a custom metric 130 | ======================= 131 | 132 | You can use all metric provided by Zabbix agent in passive mode. For example all 133 | file relative metrics (e.g. log, logrt) are available only in active mode. Check 134 | Zabbix agent documentation - [available item keys] 135 | (https://www.zabbix.com/documentation/2.2/manual/config/items/itemtypes/zabbix_agent#supported_item_keys) 136 | 137 | Summary: 138 | - create new Datasource, type COMMAND (e.g. name: 'CPU steal time') 139 | - create new Datapoint for your new datasource, only one datapoint per datasource 140 | is supported (e.g. name: 'system.cpu.util.steal') 141 | - edit your new Datasource: 142 | Parser must be *ZenPacks.JanGaraj.ZabbixAgent.parsers.ZabbixAgentJSON*. 143 | 144 | Command template must call provided zabbix_get_zenoss utility with the right parameters: 145 | ``` 146 | ${here/ZenPackManager/packs/ZenPacks.JanGaraj.ZabbixAgent/path}/libexec/zabbix_get_zenoss -s ${device/id} -p ${here/zZabbixPort} -k "system.cpu.util[,nice]" -d "system.cpu.util.steal" -c "" 147 | ``` 148 | 149 | Parameters: 150 | 151 | -s ${device/id} - host name or IP of monitored device, I recommend to use 152 | ${device/id} as default value 153 | 154 | -p ${here/zZabbixPort} - Zabbix agent port on monitored device, zProperty 155 | zZabbixPort (with default value 10050) is used here 156 | 157 | -k "system.cpu.util[,steal]" - Zabbix item key, see Zabbix manual for parameters 158 | and available keys 159 | 160 | -d "system.cpu.util.steal" - Zenoss datapoint name 161 | 162 | -c "" - Zenoss component id, use it in component template, otherwise you can omit 163 | this parameter (default value is "" - no component) 164 | 165 | Extending Zabbix agent metric 166 | ============================= 167 | 168 | You can define your own metric, if some metric, which you need is not provided 169 | by Zabbix agent by default. Please refer to Zabbix manual: 170 | 171 | - userparameters 172 | 173 | https://www.zabbix.com/documentation/2.2/manual/config/items/userparameters 174 | 175 | - loadable modules (Unix only) 176 | 177 | https://www.zabbix.com/documentation/2.2/manual/config/items/loadablemodules 178 | 179 | Screenshots 180 | =========== 181 | 182 | A few graph screenshots from device with ZabbixOSLinux template for example: 183 | ![ZabbixOSLinux Template graphs](https://raw.githubusercontent.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent/master/image_ZabbixOSLinux-Graphs2.png) 184 | ![ZabbixOSLinux Template graphs](https://raw.githubusercontent.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent/master/image_ZabbixOSLinux-Graphs3.png) 185 | ![ZabbixOSLinux Template graphs](https://raw.githubusercontent.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent/master/image_ZabbixOSLinux-Graphs4.png) 186 | 187 | Performance notes 188 | ================= 189 | 190 | ZenPacks.JanGaraj.ZabbixAgent 0.7.0 use one TCP call/connection per metric. It's not 191 | very efficient, so this call should be very quick. ZenPacks.JanGaraj.ZabbixAgent 192 | libexec folders contains also C version of zabbix_get_zenoss utility for better 193 | perfomance. Default used version is python: 194 | 195 | ``` 196 | [root@device libexec]# time ./zabbix_get_zenoss.py -s zabbix -d system.cpu.load.all.avg1 -k "system.cpu.load[all,avg1]" 197 | {"values":{"":{"system.cpu.load.all.avg1":0.000000}},"events":[{"severity":0,"summary":"Clearing previous problems","message":"Clearing previous problems","eventClass":"/Status/ZabbixAgent","eventKey":"system.cpu.load[all,avg1]"},{"severity":0,"summary":"Clearing previous problems","message":"Clearing previous problems","eventClass":"/Status/ZabbixAgent","eventKey":"connection"}]} 198 | 199 | real 0m0.079s 200 | user 0m0.043s 201 | sys 0m0.033s 202 | ``` 203 | 204 | For performance testing purpose, also C version has been created. You will need 205 | to compile it, what can be challenge, so some precompiled version 206 | (Ubuntu, CentOS, ...) are provided. 207 | 208 | Performance test with compiled version: 209 | ``` 210 | [root@device libexec]# time ./zabbix_get_zenoss_centos5 -s zabbix -d system.cpu.load.all.avg1 -k "system.cpu.load[all,avg1]" 211 | {"values":{"":{"system.cpu.load.all.avg1":0.000000}},"events":[{"severity":0,"summary":"Clearing previous problems","message":"Clearing previous problems","eventClass":"/Status/ZabbixAgent","eventKey":"system.cpu.load[all,avg1]"},{"severity":0,"summary":"Clearing previous problems","message":"Clearing previous problems","eventClass":"/Status/ZabbixAgent","eventKey":"connection"}]} 212 | real 0m0.007s 213 | user 0m0.000s 214 | sys 0m0.007s 215 | ``` 216 | 217 | Generally compiled version is 10x more faster than python version in this 218 | synthetic performance test. So let's go to check performance with zencommand 219 | (zencommand run -d zabbix -v 10). Tested device is zabbix VM with binded 220 | ZabbixOSLinux template and with 33 datapoints. 221 | 222 | 0.6 second takes RUNNING->IDLE for compiled C version of zabbix_get_zenoss version: 223 | ``` 224 | 2014-08-09 14:01:27,832 DEBUG zen.collector.scheduler: Task zabbix 60 Local changing state from RUNNING to FETCH_DATA 225 | 2014-08-09 14:01:28,426 DEBUG zen.collector.scheduler: Task zabbix 60 Local changing state from STORE_PERF_DATA to IDLE 226 | ``` 227 | 228 | 3.2 seconds takes RUNNING->IDLE for python version of zabbix_get_zenoss version: 229 | ``` 230 | 2014-08-09 14:06:50,461 DEBUG zen.collector.scheduler: Task zabbix 60 Local changing state from RUNNING to FETCH_DATA 231 | 2014-08-09 14:06:53,702 DEBUG zen.collector.scheduler: Task zabbix 60 Local changing state from STORE_PERF_DATA to IDLE 232 | ``` 233 | 234 | I've made also test with one second CPU utilization pooling for one device and 235 | it was 10% CPU utilization for python version vs 1% CPU utilization for 236 | compiled C version. Graph of CPU utilization, when one second pooling was active: 237 | ![One second CPU utilization pooling] 238 | (https://raw.githubusercontent.com/monitoringartist/ZenPacks.JanGaraj.ZabbixAgent/master/image_CPU_utilization_one_second_pooling.png) 239 | 240 | 241 | Conclusion: 242 | 243 | Python is amazing option for developers. I love "import pdb; pdb.set_trace();" 244 | feature for python debugging also in Zenoss. But if speed is critical for you, 245 | then consider binaries (compiled C code). 246 | 247 | TODO list 248 | ========= 249 | 250 | - implement Zabbix agent datasource 251 | - implement daemon zenzabbixserver for active/passive agent mode and better performance 252 | - implement Zabbix modeller Filesystem/Interface plugin (low level discovery functionality of Zabbix agent) 253 | - improve speed/perfomance (cython, pypy, ...) 254 | 255 | Author 256 | ====== 257 | 258 | [Devops Monitoring zExpert](http://www.jangaraj.com), who loves monitoring 259 | systems, which start with letter Z. Those are Zabbix and Zenoss. 260 | 261 | Professional monitoring services: 262 | 263 | [![Monitoring Artist](http://monitoringartist.com/img/github-monitoring-artist-logo.jpg)] 264 | (http://www.monitoringartist.com) 265 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /ZenPacks/JanGaraj/ZabbixAgent/LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | --------------------------------------------------------------------------------