6cb6e902创建于 2月11日历史提交
# Copyright (c) Huawei Technologies Co., Ltd. 2014-2023. All rights reserved.
# Description: spec file for package syssentry

Summary: System Inspection Framework
Name: sysSentry
Version: 1.0.3
Release: 22
License: Mulan PSL v2
Group: System Environment/Daemons
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz

Patch1:    add-bidirectional-communication-for-xalarm.patch
Patch2:    fix-some-test-cases.patch
Patch3:    add-log-for-xalarmd-and-fix-delete-on-iter-problem.patch
Patch4:    fix-xalarm-log-not-print-and-add-on-iter-problem.patch
Patch5:    add-new-func-for-ebpf-in-the-rq_driver-stage.patch
Patch6:    fix-the-sentryCollector-service-can-t-be-stopped-for.patch
Patch7:    add-dfx-for-xalarmd-to-rebuild-connection-after-comm.patch
Patch8:    fix-an-issue-with-printing-error.patch
Patch9:    ai-block-io-exit-when-stage-is-not-supported.patch
Patch10:   add-log-utils-for-c.patch
Patch11:   add-sentry-msg-monitor.patch
Patch12:   add-oom-event-report.patch
Patch13:   fix-cpu_alarm_fd-and-bmc_fd.patch
Patch14:   fix-period-task-some-bugs.patch
Patch15:   fix-env-for-subprocess.Popen.patch
Patch16:   Use-malloc-to-allocate-memory-as-much-as-possible.patch
Patch17:   fix-cpu_sentry-result-when-found_fault_cores_number-.patch
Patch18:   fix-some-code-bugs.patch
Patch19:   add-bmc_block_io.patch
Patch20:   Add-SOC-Ring-sentry-function.patch
Patch21:   Add-testcase-tc_ring-for-SOC-Ring-sentry.patch
Patch22:   testcase-tc_ring-cleancode.patch
Patch23:   Fix-issue-cores-with-isolcpus-set-blacklis.patch
Patch24:   Fix-issue-inconsistent-status-and-result-a.patch
Patch25:   Use-panic-instead-of-coredump-file.patch
Patch26:   Fix-Security-Scan-Warning.patch
Patch27:   Fix-two-code-review-comments.patch
Patch28:   Add-MulanV2-License-statement.patch
Patch29:   slow-io-plugin-upgrade.patch
Patch30:   fix-potential-use-after-free-bugs-in-libxalarm.patch

BuildRequires: cmake gcc-c++
BuildRequires: python3 python3-setuptools
BuildRequires: json-c-devel
BuildRequires: chrpath
BuildRequires: elfutils-devel clang libbpf-devel bpftool
BuildRequires: python3-numpy python3-pytest
BuildRequires: numactl-libs numactl-devel

Provides:      pyxalarm = %{version}-%{release}
Obsoletes:     pyxalarm < 1.0.3-21
Requires:      libbpf

%define PYTHON_VERSION %{python3_version}
%define PKGVER syssentry-%{version}-py%{PYTHON_VERSION}.egg-info

%description
sysSentry provides framework tools for system inspection.

%package -n libxalarm
Summary:        The xalarm library for the sysSentry
Requires:       json-c
Requires:       sysSentry = %{version}-%{release}
Provides:       libxalarm = %{version}-%{release}

%description -n libxalarm
This package provides xalarm library for the sysSentry.

%package -n libxalarm-devel
Summary:        The development package for the libxalarm
Requires:       libxalarm = %{version}-%{release}
Requires:       json-c-devel
Provides:       libxalarm-devel = %{version}-%{release}

%description -n libxalarm-devel
This package provides developer tools for the libxalarm.

%package -n avg_block_io
Summary:        Supports slow I/O detection
Requires:       sysSentry = %{version}-%{release}
Requires:       pysentry_notify = %{version}-%{release}
Requires:       pysentry_collect = %{version}-%{release}

%description -n avg_block_io
This package provides Supports slow I/O detection based on EBPF

%package -n ai_block_io
Summary:        Supports slow I/O detection
Requires:       python3-numpy
Requires:       sysSentry = %{version}-%{release}
Requires:       pysentry_notify = %{version}-%{release}
Requires:       pysentry_collect = %{version}-%{release}

%description -n ai_block_io
This package provides Supports slow I/O detection based on AI

%package -n pysentry_notify
Summary:        Supports xalarm report in python immplementation
Requires:       sysSentry = %{version}-%{release}

