Skip to content

Commit

Permalink
Restart XCollector after package upgrade (#65)
Browse files Browse the repository at this point in the history
* Bumped up number of retries

* Set timeout while sending data over http/s

* Thread scheduling improvements
Do not starve other collectors if one collector is pushing too much data
Do not sleep when there is data to be data to be read/sent

* mentric printer thread should exit if the main thread exits

* Added flush method to stdout/stderr streams

* Added support for flushBeforeExit option so that tests wait for all data
Assertions are to be applied only after all data is received

* Converted flushBeforeExit option to function to make pylint happy
Pylint was failing with following error even though we had hasattr check
E: 41,88: Module 'collectors.etc.udp_bridge_conf' has no 'flushBeforeExit' member (no-member)

* Converted flushBeforeExit option to function to make pylint happy
Pylint was failing with following error even though we had hasattr check
E: 41,88: Module 'collectors.etc.udp_bridge_conf' has no 'flushBeforeExit' member (no-member)

* Codacy love

* Support an option to set yaml config folder
Allow running collectors for diff tenants (different xcollector.yml files) from same installation folder

* Removed debug traceback

* Do not replace config files on upgrade by default
By default we were replacing the config files on rpm update. This would overwrite the api-token and the service would not start without a manual intervention.
Using the %config(noreplace) option now ... so the rpm upgrade experience is consistent with deb upgrade process.

* Restart xcollector after package upgrade
  • Loading branch information
rshivane authored and phakudi committed Sep 3, 2018
1 parent ab8d48d commit fcbcf7e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 2 additions & 0 deletions deb/DEBIAN/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,7 @@ esac

if [ -e "/etc/init.d/xcollector" ]; then
update-rc.d xcollector defaults 95 10 >/dev/null
#restart collector if an access token has been configured in the yml (we are upgrading the package)
grep PASTE_ACCESS_TOKEN_HERE /etc/xcollector/xcollector.yml >/dev/null || invoke-rc.d xcollector start
fi

20 changes: 11 additions & 9 deletions rpm/xcollector.spec
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ mkdir -p %{buildroot}/%{py2_sitelib}/
#%{tcollectordir}/collectors/etc/udp_bridge_conf.py
#%{tcollectordir}/collectors/etc/zabbix_bridge_conf.py
%{tcollectordir}/collectors/etc/udp_bridge_conf.py
%{tcollectordir}/conf/grok.yml %config
%{tcollectordir}/conf/grok_nginx.yml %config
%{tcollectordir}/conf/grok_tomcat.yml %config
%{tcollectordir}/conf/mysql.yml %config
%{tcollectordir}/conf/memcached_metrics.yml %config
%{tcollectordir}/conf/mysql_metrics.yml %config
%{tcollectordir}/conf/node_metrics.yml %config
%{tcollectordir}/conf/xcollector.yml %config
%{tcollectordir}/conf/grok.yml %config(noreplace)
%{tcollectordir}/conf/grok_nginx.yml %config(noreplace)
%{tcollectordir}/conf/grok_tomcat.yml %config(noreplace)
%{tcollectordir}/conf/mysql.yml %config(noreplace)
%{tcollectordir}/conf/memcached_metrics.yml %config(noreplace)
%{tcollectordir}/conf/mysql_metrics.yml %config(noreplace)
%{tcollectordir}/conf/node_metrics.yml %config(noreplace)
%{tcollectordir}/conf/xcollector.yml %config(noreplace)
%{tcollectordir}/xcollector.py
%{tcollectordir}/grok_scraper.py
%{tcollectordir}/collectors/0/dfstat.py
Expand Down Expand Up @@ -142,7 +142,6 @@ if [ "$1" = "2" ]; then
fi

%post
chkconfig --add xcollector
if [ ! -L "/etc/xcollector" ]
then
ln -s %{tcollectordir}/conf /etc/xcollector
Expand Down Expand Up @@ -184,6 +183,9 @@ chown -R $XCOLLECTOR_USER.$XCOLLECTOR_GROUP /usr/local/xcollector
chown -R $XCOLLECTOR_USER.$XCOLLECTOR_GROUP /var/run/xcollector
chown -R $XCOLLECTOR_USER.$XCOLLECTOR_GROUP /var/log/xcollector

chkconfig --add xcollector
grep PASTE_ACCESS_TOKEN_HERE /etc/xcollector/xcollector.yml >/dev/null || service xcollector start

%preun
if [ "$1" = "0" ]; then
# stop service before starting the uninstall
Expand Down

0 comments on commit fcbcf7e

Please sign in to comment.