Fix Netdata on raspbian
This commit is contained in:
@@ -334,10 +334,16 @@ class WOStackController(CementBaseController):
|
||||
if pargs.netdata:
|
||||
Log.debug(self, "Setting packages variable for Netdata")
|
||||
if not os.path.exists('/opt/netdata'):
|
||||
packages = packages + [['https://my-netdata.io/'
|
||||
'kickstart-static64.sh',
|
||||
'/var/lib/wo/tmp/kickstart.sh',
|
||||
'Netdata']]
|
||||
if WOVariables.wo_distro == 'raspbian':
|
||||
packages = packages + [['https://my-netdata.io/'
|
||||
'kickstart.sh',
|
||||
'/var/lib/wo/tmp/kickstart.sh',
|
||||
'Netdata']]
|
||||
else:
|
||||
packages = packages + [['https://my-netdata.io/'
|
||||
'kickstart-static64.sh',
|
||||
'/var/lib/wo/tmp/kickstart.sh',
|
||||
'Netdata']]
|
||||
else:
|
||||
Log.debug(self, "Netdata already installed")
|
||||
Log.info(self, "Netdata already installed")
|
||||
|
||||
@@ -1258,18 +1258,25 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
WOShellExec.cmd_exec(self, "bash /var/lib/wo/tmp/"
|
||||
"kickstart.sh "
|
||||
"--dont-wait")
|
||||
if WOVariables.wo_distro == 'raspbian':
|
||||
wo_netdata = "/"
|
||||
else:
|
||||
wo_netdata = "/opt/netdata/"
|
||||
# disable mail notifications
|
||||
WOFileUtils.searchreplace(self, "/opt/netdata/usr/"
|
||||
WOFileUtils.searchreplace(self, "{0}usr/"
|
||||
"lib/netdata/conf.d/"
|
||||
"health_alarm_notify.conf",
|
||||
"health_alarm_notify.conf"
|
||||
.format(wo_netdata),
|
||||
'SEND_EMAIL="YES"',
|
||||
'SEND_EMAIL="NO"')
|
||||
# make changes persistant
|
||||
WOFileUtils.copyfile(self, "/opt/netdata/usr/"
|
||||
WOFileUtils.copyfile(self, "{0}usr/"
|
||||
"lib/netdata/conf.d/"
|
||||
"health_alarm_notify.conf",
|
||||
"/opt/netdata/etc/netdata/"
|
||||
"health_alarm_notify.conf")
|
||||
"health_alarm_notify.conf"
|
||||
.format(wo_netdata),
|
||||
"{0}etc/netdata/"
|
||||
"health_alarm_notify.conf"
|
||||
.format(wo_netdata))
|
||||
# check if mysql credentials are available
|
||||
if os.path.isfile('/etc/mysql/conf.d/my.cnf'):
|
||||
try:
|
||||
@@ -1288,7 +1295,8 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
Log.debug(self, "{0}".format(e))
|
||||
Log.info(
|
||||
self, "fail to setup mysql user for netdata")
|
||||
WOFileUtils.chown(self, '/opt/netdata',
|
||||
WOFileUtils.chown(self, '{0}etc/netdata'
|
||||
.format(wo_netdata),
|
||||
'netdata',
|
||||
'netdata',
|
||||
recursive=True)
|
||||
|
||||
@@ -89,7 +89,8 @@ class WOStackStatusController(CementBaseController):
|
||||
|
||||
# netdata
|
||||
if pargs.netdata:
|
||||
if os.path.isdir("/opt/netdata"):
|
||||
if (os.path.isdir("/opt/netdata") or
|
||||
os.path.isdir("/etc/netdata")):
|
||||
services = services + ['netdata']
|
||||
else:
|
||||
Log.info(self, "Netdata is not installed")
|
||||
@@ -177,7 +178,8 @@ class WOStackStatusController(CementBaseController):
|
||||
|
||||
# netdata
|
||||
if pargs.netdata:
|
||||
if os.path.isdir("/opt/netdata"):
|
||||
if (os.path.isdir("/opt/netdata") or
|
||||
os.path.isdir("/etc/netdata")):
|
||||
services = services + ['netdata']
|
||||
else:
|
||||
Log.info(self, "Netdata is not installed")
|
||||
@@ -261,7 +263,8 @@ class WOStackStatusController(CementBaseController):
|
||||
|
||||
# netdata
|
||||
if pargs.netdata:
|
||||
if os.path.isdir("/opt/netdata"):
|
||||
if (os.path.isdir("/opt/netdata") or
|
||||
os.path.isdir("/etc/netdata")):
|
||||
services = services + ['netdata']
|
||||
else:
|
||||
Log.info(self, "Netdata is not installed")
|
||||
@@ -345,7 +348,8 @@ class WOStackStatusController(CementBaseController):
|
||||
|
||||
# netdata
|
||||
if pargs.netdata:
|
||||
if os.path.isdir("/opt/netdata"):
|
||||
if (os.path.isdir("/opt/netdata") or
|
||||
os.path.isdir("/etc/netdata")):
|
||||
services = services + ['netdata']
|
||||
else:
|
||||
Log.info(self, "Netdata is not installed")
|
||||
@@ -429,7 +433,8 @@ class WOStackStatusController(CementBaseController):
|
||||
|
||||
# netdata
|
||||
if pargs.netdata:
|
||||
if os.path.isdir("/opt/netdata"):
|
||||
if (os.path.isdir("/opt/netdata") or
|
||||
os.path.isdir("/etc/netdata")):
|
||||
services = services + ['netdata']
|
||||
else:
|
||||
Log.info(self, "Netdata is not installed")
|
||||
|
||||
Reference in New Issue
Block a user