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
isaak yansane-sisk
slapos
Commits
4da99694
Commit
4da99694
authored
Aug 15, 2011
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move instanciation of zabbix agentd to a dedicated method.
parent
706ccb3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
23 deletions
+36
-23
slapos/recipe/zabbixagent/__init__.py
slapos/recipe/zabbixagent/__init__.py
+36
-23
No files found.
slapos/recipe/zabbixagent/__init__.py
View file @
4da99694
...
@@ -79,35 +79,48 @@ class Recipe(BaseSlapRecipe):
...
@@ -79,35 +79,48 @@ class Recipe(BaseSlapRecipe):
self
.
path_list
.
append
(
wrapper
)
self
.
path_list
.
append
(
wrapper
)
return
cron_d
return
cron_d
def
_install
(
self
):
def
installZabbixAgentd
(
self
,
ip
,
port
,
hostname
,
server_ip
):
self
.
path_list
=
[]
log_file
=
os
.
path
.
join
(
self
.
log_directory
,
'zabbix_agentd.log'
)
self
.
requirements
,
self
.
ws
=
self
.
egg
.
working_set
()
self
.
registerLogRotation
(
'zabbix_agentd'
,
[
log_file
])
# self.cron_d is a directory, where cron jobs can be registered
self
.
cron_d
=
self
.
installCrond
()
zabbix_agentd_conf
=
dict
(
self
.
logrotate_d
,
self
.
logrotate_backup
=
self
.
installLogrotate
()
zabbix_log_file
=
os
.
path
.
join
(
self
.
log_directory
,
'zabbix_agentd.log'
)
self
.
registerLogRotation
(
'zabbix_agentd'
,
[
zabbix_log_file
])
zabbix_agentd
=
dict
(
pid_file
=
os
.
path
.
join
(
self
.
run_directory
,
"zabbix_agentd.pid"
),
pid_file
=
os
.
path
.
join
(
self
.
run_directory
,
"zabbix_agentd.pid"
),
log_file
=
zabbix_log_file
,
log_file
=
log_file
,
ip
=
self
.
getGlobalIPv6Address
(),
ip
=
ip
,
server
=
self
.
parameter_dict
[
'server'
],
server
=
server_ip
,
hostname
=
self
.
parameter_dict
[
'hostname'
],
hostname
=
hostname
,
port
=
'10050'
port
=
port
)
)
zabbix_agentd_conf
=
self
.
createConfigurationFile
(
"zabbix_agentd.conf"
,
zabbix_agentd_path
=
self
.
createConfigurationFile
(
pkg_resources
.
resource_string
(
__name__
,
"zabbix_agentd.conf"
,
'template/zabbix_agentd.conf.in'
)
%
zabbix_agentd
)
pkg_resources
.
resource_string
(
self
.
path_list
.
append
(
zabbix_agentd_conf
)
__name__
,
'template/zabbix_agentd.conf.in'
)
%
zabbix_agentd_conf
)
self
.
path_list
.
append
(
zabbix_agentd_path
)
wrapper
=
zc
.
buildout
.
easy_install
.
scripts
([(
'zabbixagentd'
,
wrapper
=
zc
.
buildout
.
easy_install
.
scripts
([(
'zabbixagentd'
,
'slapos.recipe.librecipe.execute'
,
'execute'
)],
self
.
ws
,
sys
.
executable
,
'slapos.recipe.librecipe.execute'
,
'execute'
)],
self
.
ws
,
sys
.
executable
,
self
.
bin_directory
,
arguments
=
[
self
.
bin_directory
,
arguments
=
[
self
.
options
[
'zabbix_agentd_binary'
].
strip
(),
'-c'
,
self
.
options
[
'zabbix_agentd_binary'
].
strip
(),
'-c'
,
zabbix_agentd_conf
])[
0
]
zabbix_agentd_path
])[
0
]
self
.
path_list
.
extend
(
zc
.
buildout
.
easy_install
.
scripts
([
self
.
path_list
.
extend
(
zc
.
buildout
.
easy_install
.
scripts
([
(
'zabbixagentd'
,
__name__
+
'.svcdaemon'
,
'svcdaemon'
)],
(
'zabbixagentd'
,
__name__
+
'.svcdaemon'
,
'svcdaemon'
)],
self
.
ws
,
sys
.
executable
,
self
.
wrapper_directory
,
arguments
=
[
dict
(
self
.
ws
,
sys
.
executable
,
self
.
wrapper_directory
,
arguments
=
[
dict
(
real_binary
=
wrapper
,
pid_file
=
zabbix_agentd
[
'pid_file'
])]))
real_binary
=
wrapper
,
pid_file
=
zabbix_agentd_conf
[
'pid_file'
])]))
self
.
setConnectionDict
(
dict
(
ip
=
zabbix_agentd
[
'ip'
],
name
=
zabbix_agentd
[
'hostname'
],
port
=
zabbix_agentd
[
'port'
]))
return
zabbix_agentd_conf
def
_install
(
self
):
self
.
path_list
=
[]
self
.
requirements
,
self
.
ws
=
self
.
egg
.
working_set
()
# self.cron_d is a directory, where cron jobs can be registered
self
.
cron_d
=
self
.
installCrond
()
self
.
logrotate_d
,
self
.
logrotate_backup
=
self
.
installLogrotate
()
zabbix_agentd_conf
=
self
.
installZabbixAgentd
(
self
.
getGlobalIPv6Address
(),
10050
,
self
.
parameter_dict
[
'hostname'
],
self
.
parameter_dict
[
'server'
])
self
.
setConnectionDict
(
dict
(
ip
=
zabbix_agentd_conf
[
'ip'
],
name
=
zabbix_agentd_conf
[
'hostname'
],
port
=
zabbix_agentd_conf
[
'port'
]))
return
self
.
path_list
return
self
.
path_list
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