-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf7a3f0
commit 72ed034
Showing
33 changed files
with
212 additions
and
212 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/ruby | ||
ENV['GEM_PATH'] = '/opt/sipx-main/lib/ruby/gems/1.8:/usr/lib/ruby/gems/1.8:/var/lib/gems/1.8' | ||
|
||
require 'rubygems' | ||
require 'daemons' | ||
require 'etc' | ||
|
||
uid = Etc.getpwnam('@SIPXPBXUSER@').uid | ||
gid = Etc.getgrnam('@SIPXPBXGROUP@').gid | ||
|
||
unless Process.euid == uid && Process.egid == gid | ||
Process.initgroups('@SIPXPBXUSER@', gid) | ||
Process::GID.change_privilege(gid) | ||
Process::UID.change_privilege(uid) | ||
end | ||
|
||
Daemons.run('@SIPX_BINDIR@/sipxacd-stats', | ||
:app_name => 'sipxacd-stats', | ||
:dir_mode => :normal, | ||
:dir => '@SIPX_RUNDIR@', | ||
:log_output => true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,12 @@ | ||
include $(top_srcdir)/config/utility.am | ||
|
||
EXTRA_DIST = \ | ||
$(proc_DATA:=.in) \ | ||
$(cfg_DATA:=.in) \ | ||
$(rpt_DATA) \ | ||
$(cron_FILES:=.in) | ||
|
||
cron_FILES = sipxconfig-report-crontab | ||
if IS_RPMBUILD | ||
# Target is not normally run, also, you may have to add sipx user to | ||
# /etc/cron.d/cron.allow file | ||
crondir = $(CRON_D) | ||
cron_SCRIPTS = $(cron_FILES) | ||
else | ||
noinst_SCRIPTS = $(cron_FILES) | ||
endif | ||
|
||
procdir = $(SIPX_DATADIR)/process.d | ||
proc_DATA = \ | ||
sipxconfig-agent-process.xml | ||
|
||
cfgdir = $(SIPX_CONFDIR) | ||
cfg_DATA = \ | ||
sipxconfig-report-config | ||
|
||
rptdir = $(SIPX_CONFDIR)/report | ||
rpt_DATA = \ | ||
dist_rpt_DATA = \ | ||
schema.sql \ | ||
enable_upgrades.sql \ | ||
location_fqdn.sql | ||
|
||
$(cron_FILES) $(cfg_DATA) $(proc_DATA) : % : %.in Makefile | ||
@$(call SearchAndReplace, $<, $@) | ||
cfinputsdir = $(SIPX_CFINPUTS)/plugin.d | ||
dist_cfinputs_DATA = \ | ||
sipxacdstatistics.cf | ||
|
||
CLEANFILES = $(cron_FILES) $(cfg_DATA) $(proc_DATA) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Copyright (C) 2012 eZuce Inc., certain elements licensed under a Contributor Agreement. | ||
# Contributors retain copyright to elements licensed under a Contributor Agreement. | ||
# Licensed to the User under the AGPL license. | ||
|
||
# | ||
# sipxacdstatistics configuration and process management | ||
# | ||
bundle agent sipxacdstatistics { | ||
methods: | ||
sipxacdstatistics:: | ||
"any" usebundle => "sipxacdstatistics_config"; | ||
"any" usebundle => "sipxacdstatistics_setup"; | ||
any:: | ||
"any" usebundle => "sipxacdstatistics_running"; | ||
} | ||
|
||
bundle agent sipxacdstatistics_config { | ||
vars: | ||
any:: | ||
"agent[CONFIG_SERVER_AGENT_PORT]" string => "$(sipx.CONFIG_SERVER_AGENT_PORT)"; | ||
|
||
files: | ||
any:: | ||
"$(sipx.SIPX_CONFDIR)/sipxconfig-report-config" | ||
create => "true", | ||
perms => m("644"), | ||
edit_line => sipxacdstatistics_report_config, | ||
action => track("$(this.promiser)"); | ||
|
||
"$(sipx.SIPX_CONFDIR)/config-agent.properties" | ||
create => "true", | ||
perms => m("644"), | ||
edit_line => set_variable_values("sipxacdstatistics_config.agent"), | ||
classes => if_repaired("restart_sipxacdstatistics"), | ||
action => track("$(this.promiser)"); | ||
} | ||
|
||
bundle edit_line sipxacdstatistics_report_config { | ||
insert_lines: | ||
"$(sipx.SIPX_CFDATA)/$(sipx.location_id)/sipxconfig-report-config.part" | ||
insert_type => "file"; | ||
"LOCATION_FQDN=\"$(sys.fqhost);\""; | ||
|
||
delete_lines: | ||
".*"; | ||
} | ||
|
||
bundle agent sipxacdstatistics_setup { | ||
vars: | ||
# script uses few resources so even every minute would be reasonable | ||
# time should be less than one-half the time window sipxconfig-agent keeps | ||
# around with is currently 90 minutes (although for the first 1000 events, it doesn't | ||
# matter and sipxconfig-agent will keep at least that many) | ||
"cron" string => "*/30 * * * * $(sipx.SIPXPBXUSER) $(sipx.SIPX_BINDIR)/sipxconfig-report > /dev/null"; | ||
"cron_id" string => ".*/sipxconfig-report .*"; #regex | ||
|
||
methods: | ||
!src.sipxacdstatistics:: | ||
"any" usebundle => rh_chkconfig_status("sipxacdstatistics on"); | ||
"any" usebundle => add_crontab("$(cron_id)","$(cron)"); | ||
|
||
!src.!sipxacdstatistics:: | ||
"any" usebundle => rh_chkconfig_status("sipxacdstatistics off"); | ||
"any" usebundle => remove_crontab("$(cron_id)"); | ||
} | ||
|
||
bundle agent sipxacdstatistics_running { | ||
vars: | ||
any:: | ||
"service_command" string => "$(sipx.SIPX_BINDIR)/sipxacd-stats"; | ||
|
||
methods: | ||
any:: | ||
"any" usebundle => find_sipxservice_by_command("$(service_command)","sipxacdstatistics_running"); | ||
|
||
commands: | ||
sipxacdstatistics_running.!sipxacdstatistics:: | ||
"$(sipx.SIPX_SERVICEDIR)/sipxacdstatistics" | ||
args => "stop", | ||
action => track("sipxacdstatistics_stop"); | ||
|
||
!sipxacdstatistics_running.sipxacdstatistics:: | ||
"$(sipx.SIPX_SERVICEDIR)/sipxacdstatistics" | ||
args => "start", | ||
action => track("sipxacdstatistics_start"); | ||
|
||
restart_sipxacdstatistics:: | ||
"$(sipx.SIPX_SERVICEDIR)/sipxacdstatistics" | ||
args => "restart", | ||
action => track("sipxacdstatistics_restart"); | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.