%description -n pysentry_notify
This package provides Supports xalarm report for plugins

%package -n pysentry_collect
Summary:        Supports collect in python immplementation
Requires:       sysSentry = %{version}-%{release}

%description -n pysentry_collect
This package provides Supports collect for plugins

%package -n hbm_online_repair
Summary:        hbm_online_repair for the sysSentry
Provides:       hbm_online_repair = %{version}-%{release}
BuildRequires:  libtraceevent-devel
Requires:       libtraceevent ipmitool
Requires:       sysSentry = %{version}-%{release}

%description -n hbm_online_repair
This package provides hbm_online_repair for the sysSentry.

%package -n sentry_msg_monitor
Summary:        A plugin for sysSentry to listening specific messages
Requires:       sysSentry = %{version}-%{release}
Provides:       sentry_msg_monitor = %{version}-%{release}

%description -n sentry_msg_monitor
This package provides a plugin for sysSentry to listening specific messages

%package -n bmc_block_io
Summary:        bmc_block_io for the sysSentry
Provides:       bmc_block_io = %{version}-%{release}
BuildRequires:  json-c-devel
Requires:       libxalarm ipmitool json-c
Requires:       sysSentry = %{version}-%{release}

%description -n bmc_block_io
This package provides bmc_block_io for the sysSentry.

%package -n soc_ring_sentry
Summary:        soc_ring_sentry for the sysSentry
Provides:       soc_ring_sentry = %{version}-%{release}
BuildRequires:  numactl-libs numactl-devel
Requires:       sysSentry = %{version}-%{release}

%description -n soc_ring_sentry
This package provides soc_ring_sentry for the sysSentry.

%prep
%autosetup -n %{name}-%{version} -p1

%build
%make_build

%install
%make_install

%post
/sbin/ldconfig

%preun
if [ "$1" = "0" ]; then
    systemctl stop xalarmd.service
    systemctl disable xalarmd.service
    systemctl stop sysSentry.service
    systemctl disable sysSentry.service
    systemctl stop sentryCollector.service
    systemctl disable sentryCollector.service
fi
rm -rf /var/run/xalarm | :
rm -rf /var/run/sysSentry | :

%postun
/sbin/ldconfig

%files
%defattr(-,root,root)
%attr(-,root,root) %{python3_sitelib}/xalarm
%attr(-,root,root) %{python3_sitelib}/syssentry
%attr(-,root,root) %{python3_sitelib}/%{PKGVER}
%attr(-,root,root) %{python3_sitelib}/sentryCollector

# sysSentry
%attr(-,root,root) %{_bindir}/sentryctl
%attr(-,root,root) %{_bindir}/syssentry
%attr(-,root,root) %{_bindir}/ebpf_collector
%attr(-,root,root) %config(noreplace) %{_var}/log/sysSentry
%attr(-,root,root) %config(noreplace) %{_sysconfdir}/sysSentry/
%attr(-,root,root) %config(noreplace) %{_sysconfdir}/sysSentry/tasks
%attr(-,root,root) %config(noreplace) %{_sysconfdir}/sysSentry/plugins
%attr(-,root,root) %config(noreplace) %{_sysconfdir}/sysSentry/inspect.conf
%attr(-,root,root) %{_unitdir}/sysSentry.service
%attr(-,root,root) %{_libdir}/libsentry_log.so
%exclude %{_includedir}/libsentry/log_utils.h

# pysentry_collect
%exclude %{python3_sitelib}/sentryCollector/collect_plugin.py
%exclude %{python3_sitelib}/sentryCollector/__pycache__/collect_plugin.*.pyc
# pysentry_notify
%exclude %{python3_sitelib}/xalarm/sentry_notify.py
%exclude %{python3_sitelib}/xalarm/__pycache__/sentry_notify.*.pyc

%exclude %{_sysconfdir}/sysSentry/tasks/ai_block_io.mod
%exclude %{_sysconfdir}/sysSentry/plugins/ai_block_io.ini
%exclude %{_sysconfdir}/sysSentry/tasks/avg_block_io.mod
%exclude %{_sysconfdir}/sysSentry/plugins/avg_block_io.ini
%exclude %{_sysconfdir}/sysSentry/tasks/bmc_block_io.mod
%exclude %{_sysconfdir}/sysSentry/plugins/bmc_block_io.ini

