diff --git a/etc/cron.jobs.in b/etc/cron.jobs.in index 7c6a5c7f..527ac697 100644 --- a/etc/cron.jobs.in +++ b/etc/cron.jobs.in @@ -7,7 +7,6 @@ piler's crontab: ### mandatory -*/5 * * * * LC_ALL=C mpstat | tail -1 | awk '{print $11}' > /var/piler/stat/cpu.stat 5,35 * * * * LIBEXECDIR/piler/indexer.delta.sh 30 2 * * * LIBEXECDIR/piler/indexer.main.sh */15 * * * * /usr/local/bin/indexer --quiet tag1 --rotate diff --git a/util/postinstall.sh.in b/util/postinstall.sh.in index 324f77ce..4b787ce2 100755 --- a/util/postinstall.sh.in +++ b/util/postinstall.sh.in @@ -284,8 +284,6 @@ make_cron_entries() { echo "" echo "### PILERSTART" >> $CRON_TMP - echo "*/5 * * * * LC_ALL=C mpstat | tail -1 | awk '{print \$11}' > $LOCALSTATEDIR/piler/stat/cpu.stat" >> $CRON_TMP - echo "5,35 * * * * $LIBEXECDIR/piler/indexer.delta.sh" >> $CRON_TMP echo "30 2 * * * $LIBEXECDIR/piler/indexer.main.sh" >> $CRON_TMP echo "*/15 * * * * $INDEXER --quiet tag1 --rotate" >> $CRON_TMP diff --git a/webui/config.php b/webui/config.php index 6aec2731..2302b864 100644 --- a/webui/config.php +++ b/webui/config.php @@ -193,6 +193,7 @@ $config['SPHINX_NOTE_INDEX'] = 'note1'; $config['RELOAD_COMMAND'] = 'sudo -n /etc/init.d/rc.piler reload'; $config['PILERIMPORT_IMAP_COMMAND'] = '/usr/local/bin/pilerimport -d /var/piler/imap -q -r'; +$config['CPU_USAGE_COMMAND'] = "LC_ALL=C mpstat | tail -1 | awk '{print $11}'"; $config['LDAP_IMPORT_CONFIG_FILE'] = '/usr/local/etc/ldap-import.cfg'; diff --git a/webui/controller/health/worker.php b/webui/controller/health/worker.php index 1a2e88eb..7491a75d 100644 --- a/webui/controller/health/worker.php +++ b/webui/controller/health/worker.php @@ -50,7 +50,8 @@ class ControllerHealthWorker extends Controller { list ($this->data['uptime'], $this->data['cpuload']) = $this->model_health_health->uptime(); - $this->data['cpuinfo'] = 100 - (int)file_get_contents(CPUSTAT); + $x = system(CPU_USAGE_COMMAND); + $this->data['cpuinfo'] = 100 - (int)$x; $this->data['quarantinereportinfo'] = @file_get_contents(DAILY_QUARANTINE_REPORT_STAT);