1 Star 0 Fork 16

chen-jan/netdata

forked from src-openEuler/netdata 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
netdata.spec 9.78 KB
一键复制 编辑 原始数据 按行查看 历史
chen-jan 提交于 2023-08-24 16:31 . Upgrade to version 1.42.1
%bcond_without systemd
#We use some plugins which need suid
%global _hardened_build 1
%global plugin_go_ver 0.54.1
%global __os_install_post %{nil}
%global netdata_conf_stock %{_prefix}/lib/%{name}
# Build release candidate
%global upver 1.42.1
Name: netdata
Version: 1.42.1
Release: 1
Summary: Real-time performance monitoring
License: GPLv3 and GPLv3+ and ASL 2.0 and CC-BY-4.0 and MIT and WTFPL
URL: https://github.com/%{name}/%{name}/
Source0: https://github.com/%{name}/%{name}/archive/v%{upver}%{?rcver:-%{rcver}}/%{name}-v%{upver}%{?rcver:-%{rcver}}.tar.gz
Source1: netdata.tmpfiles.conf
Source2: netdata.init
Source3: netdata.conf
Source4: netdata.profile
Source5: README-packager.md
Source20: https://github.com/netdata/go.d.plugin/releases/download/v%{plugin_go_ver}/config.tar.gz
Source21: netdata-install-go-plugins.sh
Patch0: netdata-fix-shebang-1.41.0.patch
BuildRequires: zlib-devel git autoconf automake pkgconfig libuuid-devel freeipmi-devel httpd
BuildRequires: cppcheck gcc tinyxml2
BuildRequires: libuv-devel
BuildRequires: Judy-devel
BuildRequires: lz4-devel
BuildRequires: openssl-devel
BuildRequires: libmnl-devel
BuildRequires: make
BuildRequires: libcurl-devel
BuildRequires: systemd
BuildRequires: openssl-devel
BuildRequires: libpfm-devel
BuildRequires: libyaml-devel
BuildRequires: autogen
BuildRequires: snappy-devel
BuildRequires: protobuf-devel
BuildRequires: protobuf-c-devel
BuildRequires: findutils
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: json-c-devel
BuildRequires: libcap-devel
BuildRequires: libcmocka-devel
BuildRequires: cups-devel >= 1.7
BuildRequires: python3
Requires: nodejs
%if %{with systemd}
BuildRequires: systemd
%{?systemd_requires}
%else
Requires: initscripts /sbin/service /sbin/chkconfig
%endif
Requires: %{name}-data = %{version}-%{release} %{name}-conf = %{version}-%{release}
%description
netdata is the fastest way to visualize metrics. It is a resource
efficient, highly optimized system for collecting and visualizing any
type of realtime time-series data, from CPU usage, disk activity, SQL
queries, API calls, web site visitors, etc.
netdata tries to visualize the truth of now, in its greatest detail,
so that you can get insights of what is happening now and what just
happened, on your systems and applications.
%package data
BuildArch: noarch
Summary: Data files for netdata
%description data
Data files for netdata
%package conf
BuildArch: noarch
Summary: Configuration files for netdata
%description conf
Configuration files for netdata
%package freeipmi
Summary: FreeIPMI plugin for netdata
Requires: %{name}%{?_isa} = %{version}-%{release}
License: GPLv3
%description freeipmi
freeipmi plugin for netdata
%prep
%setup -qn %{name}-v%{upver}%{?rcver:-%{rcver}}
%patch0 -p1
rm -rf web/fonts web/gui/dashboard/static/media
cp %{SOURCE5} .
%build
autoreconf -ivf
%configure \
--prefix=%{_prefix} \
--sysconfdir=%{_sysconfdir} \
--localstatedir=%{_localstatedir} \
--enable-plugin-freeipmi \
--with-zlib --with-math --with-user=netdata
%make_build
mkdir conf.d
tar -xf %{SOURCE20} -C conf.d/
%install
%make_install
find %{buildroot} -name '.keep' -delete
# Unit file
mkdir -p %{buildroot}%{_unitdir}
mkdir -p %{buildroot}%{_tmpfilesdir}
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
install -Dp -m 0644 system/systemd/netdata.service %{buildroot}%{_unitdir}/%{name}.service
install -p -m 0644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/%{name}.conf
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}
mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
mkdir -p %{buildroot}%{_localstatedir}/cache/%{name}
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
install -p -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/%{name}/
install -Dp -m 0644 system/logrotate/netdata %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
mkdir -p %{buildroot}%{netdata_conf_stock}/conf.d
mv %{buildroot}%{_libdir}/%{name}/conf.d/* %{buildroot}%{netdata_conf_stock}/conf.d/
sed -i -e '/^script_dir/s;=.*;="\$\{NETDATA_USER_CONFIG_DIR:-%{_sysconfdir}/netdata\}";' \
%{buildroot}%{_sysconfdir}/%{name}/edit-config
# Scripts must not be in /etc
mv %{buildroot}%{_sysconfdir}/%{name}/edit-config %{buildroot}%{_libexecdir}/%{name}/edit-config
# Fix EOL
sed -i -e 's/\r//' %{buildroot}%{_datadir}/%{name}/web/lib/tableExport-1.6.0.min.js
# Delete useless hidden dir
rm -rf %{buildroot}%{_libdir}/%{name}/system
rm -rf %{buildroot}%{_datadir}/%{name}/web/.well-known
rm -f %{buildroot}%{_sysconfdir}/%{name}/conf.d/ebpf.d/ebpf_kernel_reject_list.txt
for dir in charts.d health.d python.d statsd.d ; do
mkdir -p %{buildroot}%{_sysconfdir}/%{name}/${dir}
done
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
install -p -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/profile.d/netdata.sh
sed -i -e '/NETDATA_STOCK_CONFIG_DIR/s;@STOCK_CONFIG_DIR@;%{netdata_conf_stock};' %{buildroot}%{_sysconfdir}/profile.d/netdata.sh
# Integrate go plugins
mkdir -p %{buildroot}%{_sysconfdir}/%{name}/go.d
install -p conf.d/go.d.conf %{buildroot}%{netdata_conf_stock}/conf.d/go.d.conf
cp -rp conf.d/go.d %{buildroot}%{netdata_conf_stock}/conf.d/go.d
install -p -m 0644 packaging/go.d.checksums %{buildroot}%{_datadir}/%{name}/go.d.checksums
install -p -m 0750 %{SOURCE21} %{buildroot}%{_sbindir}/netdata-install-go-plugins.sh
sed -i \
-e 's;@PLUGIN_GO_VERSION@;%{plugin_go_ver};' \
-e 's;@DATADIR@;%{_datadir};' \
-e 's;@LIBEXEC@;%{_libexecdir};' \
%{buildroot}%{_sbindir}/netdata-install-go-plugins.sh
rm -f %{buildroot}%{_sysconfdir}/%{name}/netdata-updater.conf
%check
make tests
%pre
getent group netdata > /dev/null || groupadd -r netdata
getent passwd netdata > /dev/null || useradd -r -g netdata -c "NetData User" -s /sbin/nologin -d /var/log/%{name} netdata
%post
%if 0%{?systemd_post:1}
%systemd_post %{name}.service
%else
if [ $1 = 1 ]; then
# Initial installation
%if %{with systemd}
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
%else
/sbin/chkconfig --add %{name}
%endif
fi
%endif
echo "The current config file can be downloaded with the following command"
echo "curl -o /etc/netdata/netdata.conf http://localhost:19999/netdata.conf"
%preun
%if 0%{?systemd_preun:1}
%systemd_preun %{name}.service
%else
if [ "$1" = 0 ] ; then
# Package removal, not upgrade
%if %{with systemd}
/bin/systemctl --no-reload disable %{name}.service >/dev/null 2>&1 || :
/bin/systemctl stop %{name}.service >/dev/null 2>&1 || :
%else
/sbin/service %{name} stop > /dev/null 2>&1
/sbin/chkconfig --del %{name}
%endif
fi
exit 0
%endif
%postun
%if 0%{?systemd_postun_with_restart:1}
%systemd_postun_with_restart %{name}.service
%else
%if %{with systemd}
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ]; then
# Package upgrade, not uninstall
/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
fi
%else
if [ "$1" -ge 1 ]; then
/sbin/service %{name} restart > /dev/null 2>&1
fi
exit 0
%endif
%endif
%triggerun -- netdata
%if %{with systemd}
if [ -f /etc/rc.d/init.d/%{name} ]; then
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply netdata
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save %{name} >/dev/null 2>&1 ||:
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
fi
%endif
%files
%doc README.md CHANGELOG.md README-packager.md
%license LICENSE REDISTRIBUTED.md
%{_sbindir}/%{name}
%{_sbindir}/%{name}-claim.sh
%{_sbindir}/%{name}cli
%{_libexecdir}/%{name}
%if %{with systemd}
%{_unitdir}/%{name}.service
%{_tmpfilesdir}/%{name}.conf
%else
%attr(0755,root,root) %{_initrddir}/%{name}
%endif
%attr(4755,root,root) %{_libexecdir}/%{name}/plugins.d/apps.plugin
%exclude %{_libexecdir}/%{name}/plugins.d/freeipmi.plugin
%attr(0755, netdata, netdata) %{_localstatedir}/lib/%{name}
%attr(0755, netdata, netdata) %dir %{_localstatedir}/cache/%{name}
%attr(0755, netdata, netdata) %dir %{_localstatedir}/log/%{name}
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%attr(0750,root,netdata)%{_sbindir}/netdata-install-go-plugins.sh
%files conf
%doc README.md
%license LICENSE REDISTRIBUTED.md
%dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}/charts.d
%dir %{_sysconfdir}/%{name}/health.d
%dir %{_sysconfdir}/%{name}/python.d
%dir %{_sysconfdir}/%{name}/statsd.d
%dir %{_sysconfdir}/%{name}/go.d
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%dir %{netdata_conf_stock}/conf.d
%{netdata_conf_stock}/conf.d/*
%config %{_sysconfdir}/logrotate.d/netdata
%config %{_sysconfdir}/profile.d/netdata.sh
%dir %{_libexecdir}/%{name}
%{_libexecdir}/%{name}/edit-config
%{_sysconfdir}/netdata/.install-type
%files data
%doc README.md
%license LICENSE REDISTRIBUTED.md
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/web
%{_datadir}/%{name}/go.d.checksums
%files freeipmi
%doc README.md
%license LICENSE REDISTRIBUTED.md
%attr(4755,root,root) %{_libexecdir}/%{name}/plugins.d/freeipmi.plugin
%changelog
* Thu Aug 24 2023 chenchen <[email protected]> - 1.42.1-1
- Upgrade to version 1.42.1
* Tue Jun 21 2022 Chenyx <[email protected]> - 1.16.0-4
- License compliance rectification
* Sat Jan 29 2022 caodongxia <[email protected]> - 1.16.0 - 3
- remove install requires glyphicons-halfings-fonts
* Wed Aug 04 2021 sunguoshuai <[email protected]> - 1.16.0 - 2
- Fix missing extern in some global variables
* Thu Jun 24 2021 baizhonggui <[email protected]> - 1.16.0 - 1
- package init
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chen-jan/netdata.git
[email protected]:chen-jan/netdata.git
chen-jan
netdata
netdata
master

搜索帮助