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
Sebastian
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
Show 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):
self
.
path_list
.
append
(
wrapper
)
return
cron_d
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_log_file
=
os
.
path
.
join
(
self
.
log_directory
,
'zabbix_agentd.log'
)
self
.
registerLogRotation
(
'zabbix_agentd'
,
[
zabbix_log_file
])
zabbix_agentd
=
dict
(
def
installZabbixAgentd
(
self
,
ip
,
port
,
hostname
,
server_ip
):
log_file
=
os
.
path
.
join
(
self
.
log_directory
,
'zabbix_agentd.log'
)
self
.
registerLogRotation
(
'zabbix_agentd'
,
[
log_file
])
zabbix_agentd_conf
=
dict
(
pid_file
=
os
.
path
.
join
(
self
.
run_directory
,
"zabbix_agentd.pid"
),
log_file
=
zabbix_log_file
,
ip
=
self
.
getGlobalIPv6Address
(),
server
=
self
.
parameter_dict
[
'server'
],
hostname
=
self
.
parameter_dict
[
'hostname'
],
port
=
'10050'
)
zabbix_agentd_conf
=
self
.
createConfigurationFile
(
"zabbix_agentd.conf"
,
pkg_resources
.
resource_string
(
__name__
,
'template/zabbix_agentd.conf.in'
)
%
zabbix_agentd
)
self
.
path_list
.
append
(
zabbix_agentd_conf
)
log_file
=
log_file
,
ip
=
ip
,
server
=
server_ip
,
hostname
=
hostname
,
port
=
port
)
zabbix_agentd_path
=
self
.
createConfigurationFile
(
"zabbix_agentd.conf"
,
pkg_resources
.
resource_string
(
__name__
,
'template/zabbix_agentd.conf.in'
)
%
zabbix_agentd_conf
)
self
.
path_list
.
append
(
zabbix_agentd_path
)
wrapper
=
zc
.
buildout
.
easy_install
.
scripts
([(
'zabbixagentd'
,
'slapos.recipe.librecipe.execute'
,
'execute'
)],
self
.
ws
,
sys
.
executable
,
self
.
bin_directory
,
arguments
=
[
self
.
options
[
'zabbix_agentd_binary'
].
strip
(),
'-c'
,
zabbix_agentd_conf
])[
0
]
zabbix_agentd_path
])[
0
]
self
.
path_list
.
extend
(
zc
.
buildout
.
easy_install
.
scripts
([
(
'zabbixagentd'
,
__name__
+
'.svcdaemon'
,
'svcdaemon'
)],
self
.
ws
,
sys
.
executable
,
self
.
wrapper_directory
,
arguments
=
[
dict
(
real_binary
=
wrapper
,
pid_file
=
zabbix_agentd
[
'pid_file'
])]))
self
.
setConnectionDict
(
dict
(
ip
=
zabbix_agentd
[
'ip'
],
name
=
zabbix_agentd
[
'hostname'
],
port
=
zabbix_agentd
[
'port'
]))
real_binary
=
wrapper
,
pid_file
=
zabbix_agentd_conf
[
'pid_file'
])]))
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
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