# xalarm
%attr(-,root,root) %{_bindir}/xalarmd
%attr(-,root,root) %config(noreplace) %{_sysconfdir}/sysSentry/xalarm.conf
%attr(-,root,root) %{_unitdir}/xalarmd.service

# logrotate
%dir %{_localstatedir}/lib/logrotate-syssentry
%attr(-,root,root) %config(noreplace) %{_sysconfdir}/sysSentry/logrotate-sysSentry.conf
%attr(-,root,root) %{_sysconfdir}/cron.hourly/logrotate-sysSentry

# sentryCollector
%attr(-,root,root) %{_bindir}/sentryCollector
%attr(-,root,root) %{_sysconfdir}/sysSentry/collector.conf
%attr(-,root,root) %{_unitdir}/sentryCollector.service

# hbm_online_repair
%exclude %{_sysconfdir}/sysSentry/tasks/hbm_online_repair.mod
%exclude %{python3_sitelib}/syssentry/bmc_*
%exclude %{python3_sitelib}/syssentry/*/bmc_*

# sentry_msg_monitor
%exclude %{_sysconfdir}/sysconfig/sentry_msg_monitor.env
%exclude %{_sysconfdir}/sysSentry/tasks/sentry_msg_monitor.mod

# soc_ring_sentry
%exclude %{_sysconfdir}/sysconfig/soc_ring_sentry.env
%exclude %{_sysconfdir}/sysSentry/tasks/soc_ring_sentry.mod

%files -n libxalarm
%attr(-,root,root) %{_libdir}/libxalarm.so

%files -n libxalarm-devel
%dir %{_includedir}/xalarm
%attr(-,root,root) %{_includedir}/xalarm
%attr(-,root,root) %{_includedir}/xalarm/register_xalarm.h

%files -n pysentry_notify
%attr(-,root,root) %{python3_sitelib}/xalarm/sentry_notify.py
%attr(-,root,root) %{python3_sitelib}/xalarm/__pycache__/sentry_notify.*.pyc

%files -n avg_block_io
%attr(-,root,root) %{_bindir}/avg_block_io
%attr(-,root,root) %config(noreplace) %{_sysconfdir}/sysSentry/tasks/avg_block_io.mod
%attr(-,root,root) %{_sysconfdir}/sysSentry/plugins/avg_block_io.ini
%attr(-,root,root) %{python3_sitelib}/sentryPlugins/avg_block_io

%files -n ai_block_io
%attr(-,root,root) %{_bindir}/ai_block_io
%attr(-,root,root) %config(noreplace) %{_sysconfdir}/sysSentry/tasks/ai_block_io.mod
%attr(-,root,root) %{_sysconfdir}/sysSentry/plugins/ai_block_io.ini
%attr(-,root,root) %{python3_sitelib}/sentryPlugins/ai_block_io

%files -n pysentry_collect
%attr(-,root,root) %{python3_sitelib}/sentryCollector/collect_plugin.py
%attr(-,root,root) %{python3_sitelib}/sentryCollector/__pycache__/collect_plugin.*.pyc

%files -n hbm_online_repair
%attr(-,root,root) %{_bindir}/hbm_online_repair
%attr(-,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/hbm_online_repair.env
%attr(-,root,root) %config(noreplace) %{_sysconfdir}/sysSentry/tasks/hbm_online_repair.mod
%attr(-,root,root) %{python3_sitelib}/syssentry/bmc_alarm.py
%attr(-,root,root) %{python3_sitelib}/syssentry/__pycache__/bmc_alarm.*.pyc

%files -n sentry_msg_monitor
%attr(-,root,root) %{_bindir}/sentry_msg_monitor
%attr(-,root,root) %{_sysconfdir}/sysconfig/sentry_msg_monitor.env
%attr(-,root,root) %{_sysconfdir}/sysSentry/tasks/sentry_msg_monitor.mod

%files -n bmc_block_io
%attr(-,root,root) %{_bindir}/bmc_block_io
%attr(-,root,root) %{_sysconfdir}/sysSentry/plugins/bmc_block_io.ini
%attr(-,root,root) %{_sysconfdir}/sysSentry/tasks/bmc_block_io.mod

%files -n soc_ring_sentry
%attr(-,root,root) %{_bindir}/soc_ring_sentry
%attr(-,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/soc_ring_sentry.env
%attr(-,root,root) %config(noreplace) %{_sysconfdir}/sysSentry/tasks/soc_ring_sentry.mod

%changelog
* Wed Feb 11 2026 shixuantong <shixuantong1@h-partners.com> - 1.0.3-22
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:do change permission in spec

* Tue Feb 03 2026 shixuantong <shixuantong1@h-partners.com> - 1.0.3-21
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix residual files exist after the rpms is uninstalled
       merge pyxalarm to sysSentry rpm

* Tue Dec 9 2025 shixuantong <shixuantong1@h-partners.com> - 1.0.3-20
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix potential use-after-free bugs in libxalarm

* Wed Dec 3 2025 shixuantong <shixuantong1@h-partners.com> - 1.0.3-19
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:Fix self-dependency issue in spec file

* Mon Nov 3 2025 hewanhan <hewanhan@h-partners.com> - 1.0.3-18
- Type:feature
- CVE:NA
- SUG:NA
- DESC:slow io plugin upgrade

* Tue Oct 21 2025 Qizhi Zhang <zhangqizhi3@h-partners.com> - 1.0.3-17
- Type:feature
- CVE:NA
- SUG:NA
- DESC:Fix the syssentry.spec file that was incorrectly filed out by soc_ring_sentry

* Thu Oct 16 2025 Qizhi Zhang <zhangqizhi3@h-partners.com> - 1.0.3-16
- Type:feature
- CVE:NA
- SUG:NA
- DESC:Add SOC Ring sentry function
       Add testcase tc_ring for SOC Ring sentry
       testcase tc_ring cleancode
       Fix issue cores with isolcpus set blacklist failed
       Fix issue inconsistent status and result after single inspection
       Use panic instead of coredump file
       Fix Security Scan Warning
       Fix two code review comments
       Add MulanV2 License statement

* Wed Sep 24 2025 hewanhan <hewanhan@h-partners.com> - 1.0.3-15
- Type:feature
- CVE:NA
- SUG:NA
- DESC:add bmc_block_io

* Mon Sep 22 2025 hewanhan <hewanhan@h-partners.com> - 1.0.3-14
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix alarm register permissions error
       fix ai_block_io SlidingWindow is_abnormal func error
       fix ai_block_io log format error
       fix collector sdd&hdd disk type error

* Thu Sep 18 2025 shixuantong <shixuantong1@h-partners.com> - 1.0.3-13
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix period task some bugs
       fix env for subprocess.Popen
       Use malloc to allocate memory as much as possible
       fix cpu_sentry result when found_fault_cores_number != isolated_cores_number
       fix cpu_alarm_fd and bmc_fd

* Fri Mar 14 2025 luckky <guodashun1@huawei.com> - 1.0.3-12
- Type:feature
- CVE:NA
- SUG:NA
- DESC: add sentry msg monitor & add oom event report

* Fri Mar 14 2025 shixuantong <shixuantong1@huawei.com> - 1.0.3-11
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:add log utils for c

* Thu Mar 13 2025 luckky <guodashun1@huawei.com> - 1.0.3-10
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC: fix an issue with printing error

* Wed Mar 12 2025 zhuofeng <zhuofeng2@huawei.com> - 1.0.3-9
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC: fix an issue with printing error

* Fri Feb 28 2025 caixiaomeng <caixiaomeng2@huawei.com> - 1.0.3-8
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC: add dfx for xalarmd to rebuild connection after communication disconnection

* Mon Feb 24 2025 zhuofeng <zhuofeng2@huawei.com> - 1.0.3-7
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC: fix the sentryCollector service can't be stopped for a long

* Sat Feb 22 2025 zhuofeng <zhuofeng2@huawei.com> - 1.0.3-6
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC: add new func for ebpf in the rq_driver stage

* Tue Feb 18 2025 caixiaomeng <caixiaomeng2@huawei.com> - 1.0.3-5
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC: fix xalarm log not print and add on iter problem

* Tue Feb 18 2025 caixiaomeng <caixiaomeng2@huawei.com> - 1.0.3-4
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC: add log for xalarmd and fix delete on iter problem

* Fri Feb 14 2025 jinsaihang <jinsaihang@h-partners.com> - 1.0.3-3
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC: fix some test cases

* Sat Feb 8 2025 caixiaomeng <caixiaomeng2@huawei.com> - 1.0.3-2
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC: add bidirectional communication for libxalarm

* Mon Jan 20 2025 zhuofeng <zhuofeng2@huawei.com> - 1.0.3-1
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:1.0.3 init