Skip to content

Commit d878b6b

Browse files
author
Till Brehm
committed
Merge branch 'master' into 'master'
Master CentOS / RHEL monitor_ system_update & distver support See merge request !485
2 parents 736f9ef + 2d6162f commit d878b6b

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

server/lib/classes/cron.d/100-monitor_system_update.inc.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,18 @@ public function onRunJob() {
159159
* Fetch the output
160160
*/
161161
$data['output'] = shell_exec('zypper lu');
162+
} else if (file_exists('/etc/redhat-release')) {
163+
164+
if(shell_exec("yum list updates | awk 'p; /Updated Packages/ {p=1}'") == '') {
165+
// There is nothing to update
166+
$state = 'ok';
167+
}
168+
else {
169+
$state = 'info';
170+
}
171+
// Fetch the output
172+
$yumData = shell_exec('yum check-update');
173+
$data['output'] = $yumData;
162174
} else {
163175
/*
164176
* It is not Debian/Ubuntu, so there is no data and no state

server/lib/classes/monitor_tools.inc.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,23 +265,23 @@ function get_distname() {
265265
$distbaseid = 'fedora';
266266
} elseif(stristr($content, 'CentOS release 5')) {
267267
$distname = 'CentOS';
268-
$distver = 'Unknown';
268+
$distver = '5';
269269
$distid = 'centos53';
270270
$distbaseid = 'fedora';
271271
} elseif(stristr($content, 'CentOS Linux release 6')) {
272272
$distname = 'CentOS';
273-
$distver = 'Unknown';
273+
$distver = '6';
274274
$distid = 'centos53';
275275
$distbaseid = 'fedora';
276276
} elseif(stristr($content, 'CentOS Linux release 7.2')) {
277277
$distname = 'CentOS';
278-
$distver = 'Unknown';
278+
$distver = '7.2';
279279
$distid = 'centos70';
280280
$distconfid = 'centos72';
281281
$distbaseid = 'fedora';
282282
} elseif(stristr($content, 'CentOS Linux release 7')) {
283283
$distname = 'CentOS';
284-
$distver = 'Unknown';
284+
$distver = '7';
285285
$distid = 'centos70';
286286
$distbaseid = 'fedora';
287287
} else {

0 commit comments

Comments
 (0)