Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Zvonimir
ISPConfig 3
Commits
220bb93b
Commit
220bb93b
authored
Apr 30, 2010
by
vogelor
Browse files
The Monitor now also shows the distribution and the version
parent
ef56c9a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
install/lib/install.lib.php
View file @
220bb93b
...
...
@@ -56,6 +56,10 @@ error_reporting(E_ALL|E_STRICT);
$FILE
=
realpath
(
'../install.php'
);
//** Get distribution identifier
//** IMPORTANT!
// This is the same code as in /server/mods-available/monitor_core_module.inc.php
// So if you change it here, you also have to change it in
// /server/mods-available/monitor_core_module.inc.php!
function
get_distname
()
{
$distname
=
''
;
...
...
interface/web/monitor/show_sys_state.php
View file @
220bb93b
<?php
/*
Copyright (c) 2007-200
8
, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
Copyright (c) 2007-20
1
0, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
...
...
@@ -135,23 +135,31 @@ function _getServerState($serverId, $serverName, $showAll)
* get all monitoring-data from the server als process then
* (count them and set the server-state)
*/
$records
=
$app
->
db
->
queryAllRecords
(
"SELECT DISTINCT type FROM monitor_data WHERE server_id = "
.
$serverId
);
foreach
(
$records
as
$record
){
_processDbState
(
$record
[
'type'
],
$serverId
,
&
$serverState
,
&
$messages
);
$records
=
$app
->
db
->
queryAllRecords
(
"SELECT DISTINCT type, data FROM monitor_data WHERE server_id = "
.
$serverId
);
$osData
=
null
;
foreach
(
$records
as
$record
){
/* get the state from the db-data */
_processDbState
(
$record
[
'type'
],
$serverId
,
&
$serverState
,
&
$messages
);
/* if we have the os-info, get it */
if
(
$record
[
'type'
]
==
'os_info'
)
$osData
=
unserialize
(
$record
[
'data'
]);
}
$res
.
=
'<div class="systemmonitor-state state-'
.
$serverState
.
'">'
;
$res
.
=
'<div class="systemmonitor-device device-server">'
;
$res
.
=
'<div class="systemmonitor-content icons32 ico-'
.
$serverState
.
'">'
;
$res
.
=
$app
->
lng
(
"monitor_serverstate_server_txt"
)
.
': '
.
$serverName
.
'<br />'
;
$res
.
=
$app
->
lng
(
"monitor_serverstate_state_txt"
)
.
': '
.
$serverState
.
'<br />'
;
$res
.
=
$app
->
lng
(
"monitor_serverstate_server_txt"
)
.
': '
.
$serverName
;
if
(
$osData
!=
null
){
$res
.
=
' ('
.
$osData
[
'name'
]
.
' '
.
$osData
[
'version'
]
.
')'
;
}
$res
.
=
'<br />'
;
$res
.
=
$app
->
lng
(
"monitor_serverstate_state_txt"
)
.
': '
.
$serverState
.
' ('
;
// $res .= sizeof($messages[$app->lng("monitor_serverstate_listok_txt")]) . ' ok | ';
$res
.
=
sizeof
(
$messages
[
$app
->
lng
(
"monitor_serverstate_listunknown_txt"
)])
.
' '
.
$app
->
lng
(
"monitor_serverstate_unknown_txt"
)
.
'
|
'
;
$res
.
=
sizeof
(
$messages
[
$app
->
lng
(
"monitor_serverstate_listinfo_txt"
)])
.
' '
.
$app
->
lng
(
"monitor_serverstate_info_txt"
)
.
'
|
'
;
$res
.
=
sizeof
(
$messages
[
$app
->
lng
(
"monitor_serverstate_listwarning_txt"
)])
.
' '
.
$app
->
lng
(
"monitor_serverstate_warning_txt"
)
.
'
|
'
;
$res
.
=
sizeof
(
$messages
[
$app
->
lng
(
"monitor_serverstate_listcritical_txt"
)])
.
' '
.
$app
->
lng
(
"monitor_serverstate_critical_txt"
)
.
'
|
'
;
$res
.
=
sizeof
(
$messages
[
$app
->
lng
(
"monitor_serverstate_listerror_txt"
)])
.
' '
.
$app
->
lng
(
"monitor_serverstate_error_txt"
)
.
'
<br />
'
;
$res
.
=
'<br />'
;
$res
.
=
sizeof
(
$messages
[
$app
->
lng
(
"monitor_serverstate_listunknown_txt"
)])
.
' '
.
$app
->
lng
(
"monitor_serverstate_unknown_txt"
)
.
'
,
'
;
$res
.
=
sizeof
(
$messages
[
$app
->
lng
(
"monitor_serverstate_listinfo_txt"
)])
.
' '
.
$app
->
lng
(
"monitor_serverstate_info_txt"
)
.
'
,
'
;
$res
.
=
sizeof
(
$messages
[
$app
->
lng
(
"monitor_serverstate_listwarning_txt"
)])
.
' '
.
$app
->
lng
(
"monitor_serverstate_warning_txt"
)
.
'
,
'
;
$res
.
=
sizeof
(
$messages
[
$app
->
lng
(
"monitor_serverstate_listcritical_txt"
)])
.
' '
.
$app
->
lng
(
"monitor_serverstate_critical_txt"
)
.
'
,
'
;
$res
.
=
sizeof
(
$messages
[
$app
->
lng
(
"monitor_serverstate_listerror_txt"
)])
.
' '
.
$app
->
lng
(
"monitor_serverstate_error_txt"
)
.
''
;
$res
.
=
'
)
<br />'
;
if
(
$showAll
){
/*
...
...
server/mods-available/monitor_core_module.inc.php
View file @
220bb93b
<?php
/*
Copyright (c) 2007-200
8
, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
Copyright (c) 2007-20
1
0, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
...
...
@@ -28,37 +28,36 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
class
monitor_core_module
{
/* TODO: this should be a config - var instead of a "constant" */
var
$interval
=
5
;
// do the monitoring every 5 minutes
var
$interval
=
5
;
// do the monitoring every 5 minutes
var
$module_name
=
'monitor_core_module'
;
var
$class_name
=
'monitor_core_module'
;
/* No actions at this time. maybe later... */
var
$actions_available
=
array
();
var
$module_name
=
'monitor_core_module'
;
var
$class_name
=
'monitor_core_module'
;
/* No actions at this time. maybe later... */
var
$actions_available
=
array
();
//* This function is called during ispconfig installation to determine
//* This function is called during ispconfig installation to determine
// if a symlink shall be created for this plugin.
function
onInstall
()
{
global
$conf
;
return
true
;
}
/*
This function is called when the module is loaded
*/
function
onLoad
()
{
global
$app
;
*/
function
onLoad
()
{
global
$app
;
/*
/*
Annonce the actions that where provided by this module, so plugins
can register on them.
*/
/* none at them moment */
//$app->plugins->announceEvents($this->module_name,$this->actions_available);
*/
/* none at them moment */
//$app->plugins->announceEvents($this->module_name,$this->actions_available);
/*
/*
As we want to get notified of any changes on several database tables,
we register for them.
...
...
@@ -66,95 +65,208 @@ class monitor_core_module {
to be executed when a record for the table "dbtable" is
processed in the sys_datalog. "classname" is the name of the
class that contains the function functionname.
*/
/* none at them moment */
//$app->modules->registerTableHook('mail_access','mail_module','process');
*/
/* none at them moment */
//$app->modules->registerTableHook('mail_access','mail_module','process');
/*
/*
Do the monitor every n minutes and write the result in the db
*/
$min
=
date
(
'i'
);
if
((
$min
%
$this
->
interval
)
==
0
)
{
$this
->
doMonitor
();
}
}
/*
*/
$min
=
date
(
'i'
);
if
((
$min
%
$this
->
interval
)
==
0
)
{
$this
->
doMonitor
();
}
}
/*
This function is called when a change in one of the registered tables is detected.
The function then raises the events for the plugins.
*/
function
process
(
$tablename
,
$action
,
$data
)
{
// global $app;
//
// switch ($tablename) {
// case 'mail_access':
// if($action == 'i') $app->plugins->raiseEvent('mail_access_insert',$data);
// if($action == 'u') $app->plugins->raiseEvent('mail_access_update',$data);
// if($action == 'd') $app->plugins->raiseEvent('mail_access_delete',$data);
// break;
// } // end switch
}
// end function
/*
*/
function
process
(
$tablename
,
$action
,
$data
)
{
// global $app;
//
// switch ($tablename) {
// case 'mail_access':
// if($action == 'i') $app->plugins->raiseEvent('mail_access_insert',$data);
// if($action == 'u') $app->plugins->raiseEvent('mail_access_update',$data);
// if($action == 'd') $app->plugins->raiseEvent('mail_access_delete',$data);
// break;
// } // end switch
}
// end function
//** Get distribution identifier
//** IMPORTANT!
// This is the same code as in /install/install.php
// So if you change it here, you also have to change it in /install/install.php!
// Please do not forget to remove the swriteln(); - lines here at this file
function
get_distname
()
{
$distname
=
''
;
$distver
=
''
;
$distid
=
''
;
$distbaseid
=
''
;
//** Debian or Ubuntu
if
(
file_exists
(
'/etc/debian_version'
))
{
if
(
trim
(
file_get_contents
(
'/etc/debian_version'
))
==
'4.0'
)
{
$distname
=
'Debian'
;
$distver
=
'4.0'
;
$distid
=
'debian40'
;
$distbaseid
=
'debian'
;
}
elseif
(
strstr
(
trim
(
file_get_contents
(
'/etc/debian_version'
)),
'5.0'
))
{
$distname
=
'Debian'
;
$distver
=
'Lenny'
;
$distid
=
'debian40'
;
$distbaseid
=
'debian'
;
}
elseif
(
strstr
(
trim
(
file_get_contents
(
'/etc/debian_version'
)),
'6.0'
)
||
trim
(
file_get_contents
(
'/etc/debian_version'
))
==
'squeeze/sid'
)
{
$distname
=
'Debian'
;
$distver
=
'Squeeze/Sid'
;
$distid
=
'debian40'
;
$distbaseid
=
'debian'
;
}
else
{
$distname
=
'Debian'
;
$distver
=
'Unknown'
;
$distid
=
'debian40'
;
$distbaseid
=
'debian'
;
}
}
//** OpenSuSE
elseif
(
file_exists
(
"/etc/SuSE-release"
))
{
if
(
stristr
(
file_get_contents
(
'/etc/SuSE-release'
),
'11.0'
))
{
$distname
=
'openSUSE'
;
$distver
=
'11.0'
;
$distid
=
'opensuse110'
;
$distbaseid
=
'opensuse'
;
}
elseif
(
stristr
(
file_get_contents
(
'/etc/SuSE-release'
),
'11.1'
))
{
$distname
=
'openSUSE'
;
$distver
=
'11.1'
;
$distid
=
'opensuse110'
;
$distbaseid
=
'opensuse'
;
}
elseif
(
stristr
(
file_get_contents
(
'/etc/SuSE-release'
),
'11.2'
))
{
$distname
=
'openSUSE'
;
$distver
=
'11.1'
;
$distid
=
'opensuse110'
;
$distbaseid
=
'opensuse'
;
}
else
{
$distname
=
'openSUSE'
;
$distver
=
'Unknown'
;
$distid
=
'opensuse110'
;
$distbaseid
=
'opensuse'
;
}
}
//** Redhat
elseif
(
file_exists
(
"/etc/redhat-release"
))
{
$content
=
file_get_contents
(
'/etc/redhat-release'
);
if
(
stristr
(
$content
,
'Fedora release 9 (Sulphur)'
))
{
$distname
=
'Fedora'
;
$distver
=
'9'
;
$distid
=
'fedora9'
;
$distbaseid
=
'fedora'
;
}
elseif
(
stristr
(
$content
,
'Fedora release 10 (Cambridge)'
))
{
$distname
=
'Fedora'
;
$distver
=
'10'
;
$distid
=
'fedora9'
;
$distbaseid
=
'fedora'
;
}
elseif
(
stristr
(
$content
,
'Fedora release 10'
))
{
$distname
=
'Fedora'
;
$distver
=
'11'
;
$distid
=
'fedora9'
;
$distbaseid
=
'fedora'
;
}
elseif
(
stristr
(
$content
,
'CentOS release 5.2 (Final)'
))
{
$distname
=
'CentOS'
;
$distver
=
'5.2'
;
$distid
=
'centos52'
;
$distbaseid
=
'fedora'
;
}
elseif
(
stristr
(
$content
,
'CentOS release 5.3 (Final)'
))
{
$distname
=
'CentOS'
;
$distver
=
'5.3'
;
$distid
=
'centos53'
;
$distbaseid
=
'fedora'
;
}
else
{
$distname
=
'Redhat'
;
$distver
=
'Unknown'
;
$distid
=
'fedora9'
;
$distbaseid
=
'fedora'
;
}
}
//** Gentoo
elseif
(
file_exists
(
"/etc/gentoo-release"
))
{
$content
=
file_get_contents
(
'/etc/gentoo-release'
);
preg_match_all
(
'/([0-9]{1,2})/'
,
$content
,
$version
);
$distname
=
'Gentoo'
;
$distver
=
$version
[
0
][
0
]
.
$version
[
0
][
1
];
$distid
=
'gentoo'
;
$distbaseid
=
'gentoo'
;
}
else
{
die
(
'unrecognized linux distribution'
);
}
return
array
(
'name'
=>
$distname
,
'version'
=>
$distver
,
'id'
=>
$distid
,
'baseid'
=>
$distbaseid
);
}
/*
This method is called every n minutes, when the module ist loaded.
The method then does a system-monitoring
*/
// TODO: what monitoring is done should be a config-var
function
doMonitor
()
{
/* Calls the single Monitoring steps */
$this
->
monitor
Serv
er
();
$this
->
monitorDiskUsage
();
$this
->
monitorMemUsage
();
$this
->
monitorCpu
();
$this
->
monitorServices
();
$this
->
monitorMailLog
();
$this
->
monitorMailWarnLog
();
$this
->
monitorMailErrLog
();
$this
->
monitorMessagesLog
();
$this
->
monitorISPCCronLog
();
$this
->
monitorFreshClamLog
();
$this
->
monitorClamAvLog
();
$this
->
monitorIspConfigLog
();
$this
->
monitorSystemUpdate
();
$this
->
monitorMailQueue
();
$this
->
monitorRaid
();
$this
->
monitorRkHunter
();
*/
// TODO: what monitoring is done should be a config-var
function
doMonitor
()
{
/* Calls the single Monitoring steps */
$this
->
monitorServer
();
$this
->
monitor
OSV
er
();
$this
->
monitorDiskUsage
();
$this
->
monitorMemUsage
();
$this
->
monitorCpu
();
$this
->
monitorServices
();
$this
->
monitorMailLog
();
$this
->
monitorMailWarnLog
();
$this
->
monitorMailErrLog
();
$this
->
monitorMessagesLog
();
$this
->
monitorISPCCronLog
();
$this
->
monitorFreshClamLog
();
$this
->
monitorClamAvLog
();
$this
->
monitorIspConfigLog
();
$this
->
monitorSystemUpdate
();
$this
->
monitorMailQueue
();
$this
->
monitorRaid
();
$this
->
monitorRkHunter
();
$this
->
monitorFail2ban
();
$this
->
monitorSysLog
();
}
$this
->
monitorSysLog
();
}
function
monitorServer
(){
global
$app
;
global
$conf
;
function
monitorServer
()
{
global
$app
;
global
$conf
;
/* the id of the server as int */
$server_id
=
intval
(
$conf
[
"server_id"
]);
/* the id of the server as int */
$server_id
=
intval
(
$conf
[
"server_id"
]);
/** The type of the data */
$type
=
'server_load'
;
/** The type of the data */
$type
=
'server_load'
;
/*
/*
Fetch the data into a array
*/
$procUptime
=
shell_exec
(
"cat /proc/uptime | cut -f1 -d' '"
);
$data
[
'up_days'
]
=
floor
(
$procUptime
/
86400
);
$data
[
'up_hours'
]
=
floor
((
$procUptime
-
$data
[
'up_days'
]
*
86400
)
/
3600
);
$data
[
'up_minutes'
]
=
floor
((
$procUptime
-
$data
[
'up_days'
]
*
86400
-
$data
[
'up_hours'
]
*
3600
)
/
60
);
$data
[
'uptime'
]
=
shell_exec
(
"uptime"
);
$tmp
=
explode
(
","
,
$data
[
'uptime'
],
4
);
$tmpUser
=
explode
(
" "
,
trim
(
$tmp
[
2
]));
$data
[
'user_online'
]
=
intval
(
$tmpUser
[
0
]);
/* Old Load Average Code
$loadTmp = explode(":" , trim($tmp[3]));
$load = explode(",", $loadTmp[1]);
$data['load_1'] = floatval(trim($load[0]));
$data['load_5'] = floatval(trim($load[1]));
$data['load_15'] = floatval(trim($load[2])); */
*/
$procUptime
=
shell_exec
(
"cat /proc/uptime | cut -f1 -d' '"
);
$data
[
'up_days'
]
=
floor
(
$procUptime
/
86400
);
$data
[
'up_hours'
]
=
floor
((
$procUptime
-
$data
[
'up_days'
]
*
86400
)
/
3600
);
$data
[
'up_minutes'
]
=
floor
((
$procUptime
-
$data
[
'up_days'
]
*
86400
-
$data
[
'up_hours'
]
*
3600
)
/
60
);
$data
[
'uptime'
]
=
shell_exec
(
"uptime"
);
$tmp
=
explode
(
","
,
$data
[
'uptime'
],
4
);
$tmpUser
=
explode
(
" "
,
trim
(
$tmp
[
2
]));
$data
[
'user_online'
]
=
intval
(
$tmpUser
[
0
]);
//* New Load Average code to fix "always zero" bug in non-english distros. NEEDS TESTING
$loadTmp
=
shell_exec
(
"cat /proc/loadavg | cut -f1-3 -d' '"
);
...
...
@@ -163,421 +275,443 @@ class monitor_core_module {
$data
[
'load_5'
]
=
floatval
(
str_replace
(
','
,
'.'
,
$load
[
1
]));
$data
[
'load_15'
]
=
floatval
(
str_replace
(
','
,
'.'
,
$load
[
2
]));
/** The state of the server-load. */
$state
=
'ok'
;
if
(
$data
[
'load_1'
]
>
20
)
$state
=
'info'
;
if
(
$data
[
'load_1'
]
>
50
)
$state
=
'warning'
;
if
(
$data
[
'load_1'
]
>
100
)
$state
=
'critical'
;
if
(
$data
[
'load_1'
]
>
150
)
$state
=
'error'
;
/** The state of the server-load. */
$state
=
'ok'
;
if
(
$data
[
'load_1'
]
>
20
)
$state
=
'info'
;
if
(
$data
[
'load_1'
]
>
50
)
$state
=
'warning'
;
if
(
$data
[
'load_1'
]
>
100
)
$state
=
'critical'
;
if
(
$data
[
'load_1'
]
>
150
)
$state
=
'error'
;
/*
/*
Insert the data into the database
*/
$sql
=
"INSERT INTO monitor_data (server_id, type, created, data, state) "
.
"VALUES ("
.
$server_id
.
", "
.
"'"
.
$app
->
dbmaster
->
quote
(
$type
)
.
"', "
.
time
()
.
", "
.
"'"
.
$app
->
dbmaster
->
quote
(
serialize
(
$data
))
.
"', "
.
"'"
.
$state
.
"'"
.
")"
;
$app
->
dbmaster
->
query
(
$sql
);
*/
$sql
=
"INSERT INTO monitor_data (server_id, type, created, data, state) "
.
"VALUES ("
.
$server_id
.
", "
.
"'"
.
$app
->
dbmaster
->
quote
(
$type
)
.
"', "
.
time
()
.
", "
.
"'"
.
$app
->
dbmaster
->
quote
(
serialize
(
$data
))
.
"', "
.
"'"
.
$state
.
"'"
.
")"
;
$app
->
dbmaster
->
query
(
$sql
);
/* The new data is written, now we can delete the old one */
$this
->
_delOldRecords
(
$type
,
10
);
}
function
monitorOsVer
()
{
global
$app
;
global
$conf
;
/* the id of the server as int */
$server_id
=
intval
(
$conf
[
"server_id"
]);
/** The type of the data */
$type
=
'os_info'
;
/* The new data is written, now we can delete the old one */
$this
->
_delOldRecords
(
$type
,
10
);
}
/*
Fetch the data into a array
*/
$dist
=
$this
->
get_distname
();
$data
[
'name'
]
=
$dist
[
'name'
];
$data
[
'version'
]
=
$dist
[
'version'
];
/* the OS has no state. It is, what it is */
$state
=
'no_state'
;
/*
Insert the data into the database
*/
$sql
=
"INSERT INTO monitor_data (server_id, type, created, data, state) "
.
"VALUES ("
.
$server_id
.
", "
.
"'"
.
$app
->
dbmaster
->
quote
(
$type
)
.
"', "
.
time
()
.
", "
.
"'"
.
$app
->
dbmaster
->
quote
(
serialize
(
$data
))
.
"', "
.
"'"
.
$state
.
"'"
.
")"
;
$app
->
dbmaster
->
query
(
$sql
);
/* The new data is written, now we can delete the old one */
$this
->
_delOldRecords
(
$type
,
10
);
}
function
monitorDiskUsage
()
{
global
$app
;
global
$conf
;
function
monitorDiskUsage
()
{
global
$app
;
global
$conf
;
/* the id of the server as int */
$server_id
=
intval
(
$conf
[
"server_id"
]);
/* the id of the server as int */
$server_id
=
intval
(
$conf
[
"server_id"
]);
/** The type of the data */
$type
=
'disk_usage'
;
/** The type of the data */
$type
=
'disk_usage'
;
/** The state of the disk-usage */
$state
=
'ok'
;
/** The state of the disk-usage */
$state
=
'ok'
;
/** Fetch the data of ALL devices into a array (needed for monitoring!)*/
$dfData
=
shell_exec
(
"df -hT"
);
/** Fetch the data of ALL devices into a array (needed for monitoring!)*/
$dfData
=
shell_exec
(
"df -hT"
);
// split into array
$df
=
explode
(
"
\n
"
,
$dfData
);
// split into array
$df
=
explode
(
"
\n
"
,
$dfData
);
/*
/*
* ignore the first line, process the rest
*/
for
(
$i
=
1
;
$i
<=
sizeof
(
$df
);
$i
++
){
if
(
$df
[
$i
]
!=
''
)
{
/*
*/
for
(
$i
=
1
;
$i
<=
sizeof
(
$df
);
$i
++
)
{
if
(
$df
[
$i
]
!=
''
)
{
/*
* Make a array of the data
*/
$s
=
preg_split
(
"/[\s]+/"
,
$df
[
$i
]);
$data
[
$i
][
'fs'
]
=
$s
[
0
];
$data
[
$i
][
'type'
]
=
$s
[
1
];
$data
[
$i
][
'size'
]
=
$s
[
2
];
$data
[
$i
][
'used'
]
=
$s
[
3
];
$data
[
$i
][
'available'
]
=
$s
[
4
];
$data
[
$i
][
'percent'
]
=
$s
[
5
];
$data
[
$i
][
'mounted'
]
=
$s
[
6
];
/*
*/
$s
=
preg_split
(
"/[\s]+/"
,
$df
[
$i
]);
$data
[
$i
][
'fs'
]
=
$s
[
0
];
$data
[
$i
][
'type'
]
=
$s
[
1
];
$data
[
$i
][
'size'
]
=
$s
[
2
];
$data
[
$i
][
'used'
]
=
$s
[
3
];
$data
[
$i
][
'available'
]
=
$s
[
4
];
$data
[
$i
][
'percent'
]
=
$s
[
5
];
$data
[
$i
][
'mounted'
]
=
$s
[
6
];
/*
* calculate the state
*/
$usePercent
=
floatval
(
$data
[
$i
][
'percent'
]);
*/
$usePercent
=
floatval
(
$data
[
$i
][
'percent'
]);
//* We dont want to check the cdrom drive as a cd / dvd is always 100% full
if
(
$data
[
$i
][
'type'
]
!=
'iso9660'
&&
$data
[
$i
][
'type'
]
!=
'cramfs'
&&
$data
[
$i
][
'type'
]
!=
'udf'
)
{
if
(
$usePercent
>
75
)
$state
=
$this
->
_setState
(
$state
,
'info'
);
if
(
$usePercent
>
80
)
$state
=
$this
->
_setState
(
$state
,
'warning'
);
if
(
$usePercent
>
90
)
$state
=
$this
->
_setState
(
$state
,
'critical'
);
if
(
$usePercent
>
95
)
$state
=
$this
->
_setState
(
$state
,
'error'
);
if
(
$usePercent
>
75
)
$state
=
$this
->
_setState
(
$state
,
'info'
);
if
(
$usePercent
>
80
)
$state
=
$this
->
_setState
(
$state
,
'warning'
);
if
(
$usePercent
>
90
)
$state
=
$this
->
_setState
(
$state
,
'critical'
);
if
(
$usePercent
>
95
)
$state
=
$this
->
_setState
(
$state
,
'error'
);
}
}
}
}
}
/*
/*
Insert the data into the database
*/
$sql
=
"INSERT INTO monitor_data (server_id, type, created, data, state) "
.
"VALUES ("
.
$server_id
.
", "
.