Write setup for Zabbix agent

master
Daniel Berteaud 6 years ago
parent d56bbde138
commit caaa97c4f9
  1. 6
      WAPT/control
  2. 35
      setup.py

@ -1,5 +1,5 @@
package : fws-zabbix-agent package : fws-zabbix-agent
version : 4.0.1.0-0 version : 4.0.1-1
architecture : all architecture : all
section : base section : base
priority : optional priority : optional
@ -7,7 +7,7 @@ maintainer : Daniel Berteaud
description : Zabbix Agent (Zabbix SIA) description : Zabbix Agent (Zabbix SIA)
depends : depends :
conflicts : conflicts :
maturity : maturity : DEV
locale : locale :
target_os : target_os :
min_os_version : min_os_version :
@ -24,7 +24,7 @@ audit_schedule :
editor : editor :
keywords : keywords :
licence : licence :
homepage : homepage : https://zabbix.com
package_uuid : package_uuid :
signer : signer :
signer_fingerprint: signer_fingerprint:

@ -1,8 +1,39 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from setuphelpers import * from setuphelpers import *
import json
from cryptography.fernet import Fernet
uninstallkey = [] uninstallkey = []
variables = {
'zabbix_servers': [ '127.0.0.1' ]
}
# Read local variables file if available
if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')):
print('Reading local encrypted variables file')
f = Fernet(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read())
variables = json.loads(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read()))
props = {
'RMTCMD':0,
'SERVER':','.join(variables['zabbix_servers'])
}
def install(): def install():
print('installing fws-zabbix-agent') version = control['version'].split('-',1)[0]
install_msi_if_needed('zabbix_agent-4.0.1_x64.msi') print('Installing Zabbix Agent version ' + version)
if iswin64():
install_msi_if_needed('zabbix_agent-%s_x64.msi' % version,killbefore=['zabbix_agentd.exe'],properties=props,remove_old_version=True)
else:
install_msi_if_needed('zabbix_agent-%s_x86.msi' % version,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'])))
def uninstall():
print('Removing firewall rule')
run_notfatal('netsh advfirewall firewall del rule name="Zabbix Agent"')
Loading…
Cancel
Save