Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos
Commits
9fe35152
Commit
9fe35152
authored
Apr 08, 2014
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
run zabbix-server after database configuration process
parent
89603a9f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
29 deletions
+70
-29
software/zabbix-server/database.sh.in
software/zabbix-server/database.sh.in
+0
-19
software/zabbix-server/instance-zabbix.cfg.in
software/zabbix-server/instance-zabbix.cfg.in
+5
-2
software/zabbix-server/scripts/db.configure.py
software/zabbix-server/scripts/db.configure.py
+56
-0
software/zabbix-server/software.cfg
software/zabbix-server/software.cfg
+9
-8
No files found.
software/zabbix-server/database.sh.in
deleted
100644 → 0
View file @
89603a9f
#!/bin/sh
if
[
-f
"
${
:installed_file
}
"
]
then
echo
"Database is configured. Exiting..."
;
exit
0
;
fi
sleep
60
echo
"Installing file schema.sql..."
cat
${
:mysql_schema
}
|
${
:mysql_bin
}
-h
${
:mysql_host
}
-P
${
:mysql_port
}
-u
${
:mysql_user
}
-p
${
:mysql_pwd
}
${
:mysql_db
}
echo
"Installing file images.sql..."
cat
${
:mysql_images
}
|
${
:mysql_bin
}
-h
${
:mysql_host
}
-P
${
:mysql_port
}
-u
${
:mysql_user
}
-p
${
:mysql_pwd
}
${
:mysql_db
}
echo
"Installing file data.sql..."
cat
${
:mysql_data
}
|
${
:mysql_bin
}
-h
${
:mysql_host
}
-P
${
:mysql_port
}
-u
${
:mysql_user
}
-p
${
:mysql_pwd
}
${
:mysql_db
}
echo
"installed"
>
${
:installed_file
}
exit
0
\ No newline at end of file
software/zabbix-server/instance-zabbix.cfg.in
View file @
9fe35152
...
@@ -38,11 +38,11 @@ mysql_port = $${apache-php:mysql-port}
...
@@ -38,11 +38,11 @@ mysql_port = $${apache-php:mysql-port}
[install-zabbix-db]
[install-zabbix-db]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${
template-zabbix-database:location}/${template-zabbix-database
:filename}
url = ${
configure-dbscript:location}/${configure-dbscript
:filename}
output = $${basedirectory:scripts}/prepare-database
output = $${basedirectory:scripts}/prepare-database
mode = 0700
mode = 0700
installed_file = $${
buildout:directory}/.zabbix.db.installed
installed_file = $${
zabbix-wrapper:check-file}
mysql_bin = ${mariadb:location}/bin/mysql
mysql_bin = ${mariadb:location}/bin/mysql
mysql_host = $${apache-php:mysql-host}
mysql_host = $${apache-php:mysql-host}
mysql_db = $${apache-php:mysql-database}
mysql_db = $${apache-php:mysql-database}
...
@@ -52,6 +52,7 @@ mysql_pwd = $${apache-php:mysql-password}
...
@@ -52,6 +52,7 @@ mysql_pwd = $${apache-php:mysql-password}
mysql_schema = ${zabbix-server:compile-directory}/zabbix-${zabbix-server:version}/database/mysql/schema.sql
mysql_schema = ${zabbix-server:compile-directory}/zabbix-${zabbix-server:version}/database/mysql/schema.sql
mysql_data = ${zabbix-server:compile-directory}/zabbix-${zabbix-server:version}/database/mysql/data.sql
mysql_data = ${zabbix-server:compile-directory}/zabbix-${zabbix-server:version}/database/mysql/data.sql
mysql_images = ${zabbix-server:compile-directory}/zabbix-${zabbix-server:version}/database/mysql/images.sql
mysql_images = ${zabbix-server:compile-directory}/zabbix-${zabbix-server:version}/database/mysql/images.sql
python_bin = ${buildout:executable}
#force to install other parts
#force to install other parts
httpd-conf = $${httpd-conf:output}
httpd-conf = $${httpd-conf:output}
...
@@ -64,6 +65,8 @@ zabbix-server = ${zabbix-server:location}/sbin/zabbix_server
...
@@ -64,6 +65,8 @@ zabbix-server = ${zabbix-server:location}/sbin/zabbix_server
zabbix-conf = $${zabbix-conf:output}
zabbix-conf = $${zabbix-conf:output}
command-line = $${:zabbix-server} -c $${:zabbix-conf}
command-line = $${:zabbix-server} -c $${:zabbix-conf}
wrapper-path = $${rootdirectory:bin}/zabbix_server_raw
wrapper-path = $${rootdirectory:bin}/zabbix_server_raw
check-file = $${buildout:directory}/.zabbix.db.installed
wait-for-files = $${:check-file}
[zabbix]
[zabbix]
recipe = slapos.cookbook:wrapper
recipe = slapos.cookbook:wrapper
...
...
software/zabbix-server/scripts/db.configure.py
0 → 100644
View file @
9fe35152
#!${:python_bin}
import
os
import
subprocess
import
time
def
startProcess
(
launch_args
,
env
=
None
,
cwd
=
None
,
stdout
=
subprocess
.
PIPE
,
shell
=
False
):
process
=
subprocess
.
Popen
(
launch_args
,
stdout
=
stdout
,
stderr
=
subprocess
.
STDOUT
,
env
=
env
,
cwd
=
cwd
,
shell
=
shell
)
result
=
process
.
communicate
()[
0
]
if
process
.
returncode
is
None
or
process
.
returncode
!=
0
:
print
"Failed to execute executable.
\
n
The error was: %s"
%
result
return
False
return
True
def
dbtest
(
args
):
cmd
=
'echo "connect %s;" | %s -h %s -P %s -u %s -p%s'
%
(
args
[
'mysql_db'
],
args
[
'mysql_bin'
],
args
[
'mysql_host'
],
args
[
'mysql_port'
],
args
[
'mysql_user'
],
args
[
'mysql_password'
])
result
=
False
while
not
result
:
time
.
sleep
(
5
)
result
=
startProcess
(
cmd
,
shell
=
True
)
def
install_script
(
args
,
script
):
cmd
=
'cat %s | %s -h%s -P%s -u%s -p%s %s'
%
(
script
,
args
[
'mysql_bin'
],
args
[
'mysql_host'
],
args
[
'mysql_port'
],
args
[
'mysql_user'
],
args
[
'mysql_password'
],
args
[
'mysql_db'
])
os
.
system
(
cmd
)
if
__name__
==
'__main__'
:
args
=
{}
args
[
'mysql_bin'
]
=
'${:mysql_bin}'
args
[
'mysql_host'
]
=
'${:mysql_host}'
args
[
'mysql_port'
]
=
'${:mysql_port}'
args
[
'mysql_user'
]
=
'${:mysql_user}'
args
[
'mysql_password'
]
=
'${:mysql_pwd}'
args
[
'mysql_db'
]
=
'${:mysql_db}'
scripts
=
[]
scripts
.
append
(
'${:mysql_schema}'
)
scripts
.
append
(
'${:mysql_images}'
)
scripts
.
append
(
'${:mysql_data}'
)
check_file
=
'${:installed_file}'
#Check mysql status
if
os
.
path
.
exists
(
check_file
):
print
"Database is configured. Exiting..."
exit
(
0
)
dbtest
(
args
)
#Run all given sql files
for
script
in
scripts
:
install_script
(
args
,
script
)
with
open
(
check_file
,
'w'
)
as
f
:
f
.
write
(
'installed'
)
exit
(
0
)
\ No newline at end of file
software/zabbix-server/software.cfg
View file @
9fe35152
...
@@ -15,7 +15,7 @@ parts +=
...
@@ -15,7 +15,7 @@ parts +=
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-zabbix.cfg.in
url = ${:_profile_base_location_}/instance-zabbix.cfg.in
output = ${buildout:directory}/custom-apache-php.cfg
output = ${buildout:directory}/custom-apache-php.cfg
#md5sum = 3e2d71d3684aac3e52d2f55794df96bf
md5sum = 238b16283fa9a394ee8c0babdff3d470
mode = 0644
mode = 0644
[custom-application-deployment]
[custom-application-deployment]
...
@@ -36,27 +36,28 @@ url = ${:_profile_base_location_}/${:filename}
...
@@ -36,27 +36,28 @@ url = ${:_profile_base_location_}/${:filename}
[application-template]
[application-template]
<= download-base
<= download-base
#md5sum = Student may put here md5sum of this file, this is good idea
md5sum = 918c54bf3696433414bb5384f294497c
filename = zabbix.conf.php.in
filename = zabbix.conf.php.in
[template-zabbix-conf]
[template-zabbix-conf]
<= download-base
<= download-base
#md5sum = Student may put here md5sum of this file, this is good idea
md5sum = 53daa6eb31ebf5c5a5406ee573f4f3f7
filename = zabbix_server.conf.in
filename = zabbix_server.conf.in
[template-httpd-conf]
[template-httpd-conf]
<= download-base
<= download-base
#md5sum = Student may put here md5sum of this file, this is good idea
md5sum = e1b00a4b523439457dfb6d2a12c6436b
filename = apache.conf.in
filename = apache.conf.in
[
template-zabbix-database
]
[
configure-dbscript
]
<= download-base
<= download-base
#md5sum = Student may put here md5sum of this file, this is good idea
md5sum = 9b1ecc1772e4f604e51b4f4532195846
filename = database.sh.in
filename = db.configure.py
url = ${:_profile_base_location_}/scripts/${:filename}
[zabbix-svcdeamon]
[zabbix-svcdeamon]
<= download-base
<= download-base
#md5sum = Student may put here md5sum of this file, this is good idea
md5sum = 9aab8fd22cf296494f68fba78616d51d
url = ${:_profile_base_location_}/scripts/${:filename}
url = ${:_profile_base_location_}/scripts/${:filename}
filename = svcdaemon.py
filename = svcdaemon.py
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment