diff --git a/WAPT/control b/WAPT/control index 036ebee..b990683 100644 --- a/WAPT/control +++ b/WAPT/control @@ -1,9 +1,11 @@ package : fws-zabbix-agent -version : 4.2.1-3 +version : 4.4.1-4 architecture : all section : base priority : optional -maintainer : Florent Heuze +name : +categories : +maintainer : Daniel Berteaud description : Zabbix Monitoring Agent depends : conflicts : @@ -25,8 +27,12 @@ editor : Zabbix SIA keywords : monitoring, zabbix, agent licence : homepage : https://zabbix.com -package_uuid : -signer : Florent Heuze -signer_fingerprint: -signature_date : -signed_attributes : \ No newline at end of file +package_uuid : e4bcc94a-446e-492c-b58a-9f673350226c +valid_from : +valid_until : +forced_install_on : +signer : Daniel Berteaud +signer_fingerprint: 3c9415559e2dedbc4390e3faa2c28d3b67265baa5b35902d2764d9e41c3b3f0a +signature : QhHtyL/PwAT8OW1xdOh7IOXdt3YCtnFUMTGeEYpkohLjmw9hPR4QAWhxjRvew/49nYBXfXx6cK6zrMDRhw4kHiTXcCLFNmrQAOg/xo5OmNzehvPoEvE0pzXkBUyI+F+IS0Qmi9Nc16A4jr4wpvCYB51DdXtk8E/o8PAr3Khx3flNgeXC5YE6n2YY8tviHwFENll4KzoNNZgpaIvzxWdiHMLfh2yPGARZ4dW0VA0IS1V0jHtfXLxL+5AKoSFRx5muyWWFeBwEyU7zeDkgQtb4Bed6fMoSK8y122pL6/F94jkmPzHwtXIup2DTsoWYxJcNBX/2NCOo664yRBvkrzqo6Q== +signature_date : 2019-11-05T12:11:50.737000 +signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_os_version,max_os_version,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,signer,signer_fingerprint,signature_date,signed_attributes \ No newline at end of file diff --git a/setup.py b/setup.py index 56d08d5..f3716b1 100644 --- a/setup.py +++ b/setup.py @@ -21,16 +21,31 @@ props = { def install(): version = control['version'].split('-',1)[0] - print('Installing Zabbix Agent version ' + version) + + # Remove previous version from suiviperf, if present + print('Checking old Zabbix Agent version...') + old_agent = installed_softwares('{65BE9C8D-BE1D-4AEA-A144-9F52D57A3D12}') + for uninstall in old_agent: + if Version(uninstall['version'].split('.',1)[0]) < Version(version) : + if Version(uninstall['version']) < Version(version): + killalltasks(['zabbix_agentd.exe']) + print('Uninstalling previous version %s' % uninstall['version']) + cmd = uninstall_cmd(uninstall['key']) + run_notfatal(cmd) + + print('Installing Zabbix Agent version %s' % version) if iswin64(): - install_msi_if_needed('zabbix_agent-%s_x64.msi' % version,killbefore=['zabbix_agentd.exe'],properties=props,remove_old_version=True) + msi = 'zabbix_agent-%s-win-amd64-openssl.msi' % version else: - install_msi_if_needed('zabbix_agent-%s_x86.msi' % version,killbefore=['zabbix_agentd.exe'],properties=props,remove_old_version=True) + msi = 'zabbix_agent-%s-win-i386-openssl.msi' % version + + install_msi_if_needed(msi,killbefore=['zabbix_agentd.exe'],properties=props,remove_old_version=True) print('Opening port 10050 in the firewall') # Remove the previous rule if it existed. We don't mind the return code as the rule might not exist run_notfatal('netsh advfirewall firewall del rule name="Zabbix Agent"') + # And add a new one run('netsh advfirewall firewall add rule name="Zabbix Agent" dir=in action=allow protocol=TCP localport=10050 enable=yes remoteip=%s' % (','.join(variables['zabbix_servers']))) @@ -41,22 +56,26 @@ def uninstall(): def update_package(): import requests, re from waptpackage import PackageEntry - print('Updating Zabbix Agent package') - page = requests.get('https://www.suiviperf.com/zabbix/',headers={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'}).text - version = re.search('zabbix_agent-(\d+(\.\d+)*)_x64.msi', page).group(1) - for arch in ['86', '64']: - if not isfile('zabbix_agent-%s_x%s.msi' % (version, arch)): - filename ='zabbix_agent-%s_x%s.msi' % (version, arch) - url = 'http://www.suiviperf.com/zabbix/%s' % filename - print('Downloading %s from %s' % (filename, url)) - wget(url, filename) - for old in glob.glob(r'zabbix_agent-*_x%s' % arch): - if not old == filename: - remove_file(old) + print('Checking latest agent version') + page = wgets('https://www.zabbix.com/download') + latest_version = re.search('"latest":"(\d+(\.\d+)*)"', page).group(1) pe = PackageEntry() control = pe.load_control_from_wapt(os.getcwd()) + current_version = control['version'].split('-',1)[0] + + if Version(latest_version) > Version(current_version): + print('Updating package from %s to %s' % (current_version, latest_version)) + for arch in ['amd64', 'i386']: + filename ='zabbix_agent-%s-win-%s-openssl.msi' % (latest_version, arch) + if not isfile(filename): + url = 'https://www.zabbix.com/downloads/%s/%s' % (latest_version, filename) + print('Downloading %s from %s' % (filename, url)) + wget(url, filename) + for old in glob.glob(r'zabbix_agent-*-win-%s-openssl.msi' % arch): + if not old == filename: + remove_file(old) - if Version(version) > Version(control['version'].split('-',1)[0]): - pe.version = version + '-0' + pe.version = latest_version + '-0' + pe.maturity = 'PREPROD' pe.save_control_to_wapt(os.getcwd()) diff --git a/zabbix_agent-4.0.1_x64.msi b/zabbix_agent-4.0.1_x64.msi deleted file mode 100644 index 9c106d2..0000000 --- a/zabbix_agent-4.0.1_x64.msi +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:152aec5658d47f27583a1905ce364eb5ff176b60114974ea00e6d52c444b3b3a -size 1822720 diff --git a/zabbix_agent-4.0.1_x86.msi b/zabbix_agent-4.0.1_x86.msi deleted file mode 100644 index d7ff27c..0000000 --- a/zabbix_agent-4.0.1_x86.msi +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b53472cae84dca4f33392168c0311c274e79931ad62c0d90329696a0c20f9321 -size 1765376 diff --git a/zabbix_agent-4.2.1_x64.msi b/zabbix_agent-4.2.1_x64.msi deleted file mode 100644 index 65b18d9..0000000 --- a/zabbix_agent-4.2.1_x64.msi +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:519417eb0194d5dd0f15db0b94ba97589a579a011702abd385481adf970e1951 -size 1826816 diff --git a/zabbix_agent-4.2.1_x86.msi b/zabbix_agent-4.2.1_x86.msi deleted file mode 100644 index 18a23b0..0000000 --- a/zabbix_agent-4.2.1_x86.msi +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:45114f2c12efab7e1d9fefcbcf009a6c44dfebf505891fbd7420745bf1044a34 -size 1769472 diff --git a/zabbix_agent-4.4.1-win-amd64-openssl.msi b/zabbix_agent-4.4.1-win-amd64-openssl.msi new file mode 100644 index 0000000..f80b495 --- /dev/null +++ b/zabbix_agent-4.4.1-win-amd64-openssl.msi @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:864f694abca693626509d8b04225a3d0715eacb2172507b015bf39942a3fa04b +size 6225920 diff --git a/zabbix_agent-4.4.1-win-i386-openssl.msi b/zabbix_agent-4.4.1-win-i386-openssl.msi new file mode 100644 index 0000000..5b50fe6 --- /dev/null +++ b/zabbix_agent-4.4.1-win-i386-openssl.msi @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d8a01a670a47acae92cabcc56e061ad9357409e35aa4bac86cd2e63db5c7448 +size 5537792