diff --git a/.gitignore b/.gitignore index e69de29..4ddc6db 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,28 @@ +/carbon-c-relay-20076363b928af35357f4a781227dfdc2751979c.tar.gz +/carbon-c-relay-a45e94180836ce994f97bbfea16ea105748e61f4.tar.gz +/carbon-c-relay-7f48c2f07e7d24201a50b0529b6d2570a4859021.tar.gz +/carbon-c-relay-d1d987eeb40276443f510c943a1b8afe087ba2d3.tar.gz +/carbon-c-relay-4964e5112295cbf794faf55796424e5f6dd661e9.tar.gz +/carbon-c-relay-38fac767bf35aa6ecc4f9ea0c8861607325789bf.tar.gz +/carbon-c-relay-6eb1fe4.tar.gz +/carbon-c-relay-1dae063.tar.gz +/carbon-c-relay-c006acc.tar.gz +/carbon-c-relay-d313202.tar.gz +/carbon-c-relay-6e0c726.tar.gz +/carbon-c-relay-0617373.tar.gz +/carbon-c-relay-4218754.tar.gz +/carbon-c-relay-b55b2e1.tar.gz +/carbon-c-relay-15d2376.tar.gz +/carbon-c-relay-c09b37b.tar.gz +/carbon-c-relay-2fd5d55.tar.gz +/carbon-c-relay-6a4b10c.tar.gz +/carbon-c-relay-2e76c18.tar.gz +/carbon-c-relay-633ff61.tar.gz +/carbon-c-relay-6d4882c.tar.gz +/carbon-c-relay-9cdf4d4.tar.gz +/carbon-c-relay-98424a5.tar.gz +/carbon-c-relay-ac8cc10.tar.gz +/carbon-c-relay-b785959.tar.gz +/carbon-c-relay-2d34f86.tar.gz +/carbon-c-relay-20dd600.tar.gz +/carbon-c-relay-3.6.tar.gz diff --git a/carbon-c-relay.conf b/carbon-c-relay.conf new file mode 100644 index 0000000..a32242c --- /dev/null +++ b/carbon-c-relay.conf @@ -0,0 +1,63 @@ +# comments are allowed in any place and start with a hash (#) +# +#cluster +# [replication ]> +# ]> ... +# ; +#match <* | > +# send to +# [stop] +# ; +#rewrite +# into +# ; +#aggregate +# ... +# every seconds +# expire after seconds +# compute write to +# +# [compute ...] +# ; + +cluster local_carbon + forward + 127.0.0.1:2013 + ; + +################################################################################ +## Some example re-writes to make the graphite tree cleaner. +## This is site specific as the regex assumes the fqdn is 5 elements long. + +## rewrite carbon c relay internal statistics +## from carbon.relays.twiki501.back.test.bc.local.metricsQueued +## into bc.test.twiki.twiki501.relay.metricsQueued +#rewrite ^carbon\.relays\.([a-zA-Z]+)([0-9]+)_([a-zA-Z0-9]+)_([a-zA-Z0-9]+)_([a-zA-Z0-9]+)_([a-zA-Z0-9]+)\.(.*) +# into \5.\4.\1.\1\2.relay.\7 +# ; +## rewrite metrics to reverse hostname +## from twiki501.back.test.bc.local.haggar.agent.0.metrics.0 +## into bc.test.twiki.twiki501.haggar.agent.0.metrics.0 +#rewrite ^([a-zA-Z]+)([0-9]+)\.back\.([a-zA-Z0-9]+)\.([a-zA-Z0-9]+)\.local(.*) +# into \4.\3.\1\.\1\2\5 +# ; +## rewrite metrics from statsite +## forom sandbox.test.twiki.twiki001.statsite.gauges.gunicorn.workers +## from twiki001.back.test.sandbox.local.statsite.gauges.gunicorn.workers +## into sandbox.test.twiki.twiki001.statsite.gunicorn.gauges.workers +#rewrite ^([a-zA-Z0-9]+)\.([a-zA-Z0-9]+)\.([a-zA-Z0-9]+)\.([a-zA-Z]+)([0-9]+)\.statsite\.([a-zA-Z]+)\.([a-zA-Z]+)\.(.*) +# into \1.\2.\3.\4\5.statsite.\7.\6.\8 +# ; +## clean up statsite numstats metric +## from sandbox.test.twiki.twiki001.statsite.counts.numStats +## into sandbox.test.twiki.twiki001.statsite.numStats +#rewrite ^([a-zA-Z0-9]+)\.([a-zA-Z0-9]+)\.([a-zA-Z0-9]+)\.([a-zA-Z]+)([0-9]+)\.statsite\.counts\.(.*) +# into \1.\2.\3.\4\5.statsite.\6 +# ; +################################################################################ + + +match * + send to local_carbon + stop + ; diff --git a/carbon-c-relay.service b/carbon-c-relay.service new file mode 100644 index 0000000..269cb90 --- /dev/null +++ b/carbon-c-relay.service @@ -0,0 +1,14 @@ +[Unit] +Description=Enhanced C implementation of Carbon relay, aggregator and rewriter +After=network.target + +[Service] +User=carbon-c-relay +Type=simple +EnvironmentFile=-/etc/sysconfig/carbon-c-relay +ExecStart=/usr/bin/carbon-c-relay -f /etc/carbon-c-relay.conf $ARGS +ExecReload=/bin/kill -HUP $MAINPID +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/carbon-c-relay.spec b/carbon-c-relay.spec new file mode 100644 index 0000000..cb8fed4 --- /dev/null +++ b/carbon-c-relay.spec @@ -0,0 +1,306 @@ +Name: carbon-c-relay +Version: 3.6 +Release: 2%{?dist} +Summary: Enhanced C implementation of Carbon relay, aggregator and rewriter +License: ASL 2.0 +URL: https://github.com/grobian/carbon-c-relay +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz +Source1: carbon-c-relay.service +Source2: carbon-c-relay.conf +Source3: carbon-c-relay.sysconfig.systemd + +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool +BuildRequires: gcc +BuildRequires: make +BuildRequires: bison +BuildRequires: flex +%if ! (0%{?rhel} && 0%{?rhel} <= 7) +BuildRequires: /usr/bin/ronn +BuildRequires: pcre2-devel +%else +BuildRequires: pcre-devel +%endif +BuildRequires: zlib-devel +BuildRequires: lz4-devel +BuildRequires: openssl-devel + +Requires(pre): shadow-utils + +%if 0%{?rhel} && 0%{?rhel} <= 7 +BuildRequires: systemd +%else +BuildRequires: systemd-rpm-macros +%endif + +# carbon-c-relay ships a bundled md5 library for which an exception exists +# see: https://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries +Provides: bundled(md5-peslyak) + +%description +Carbon-like Graphite line mode relay. This project aims to be a replacement of +the original Carbon relay. The main reason to build a replacement is +performance and configurability. Carbon is single threaded, and sending +metrics to multiple consistent-hash clusters requires chaining of relays. This +project provides a multithreaded relay which can address multiple targets and +clusters for each and every metric based on pattern matches. + +%prep +%autosetup +# remove pregenerated bison and flex files +rm conffile.tab.c conffile.tab.h conffile.yy.c + +%build +autoreconf -vfi +%configure \ + --with-gzip \ + --with-lz4 \ + --with-snappy=no \ + --with-ssl \ + --with-oniguruma=no \ +%if 0%{?rhel} && 0%{?rhel} <= 7 + --with-pcre2=no \ + --with-pcre \ +%else + --with-pcre2 \ + --with-pcre=no \ +%endif + %{nil} +%make_build + +%if ! (0%{?rhel} && 0%{?rhel} <= 7) +ronn --roff carbon-c-relay.md > carbon-c-relay.1 +%else +cp -a relay.1 carbon-c-relay.1 +%endif + +%install +install -Dp -m0755 relay %{buildroot}%{_bindir}/%{name} +install -Dp -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}.conf + +install -Dp -m0644 carbon-c-relay.1 %{buildroot}%{_mandir}/man1/carbon-c-relay.1 + +install -Dp -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service +install -Dp -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name} + +%check +# https://github.com/grobian/carbon-c-relay/issues/403 +#make test + +%pre +getent group carbon-c-relay >/dev/null || groupadd -r carbon-c-relay +getent passwd carbon-c-relay >/dev/null || \ + useradd -r -g carbon-c-relay -d / -s /sbin/nologin \ + -c "Carbon C Relay Daemon" carbon-c-relay +exit 0 + +%post +%systemd_post %{name}.service + +%preun +%systemd_preun %{name}.service + +%postun +%systemd_postun_with_restart %{name}.service + +%files +%license LICENSE.md +%doc carbon-c-relay.md ChangeLog.md +%{_bindir}/carbon-c-relay +%{_mandir}/man1/carbon-c-relay.1* +%config(noreplace) %{_sysconfdir}/carbon-c-relay.conf +%config(noreplace) %{_sysconfdir}/sysconfig/carbon-c-relay +%{_unitdir}/%{name}.service + +%changelog +* Tue Jan 28 2020 Fedora Release Engineering - 3.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Wed Jan 22 2020 Igor Raits - 3.6-1 +- Update to 3.6 + + Enable gzip compression support + + Enable lz4 compression support + + Enable SSL support + + Simplify systemd configuration + +* Wed Jul 24 2019 Fedora Release Engineering - 3.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Thu Jan 31 2019 Fedora Release Engineering - 3.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Sun Oct 21 2018 Piotr Popieluch - 3.4-1 +- Update to 3.4 +- Remove el5 support + +* Thu Jul 12 2018 Fedora Release Engineering - 3.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Fri Mar 23 2018 Piotr Popieluch - 3.3-1 +- Update to 3.3 + +* Wed Feb 07 2018 Fedora Release Engineering - 3.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Fri Oct 27 2017 Piotr Popieluch - 3.2-3 +- Ship pregenerated Makefile.in (automake fails on epel7) + +* Fri Oct 27 2017 Piotr Popieluch - 3.2-2 +- Update dependencies in Makefile.am to fix parallell builds + +* Mon Oct 23 2017 Piotr Popieluch - 3.2-1 +- Update to 3.2 + +* Wed Aug 02 2017 Fedora Release Engineering - 3.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Sun Jul 30 2017 Florian Weimer - 3.1-3 +- Rebuild with binutils fix for ppc64le (#1475636) + +* Wed Jul 26 2017 Fedora Release Engineering - 3.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Tue May 02 2017 Piotr Popieluch - 3.1-1 +- Update to 3.1 +- run ./configure in %%build + +* Thu Apr 13 2017 Piotr Popieluch - 3.0-1 +- Update to 3.0 + +* Tue Feb 07 2017 - 2.6-2 +- Add example systemd limits configuration + +* Thu Jan 26 2017 piotr1212@gmail.com - 2.6-1 +- Update to 2.6 + +* Wed Jan 11 2017 piotr1212@gmail.com - 2.5-1 +- Update to 2.5 + +* Tue Nov 08 2016 Piotr Popieluch - - 2.3-1 +- Update to 2.3 + +* Fri Sep 16 2016 Piotr Popieluch - - 2.2-2 +- Remove braces from systemd service file to correctly interpret arguments + +* Sun Sep 11 2016 Piotr Popieluch - - 2.2-1 +- Update to 2.2 + +* Thu Jul 07 2016 Piotr Popieluch - - 2.1-2 +- Add ExecReload SIGHUP to systemd unit + +* Mon Jun 20 2016 Piotr Popieluch - - 2.1-1 +- Update to 2.1 + +* Wed Jun 15 2016 Piotr Popieluch - - 2.0-2 +- Disable manpage creation for systems which don't have nodejs + +* Mon Jun 06 2016 Piotr Popieluch - - 2.0-1 +- Update to upstream 2.0 +- Generate man file + +* Fri Apr 22 2016 Piotr Popieluch - 1.11-2 +- Set correct user in systemd unit file +- Remove logfile in sysconfig on systemd releases + +* Wed Mar 23 2016 Piotr Popieluch - 1.11-1 +- Update to upstream 1.11 + +* Thu Mar 10 2016 Piotr Popieluch - 1.10-1 +- Update to upstream 1.10 +- el5/el6: Use new daemon mode in non systemd systems + +* Tue Feb 23 2016 Piotr Popieluch - 1.8-1 +- Update to upstream 1.8 +- el5: add clean section and conditionalize all el5 specifics + +* Fri Feb 19 2016 Piotr Popieluch - 1.7-3 +- Add BR gcc and make https://fedorahosted.org/fpc/ticket/540 + +* Wed Feb 03 2016 Fedora Release Engineering - 1.7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Sun Jan 31 2016 Piotr Popieluch - 1.7-1 +- Update to upstream 1.7 + +* Thu Jan 14 2016 Piotr Popieluch - 1.5-1 +- Update to upstream 1.5 + +* Mon Jan 04 2016 Piotr Popieluch - 1.4-1 +- Update to upstream 1.4 + +* Wed Dec 16 2015 Piotr Popieluch - 1.3-1 +- Update to upstream 1.3 + +* Fri Dec 11 2015 Piotr Popieluch - 1.2-1 +- Update to upstream 1.2 + +* Wed Nov 25 2015 Piotr Popieluch - 1.1-1 +- Update to upstream 1.1 + +* Sat Nov 07 2015 Piotr Popieluch - 0.45-1 +- Update to new version +- Set LDFLAGS to build with PIE +- Update Source to follow github source guidelines + +* Mon Aug 31 2015 Piotr Popieluch - 0.44-3 +- Exclude 32 bit arches + +* Sun Aug 30 2015 Piotr Popieluch - 0.44-2 +- Add el5 support + +* Fri Aug 14 2015 Piotr Popieluch - 0.44-1 +- Update to upstream 0.44 +- Use own relay.conf + +* Mon Jul 27 2015 Piotr Popieluch - 0.43-2 +- specify copylib 'Provides: bundled(md5-peslyak)' + +* Mon Jul 27 2015 Piotr Popieluch - 0.43-1 +- Update to upstream 0.43 + +* Mon Jul 27 2015 Piotr Popieluch - 0.42-2 +- Removed obsoleted BR: openssl-devel + +* Fri Jul 24 2015 Piotr Popieluch - 0.42-1 +- Update to upstream 0.42 +- Remove allow-percent patch, characters are now configurable +- Make characters to allow configurable in sysconfig + +* Wed Jun 17 2015 Fedora Release Engineering - 0.40-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Tue May 12 2015 Piotr Popieluch - 0.40-1 +- update to upstream 0.40 +- add logfile to sysconfig + +* Fri May 01 2015 Piotr Popieluch - 0.39-3 +- update to later commit to fix closed udp sockets +- logrotate sighup instead of restart +- allow percent characters in metric names + +* Thu Apr 02 2015 Piotr Popieluch - 0.39-2 +- fix filepath in logrotate + +* Sat Mar 28 2015 Piotr Popieluch - 0.39-1 +- update to latest upstream 0.39 + +* Wed Feb 4 2015 Piotr Popieluch - 0.37-1 +- update to upstream 0.37 +- rewritten for Fedora and comply with Fedora package guidelines + +* Mon Sep 8 2014 Matthew Hollick +- tidy up for github +- reverted site specific changes + +* Fri Aug 8 2014 Matthew Hollick +- packaged as part of twiki + +* Tue Jul 1 2014 Matthew Hollick +- packaged as part of mdr +- binary renamed from 'relay' to 'cc_relay' +- pagage renamed to reflect function rather than component +- user / group named by function + +* Tue May 6 2014 Matthew Hollick +- Initial package for the BBC diff --git a/carbon-c-relay.sysconfig.systemd b/carbon-c-relay.sysconfig.systemd new file mode 100644 index 0000000..37ee8c1 --- /dev/null +++ b/carbon-c-relay.sysconfig.systemd @@ -0,0 +1,26 @@ +# Pass extra options to the carbon-c-relay. + +# -f read for clusters and routes +# -p listen on for connections, defaults to 2003 +# -l write output to , defaults to stdout/stderr +# -w use worker threads, defaults to the amount of detected CPU cores +# -b server send batch size, defaults to 2500 +# -q server queue size, defaults to 25000 +# -L server max stalls, defaults to 4 +# -C use CA to verify SSL connections +# -B connection listen backlog, defaults to 32 +# -U socket receive buffer size, max/min/default values depend on OS +# -T IO timeout in milliseconds for server connections, defaults to 600 +# -E disable disconnecting idle connections after 10 minutes +# -c characters to allow next to [A-Za-z0-9], defaults to -_:# +# -m max string length of metric, defaults to 0, limit of -M +# -M max string length of metric+ts+value+nl, defaults to 32768 +# -d debug mode: currently writes statistics to log, prints hash +# ring contents and matching position in test mode (-t) +# -s submission mode: don't add any metrics to the stream like +# statistics, report drop counts and queue pressure to log +# -t config test mode: prints rule matches from input on stdin +# -H hostname: override hostname (used in statistics) +# -O minimum number of rules before optimising the ruleset, default: 50 + +#ARGS="-l /var/log/carbon-c-relay/carbon-c-relay.log" diff --git a/sources b/sources index e69de29..7b5f641 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (carbon-c-relay-3.6.tar.gz) = be7a77b1d7d98bd0e3879ebd8c37e6cbacd7132b707d2c0a52062df7a4214919b3fa430876ab0bb07a0fd7d83359ce888c7620fbc967cfe62177fe91c208b667