Changes of Revision 6
[-] | Changed | check_mk.changes |
x 1
2 ------------------------------------------------------------------- 3 +Sun Jan 7 13:33:04 UTC 2018 - FSchreiner@suse.com 4 + 5 +- xinetd is not really needed by check_mk-agent (e.g. if called by 6 + check_by_ssh), so xinetd should only be "Recommended" as xinetd 7 + might open new attack vectors for target systems in untrusted 8 + zones 9 + 10 +------------------------------------------------------------------- 11 +Tue Jan 2 18:13:38 UTC 2018 - suse-beta@cboltz.de 12 + 13 +- set_permissions /etc/permissions.d/check_mk in mk-Livestatus %post instead of 14 + using the no longer existing /etc/permissions.d/mk-Livestatus to 15 + ensure correct permissions of /var/spool/check_mk/ 16 + 17 +------------------------------------------------------------------- 18 +Tue Sep 26 15:55:09 UTC 2017 - lars@linux-schulserver.de 19 + 20 +- update to 1.2.8p26 21 + Core & Setup: 22 + * 5038 FIX: Datasource programs: Prevent zombie processes in case of timeouts... 23 + * 5204 FIX: Host rename: Fixed broken rename of hosts in rrdcached journal... 24 + * 5205 FIX: Host rename: Fixed broken renaming when new name uses dots... 25 + Checks & Agents: 26 + * 5078 FIX: lnx_distro: Detects version and name of Check_MK Appliance correctly 27 + * 5079 FIX: windows_tasks: Adapted man page; Some OK states were missing 28 + * 5083 FIX: oracle_locks: Do not discover if data is incomplete... 29 + * 5089 FIX: citrix_xenapp.ps1: Refactored; now uses powershell commands 30 + for Citrix environment instead of WMI objects which caused runtime errors 31 + * 5091 FIX: Perfometer: Allow zero as maximal value; Fixed unsupported 32 + operand type for /: 'float' and 'NoneType' 33 + * 5093 FIX: dell_poweredge_temp: Fixed device levels handling if they are empty 34 + * 5095 FIX: "Round trip average" graph: Added warn and crit lines 35 + * 5096 FIX: mk_oracle_crs: crs_stat command is deprecated since Oracle 36 + 11gR2; Now the plugin handles that correctly 37 + * 4804 FIX: brocade_fcport: Fix limiting discovered ports by operational 38 + and physical status... 39 + * 5110 FIX: appdynamics_memory: Fixed crashing if max. available for 40 + heap or non-heap memory is zero 41 + * 5113 FIX: cifsmounts: Fixed wrong reported error message if user has 42 + not right permissions on mount point 43 + * 5114 FIX: ps, ps.perf: Allow "/" in process name in manual checks 44 + * 5115 FIX: zfs_arc_cache: Fixed wrong detected lines from agent output 45 + if they contain no counters, eg. 'class = misc' 46 + * 5120 FIX: ps, ps.perf: Fixed regex range introduced with werk 5114 47 + which allows "/" in process name in manual checks 48 + * 5121 FIX: check_sql: Added error message if cx_Oracle module is not installed 49 + * 5014 FIX: df: Fixed error if dynamic levels should be set... 50 + * 5125 FIX: brocade_mlx_power: Fixed wrong index usage which led to 51 + undetected power supplies 52 + * 5278 FIX: check_mk_agent.linux: Fixed wrong detected sensors in 53 + state "State disasserted" 54 + * 5279 FIX: qnap_disks: Just discover slots that are not empty 55 + * 5281 FIX: apache_status: Fixed ignoring invalid lines 56 + * 5282 FIX: hpux_tunables: Fixed discovering kernel tunables on HPUX 11.23 57 + * 5016 FIX: hp_proliant_temp: Fixed crash if thresholds are set manually... 58 + Multisite: 59 + * 5208 SEC: Fix possibe information disclosure to unauthenticated users... 60 + 61 +------------------------------------------------------------------- 62 +Fri Jul 28 15:34:19 UTC 2017 - darin@darins.net 63 + 64 +- update to 1.2.8p25 65 + Checks & Agents: 66 + * 4823 FIX: netapp_api_cpu: Fixed crash if data for node is missing... 67 + * 4874 FIX: cisco_power: Improved discovery of power supplies... 68 + NOTE: Please refer to the migration notes! 69 + * 4824 FIX: f5bigip_conns: Fixed crash if Parameters are at 'No Levels'... 70 + * 4875 FIX: Fixed graph labeling and unit of active HTTP service 71 + * 4826 FIX: juniper_cpu_util: No crash anymore if information is not provided 72 + * 4876 FIX: mounts: Fixed wrong handling of NFS mounts on Linux which are detected as stale... 73 + * 4827 FIX: domino_info: Fixed crash if some information is missing 74 + * 4908 FIX: enterasys_powersupply: Fixed crash if empty output... 75 + * 4909 FIX: arris_cmts_cpu: Fixed crash if thresholds are set 76 + * 4879 FIX: akcp_sensor_humidity, akcp_exp_humidity: Fixed wrong order of level evaluation 77 + * 4880 FIX: wut_webtherm, wut_webtherm.humidity: Fixed missing device type and enabled performance data for humidity 78 + * 4881 FIX: multipath: Fixed service details: Number of paths were interpreted as expected paths 79 + * 4883 FIX: juniper_trpz_aps_sessions: Fixed performance data handling if running on cluster 80 + * 4884 FIX: oracle_logswitches: Fixed missing oracle.include 81 + * 4914 FIX: statgrab_mem: Plugin is now prioritized over solaris_mem if both is available... 82 + * 4915 FIX: solaris_mem: Unified graphs and Per-O-Meter with common memory checks... 83 + * 4887 FIX: cisco_wlc: Fixed crashing check plugin caused by IndexError 84 + * 4972 FIX: mk_inventory.aix: Use MK_VARDIR instead of MK_CONFDIR for the state file 85 + * 4980 FIX: mssql_counters.file_sizes: Added readable titles of related metrics... 86 + * 4981 FIX: fjdarye100_sum, fjdarye101_sum: Fixed precompiling error: No such file or directory: '/omd/sites/SITENAME/share/check_mk/checks/a' 87 + * 4982 FIX: zypper: Made check more robust against different SLES 12 service packs 88 + * 5029 FIX: Fix Windows agent crash with logwatch and '*' wildcard... 89 + 90 + Multisite: 91 + * 4902 SEC: Monitoring history views: Fixed possible XSS when displaying "plugin output"... 92 + 93 + HW/SW-Inventory: 94 + * 4878 FIX: lnx_distro: Fixed wrong detected distribution name, vendor and version... 95 + 96 +------------------------------------------------------------------- 97 +Mon Jul 3 11:31:24 UTC 2017 - lars@linux-schulserver.de 98 + 99 +- fix option calls for rrdtool during %%install: latest (1.6.0) 100 + rrdtool switched to optparse - as resuult, the complete option 101 + arguments must be used - this is funnily backwarts compatible 102 + 103 +------------------------------------------------------------------- 104 +Tue Jun 27 14:42:17 UTC 2017 - lars@linux-schulserver.de 105 + 106 +- update to 1.2.8p24 107 + Checks & Agents: 108 + * 4636 Added compatibility for Lenovo blades... 109 + * 4637 FIX: blade_blades: Fixed buggy state validation 110 + * 4788 FIX: openhardwaremonitor: New support of current hardware... 111 + * 4789 FIX: check_mk_agent.aix: Fixed computation of uptime... 112 + * 4772 FIX: cisco_wlc, cisco_wlc_clients: Added support for Cisco 1850 devices 113 + * 4790 FIX: Fixed scaling for the average in interface services of pnp4nagios graphs... 114 + * 4634 FIX: aix_if: Make check work with different ifconfig output format... 115 + * 4774 FIX: wmi_cpuload: Expanded missing information handling 116 + * 4635 FIX: raritan_emx_sensors.temp, raritan_px_sensors: Fix checks 117 + for Nagios core, add missing WATO rule to raritan_px_sensors 118 + * 4775 FIX: fortigate_sessions: Improved missing or invalid output handling 119 + * 4792 FIX: Fixed wrong unit in graph for tape utilization... 120 + * 4777 FIX: esx_vsphere_sensors: Fixed wrong interpretation of 121 + ESX sensor health state 'UNKNOWN' 122 + * 4793 FIX: chrony: Changed to raw IP address without dns name 123 + to avoid empty output... 124 + * 4794 FIX: check_mk_agent.solaris: Now considers top in /usr/bin/ and /usr/local/bin/ 125 + * 4778 FIX: lnx_quotas: Adapted plugin output if TABS are used in fstab 126 + * 4795 FIX: netstat: Fixed wrong output if LISTENING connections should be 127 + monitored on Ubuntu... 128 + * 4779 FIX: check_mk_agent.freebsd, check_mk_agent.solaris: Reduce agent 129 + output by excluding mirror devices 130 + * 4781 FIX: mk_oracle, mk_oracle.aix: Added support for Oracle 12.2 131 + * 4858 FIX: omd_apache data collection: fixed issues caused by missing 132 + newline at the end of statsfile(s)... 133 + * 4784 FIX: oracle_rman: wrong detection of level 1 backup... 134 + * 4785 FIX: oracle_locks: New SQL for check... 135 + * 4868 FIX: oracle_tablespace: Restrict data for check from primary... 136 + * 4871 FIX: if.include: Added missing interface types... 137 + * 4872 FIX: zfs_arc_cache: Fixed conversions of size, arc meta used, arc meta 138 + limit and arc meta max 139 + * 4654 FIX: oracle_recovery_area: Added missing metric info 140 + * 4655 FIX: fileinfo.groups: Added missing metric information 141 + * 4661 FIX: msexch_isstore, msexch_isclienttype: Split up check files. 142 + Second one needs its own check plugin file if using Nagios core... 143 + NOTE: Please refer to the migration notes! 144 + * 4736 FIX: ucs_bladecenter_if: Fixed crash if fabric interconnects are aggregated... 145 + * 8289 FIX: wagner_titanus_topsense.smoke: Adapted levels to be more user friendly... 146 + * 4739 FIX: hp_proliant_da_phydrv: Implemented new possible values 147 + * 4663 FIX: check_mailboxes: Removed useless report_age which causes 148 + TypeError: float() argument must be a string or a number 149 + * 4740 FIX: mysql: Fixed crash if instance is not available anymore 150 + * 4741 FIX: dell_powerconnect_temp: Fixed missing reference for computing the temperature 151 + * 4631 FIX: cisco_ace_rserver: Fix broken IP address parsing... 152 + NOTE: Please refer to the migration notes! 153 + * 4632 FIX: fsc_subsystems: No longer crash when statuscode is missing 154 + * 4633 FIX: jolokia_metrics.uptime: No longer crash when agent info is incomplete 155 + * 4742 FIX: wmi_cpuload: Added required tables to prevent crash... 156 + * 4616 FIX: mk_postgres/mk_db2.linux: Fixed quotes which lead into wrong interpretation... 157 + * 4471 FIX: Windows Agent Process Monitoring: ps section is no longer completely 158 + suppressed when only parts of the data is missing... 159 + * 4622 FIX: emc_isilon_diskstatus: Now treats L3 caching devices as OK 160 + * 8286 FIX: brocade_mlx_power: Added new standard OID for snChasPwrSupply2Table 161 + to receive all power supplies in stacked devices 162 + * 4638 FIX: esx_vsphere_hostsystem.multipath: Fixed compatibility to older versions... 163 + * 4627 FIX: apc_symmetra: Fix bogus 100000000 A battery current 164 + occurring on some devices... 165 + * 4593 FIX: wmi_cpuload: Fixed missing WATO group 166 + * 4640 FIX: heartbeat_crm: Fixed crash if output contains capital letters 167 + * 4647 FIX: websphere_mq_queues: Fixed 'list index out of range' error... 168 + * 4648 FIX: mk_oracle: Fixed logswitches SQL statement for ORACLE RAC case... 169 + * 4032 smart agent plugin: disable megacli logging output... 170 + * 4194 FIX: esx_vsphere_hostsystem.multipath: Fixed grouping of paths... 171 + NOTE: Please refer to the migration notes! 172 + * 4544 FIX: multipath: Fixed missing infos in output if a failure occurs... 173 + * 4549 FIX: citrix_licenses: Fixed always ok state even if all licenses are used... 174 + * 4550 FIX: smart: the services do not crash anymore if a threshold is not provided 175 + * 8629 FIX: win_printers: Fix broken default parameters 176 + * 4551 FIX: zfs_arc_cache: Fixed metrics in html5 graphing 177 + * 4530 FIX: lnx_distro: Fixed missing distribution if eg. Oracle and 178 + Redhat release files are available 179 + * 4531 FIX: oracle_tablespaces: Added missing info for better analysis 180 + * 4533 FIX: cisco_vpn_tunnel: Fixed handling if tunnel is not yet 181 + open and phase two values are not set 182 + * 4552 FIX: win_dhcp_pools: Fixed conversion of old type of rules 183 + (1.2.6) to new type (1.2.8)... 184 + * 4576 FIX: if64, if64adm: Fixed interface speed handling, if 185 + highspeed data is not available or zero 186 + * 4577 FIX: websphere_mq_channels: Fixed missing channel states 187 + * 4581 FIX: postgres_stats: Fixed confusion of VACUUM and ANALYSE timestamp in agent plugin 188 + * 4583 FIX: netextreme_psu: Fixed empty data handling 189 + * 4586 FIX: juniper_trpz_aps_sessions: Fixed crashes if access point is 190 + not reachable or no values could be calculated 191 + * 4587 FIX: juniper_trpz_aps, juniper_trpz_aps_sessions: Fixed 192 + missing OID for WLC800R series 193 + * 4588 FIX: cisco_wlc, cisco_wlc_clients: Fixed missing OID for 194 + Cisco WLC-8510 devices 195 + 196 + WATO: 197 + * 4680 FIX: Sync of local hierarchy (MKPs) preserves symlinks now... 198 + * 4558 FIX: Set correct file permissions for WATO snapshots 199 + 200 + BI: 201 |
||
[-] | Changed | check_mk.spec ^ |
201 1
2 # 3 # spec file for package check_mk 4 # 5 -# Copyright (c) 2013-2014 SUSE LINUX Products GmbH, Nuernberg, Germany. 6 +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. 7 # 8 # All modifications and additions to the file contributed by third parties 9 # remain the property of their copyright owners, unless otherwise agreed 10
11 # 12 13 14 +%define nnmmsg logger -t %{name}/rpm 15 +%define __debug_install_post %{nil} 16 Name: check_mk 17 -Version: 1.2.4p5 18 +Version: 1.2.8p26 19 Release: 0 20 Summary: Nagios-plugin for retrieving data 21 License: GPL-2.0+ 22 Group: System/Monitoring 23 -Url: http://mathias-kettner.de/checkmk_index.html 24 -Source0: http://mathias-kettner.de/download/%{name}-%{version}.tar.gz 25 +Url: https://mathias-kettner.de/checkmk_index.html 26 +Source0: https://mathias-kettner.de/download/%{name}-%{version}.tar.gz 27 Source1: check_mk-rpmlintrc 28 Source2: check_mk-logwatch.cfg 29 Source3: check_mk-README.SUSE 30
31 Source6: permissions.mkeventd 32 Source7: check_mk-mysql.cfg 33 Source8: check_mk-livestatus-README.SUSE 34 -#Source8: permissions.mk-livestatus 35 Source9: check_mk.service 36 Source10: check_mk.socket 37 Source11: check_mk-service.fw2 38 Source12: check_mk-systemd-socket-activation.README.SUSE 39 +# Taken from 1.2.4p5 40 +Source13: waitmax.c 41 Patch1: setup.sh.patch 42 +BuildRequires: dos2unix 43 BuildRequires: gcc-c++ 44 +%if %{?suse_version} <= 1200 45 +BuildRequires: gcc48 gcc48-c++ 46 +#!BuildIgnore: libgcc43 libgomp43 libgcc_s1-32bit 47 +#BuildRequires: libgomp48 48 +#BuildRequires: libgcc48 49 +%endif 50 BuildRequires: nagios-rpm-macros 51 +# Avoid unneeded dependencies generated because of the checks 52 +AutoReqProv: off 53 +# Require needed stuff manually instead 54 +Requires: bash 55 +Requires: expect 56 +Requires: python 57 +Requires: php 58 +Requires: mk-livestatus 59 +Requires(pre): /bin/logger 60 +Requires(pre): coreutils 61 +Requires(pre): permissions 62 +Requires(pre): sed 63 +Requires(pre): xinetd 64 +BuildRoot: %{_tmppath}/%{name}-%{version}-build 65 %if 0%{?suse_version} 66 BuildRequires: apache2-devel 67 # unzip is needed for /usr/lib/rpm/brp-check-bytecode-version 68 -BuildRequires: unzip 69 +BuildRequires: unzip 70 +%if 0%{?suse_version} != 1110 && 0%{?suse_version} != 1315 && 0%{?suse_version} < 1330 71 # diet is needed for eventd 72 BuildRequires: dietlibc 73 -PreReq: permissions 74 +%endif 75 %endif 76 %if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version} 77 BuildRequires: httpd-devel 78
79 %if 0%{?mandriva_version} 80 BuildRequires: apache-devel 81 %endif 82 -Requires(pre): /bin/logger 83 -Requires(pre): coreutils 84 -Requires(pre): sed 85 -Requires(pre): xinetd 86 -%if 0%{?suse_version} 87 -Requires(pre): permissions 88 -%endif 89 -Requires: mk-livestatus 90 %if 0%{?suse_version} > 1030 91 BuildRequires: fdupes 92 %endif 93
94 BuildRequires: unzip 95 %endif 96 # systemd 97 -%if 0%{?suse_version} >= 1210 || 0%{?rhel} >= 7 98 -BuildRequires: systemd 99 +%if 0%{?suse_version} >= 1210 100 +BuildRequires: systemd 101 %{?systemd_requires} 102 %endif 103 -BuildRoot: %{_tmppath}/%{name}-%{version}-build 104 -AutoReqProv: no 105 -%define nnmmsg logger -t %{name}/rpm 106 -%define __debug_install_post %{nil} 107 108 %description 109 Check_mk adopts a new a approach for collecting data 110
111 %package agent 112 Summary: Agent for check_mk 113 Group: System/Monitoring 114 +Recommends: xinetd 115 %if 0%{?suse_version} 116 Requires(pre): %insserv_prereq 117 %endif 118 -Requires(pre): xinetd 119 120 %description agent 121 Check_mk adopts a new a approach for collecting data 122
123 * hosts. 124 125 %package caching-agent 126 +Summary: Caching Linux-Agent for check_mk 127 Group: System/Monitoring 128 +Requires: check_mk-agent 129 Requires: xinetd 130 -Summary: Caching Linux-Agent for check_mk 131 AutoReq: off 132 AutoProv: off 133 -Requires: check_mk-agent 134 135 %description caching-agent 136 This package contains the agent for check_mk with an xinetd 137
138 wrapper. Use it when doing fully redundant monitoring, where 139 an agent is regularily polled by more than one monitoring 140 server. 141 - 142 + 143 %package agent-logwatch 144 Summary: Logwatch-Plugin for check_mk agent 145 Group: System/Monitoring 146
147 Summary: MySQL-Plugin for check_mk agent 148 Group: System/Monitoring 149 Requires: check_mk-agent = %{version} 150 -%if 0%{?suse_version} 151 Requires: mysql-client 152 -%endif 153 -%if 0%{?centos_version} || 0%{?rhel} || 0%{?rhel_version} || 0%{?sl_version} || 0%{?fedora_version} 154 -Requires: mysql 155 -%endif 156 %if 0%{?suse_version} > 1130 157 BuildArch: noarch 158 %endif 159
160 %description agent-mysql 161 The MySQL plugin for the check_mk agent allows you to monitor 162 several aspects of MySQL databases. You need to adapt the 163 -config /etc/check_mk/mysql.cfg to your needs. 164 +config %{_sysconfdir}/check_mk/mysql.cfg to your needs. 165 166 %package agent-oracle 167 Summary: Oracle-Plugin for check_mk agent 168
169 %description agent-oracle 170 The ORACLE plugin for the check_mk agent allows you to monitor 171 several aspects of ORACLE databases. You need to adapt the 172 -script /etc/check_mk/sqlplus.sh to your needs. 173 +script %{_sysconfdir}/check_mk/sqlplus.sh to your needs. 174 175 %package agent-smart 176 Summary: SMART-Plugin for check_mk agent 177
178 several SMART values of harddisks. 179 180 %package agent-jolokia 181 -Summary: Jolokia-Plugin for check_mk agent 182 -Group: System/Monitoring 183 +Summary: Jolokia-Plugin for check_mk agent 184 +Group: System/Monitoring 185 Requires: check_mk-agent = %{version} 186 %if 0%{?suse_version} > 1130 187 BuildArch: noarch 188
189 %description agent-jolokia 190 The Jolokia plugin for the check_mk agent allows you to monitor 191 several aspect of Java application servers. You need to adapt the 192 -config /etc/check_mk/jolokia.cfg to your needs. 193 +config %{_sysconfdir}/check_mk/jolokia.cfg to your needs. 194 195 %package agent-apache_status 196 -Summary: Apache Status Plugin for check_mk agent 197 -Group: System/Monitoring 198 +Summary: Apache Status Plugin for check_mk agent 199 +Group: System/Monitoring 200 Requires: check_mk-agent = %{version} 201 |
||
Added | check_mk-1.2.8p26.tar.gz ^ | |
[+] | Changed | check_mk-rpmlintrc ^ |
@@ -1,15 +1,33 @@ # ignore some small duplicate files in the webroot and avoid to # add FollowSymlinks in the apache config instead -addFilter("files-duplicate.*/usr/share/check_mk/web/htdocs/.*"); +#addFilter("files-duplicate.*/usr/share/check_mk/web/htdocs/.*"); + # the mentioned README files are hints on how to check different Operating Systems addFilter("non-linux-readme.*/usr/share/doc/packages/check_mk/agents/README.*"); + # the mentioned files are for M$ based computers, so ignore the # warning in this case +addFilter("wrong-script-end-of-line-encoding.*/usr/share/doc/packages/check_mk/treasures/msexchange/win.*"); +addFilter("wrong-file-end-of-line-encoding.*/usr/share/doc/packages/check_mk/treasures/windows_msi/build_msi.bat"); +addFilter("wrong-file-end-of-line-encoding.*/usr/share/doc/packages/check_mk/treasures/msexchange/README"); +addFilter("wrong-file-end-of-line-encoding.*/usr/share/doc/packages/check_mk/agents/README.OpenVMS"); addFilter("wrong-file-end-of-line-encoding.*/usr/share/doc/packages/check_mk/windows/nslookup_local_check_example/nslookup.vbs"); addFilter("wrong-file-end-of-line-encoding.*/usr/share/doc/packages/check_mk/windows/counters.ini"); -addFilter("wrong-file-end-of-line-encoding.*/usr/share/doc/packages/check_mk/windows/nslookup_local_check_example/.*bat"); -addFilter("script-without-shebang.*/usr/share/check_mk/agents/windows/endless.bat"); -addFilter("wrong-script-end-of-line-encoding.*/usr/share/check_mk/agents/windows/endless.bat"); -# as check_mk is currently not scheduled for direct inclusion into openSUSE, just ignore the warning +addFilter("wrong-file-end-of-line-encoding.*/usr/share/doc/packages/check_mk/windows/nslookup_local_check_example/nslookup_forward.bat"); +addFilter("wrong-file-end-of-line-encoding.*/usr/share/doc/packages/check_mk/windows/nslookup_local_check_example/nslookup_reverse.bat"); + +# check_mk knows how to "execute" those special files in that directories - no need to execute them manually +# so skip the warning here by intention and add a bit more security +addFilter("non-executable-script.*/usr/share/check_mk/notifications/.*"); +addFilter("non-executable-script.*/usr/share/check_mk/inventory/.*"); + +# As check_mk is currently not scheduled for direct inclusion into openSUSE, just ignore the warning setBadness("permissions-unauthorized-file", 100); addFilter("permissions-unauthorized-file.*/etc/permissions.d/mk-livestatus"); + +# +addFilter("devel-file-in-non-devel-package.*/usr/share/check_mk/agents/windows/*"); +addFilter("devel-file-in-non-devel-package.*/usr/share/check_mk/agents/z_os/waitmax.c"); + +# +addFilter("arch-dependent-file-in-usr-share.*/usr/share/doc/packages/check_mk/treasures/modbus/agent_modbus"); | ||
[+] | Changed | permissions.check_mk ^ |
@@ -12,9 +12,12 @@ # /var/lib/check_mk/autochecks icinga:icingacmd 0755 # /var/lib/check_mk/cache icinga:icingacmd 0755 # /var/lib/check_mk/counters icinga:icingacmd 0755 +# /var/lib/check_mk/inventory icinga:icingacmd 0755 +# /var/lib/check_mk/log icinga:icingacmd 0755 # /var/lib/check_mk/packages icinga:icingacmd 0755 # /var/lib/check_mk/precompiled icinga:icingacmd 0755 # /var/lib/check_mk/snmpwalks icinga:icingacmd 0755 +# /var/log/check_mk icinga:icingacmd 0755 # /var/spool/check_mk icinga:icingacmd 2755 # /var/spool/check_mk nagios:nagcmd 2755 # /etc/nagios/htpasswd.users nagios:nagcmd 0660 | ||
[+] | Added | waitmax.c ^ |
@@ -0,0 +1,157 @@ +// +------------------------------------------------------------------+ +// | ____ _ _ __ __ _ __ | +// | / ___| |__ ___ ___| | __ | \/ | |/ / | +// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +// | | |___| | | | __/ (__| < | | | | . \ | +// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +// | | +// | Copyright Mathias Kettner 2013 mk@mathias-kettner.de | +// +------------------------------------------------------------------+ +// +// This file is part of Check_MK. +// The official homepage is at http://mathias-kettner.de/check_mk. +// +// check_mk is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation in version 2. check_mk is distributed +// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +// PARTICULAR PURPOSE. See the GNU General Public License for more de- +// ails. You should have received a copy of the GNU General Public +// License along with GNU Make; see the file COPYING. If not, write +// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA. + +#include <stdio.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <sys/errno.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <signal.h> +#include <getopt.h> + +/* macros for using write(2) instead of fprintf(stderr, ) */ +#define out(text) write(2, text, strlen(text)); + +int g_pid; +int g_timeout = 0; +int g_signum = 15; + +struct option long_options[] = { + { "version" , no_argument, 0, 'V' }, + { "help" , no_argument, 0, 'h' }, + { "signal" , required_argument, 0, 's' }, + { 0, 0, 0, 0 } }; + +void version() +{ + out("waitmax version 1.1\n" + "Copyright Mathias Kettner 2008\n" + "This is free software; see the source for copying conditions. There is NO\n" + "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); + exit(0); +} + + +void usage() +{ + out("Usage: waitmax [-s SIGNUM] MAXTIME PROGRAM [ARGS...]\n" + "\n" + "Execute PROGRAM as a subprocess. If PROGRAM does not exit before MAXTIME\n" + "seconds, it will be killed with SIGTERM or an alternative signal.\n" + "\n" + " -s, --signal SIGNUM kill with SIGNUM on timeout\n" + " -h, --help this help\n" + " -V, --version show version an exit\n\n"); + exit(1); +} + + +void signalhandler(int signum) +{ + if (0 == kill(g_pid, g_signum)) + g_timeout = 1; +} + + +int main(int argc, char **argv) +{ + int indexptr=0; + int ret; + setenv("POSIXLY_CORRECT", "true", 0); + while (0 <= (ret = getopt_long(argc, argv, "Vhs:", long_options, &indexptr))) { + switch (ret) + { + case 'V': + version(); + + case 'h': + usage(); + + case 's': + g_signum = strtoul(optarg, 0, 10); + if (g_signum < 1 || g_signum > 32) { + out("Signalnumber must be between 1 and 32.\n"); + exit(1); + } + break; + + default: + usage(argv[0]); + exit(1); + break; + } + } + + if (optind + 1 >= argc) usage(); + + int maxtime = atoi(argv[optind]); + if (maxtime <= 0) usage(); + + g_pid = fork(); + if (g_pid == 0) { + signal(SIGALRM, signalhandler); + execvp(argv[optind + 1], argv + optind + 1); + out("Cannot execute "); + out(argv[optind + 1]); + out(": "); + out(strerror(errno)); + out("\n"); + exit(253); + } + + signal(SIGALRM, signalhandler); + alarm(maxtime); + int status; + while (1) { + int pid = waitpid(g_pid, &status, 0); + if (pid <= 0) { + if (errno == EINTR) continue; // interuppted by alarm + else + out("Strange: waitpid() fails: "); + out(strerror(errno)); + out("\n"); + exit(1); + } + else break; + } + + if (WIFEXITED(status)) { + int exitcode = WEXITSTATUS(status); + return exitcode; + } + else if (WIFSIGNALED(status)) { + int signum = WTERMSIG(status); + if (g_timeout) + return 255; + else + return 128 + signum; + } + else { + out("Strange: program did neither exit nor was signalled.\n"); + return 254; + } +} |