├── LICENSE ├── Makefile ├── README.md ├── htdocs └── luci-static │ └── resources │ └── view │ └── status │ └── include │ └── 18_cpu.js ├── po ├── ru │ └── cpu-status.po └── templates │ └── cpu-status.pot ├── root └── usr │ └── share │ └── rpcd │ └── acl.d │ └── luci-app-cpu-status.json └── screenshots └── 01.jpg /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 gSpotx2f 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2025 gSpot (https://github.com/gSpotx2f/luci-app-cpu-status-mini) 3 | # 4 | # This is free software, licensed under the MIT License. 5 | # 6 | 7 | include $(TOPDIR)/rules.mk 8 | 9 | PKG_NAME:=luci-app-cpu-status-mini 10 | PKG_VERSION:=0.2.0 11 | PKG_RELEASE:=1 12 | LUCI_TITLE:=CPU utilization info for the LuCI status page 13 | LUCI_PKGARCH:=all 14 | PKG_LICENSE:=MIT 15 | 16 | #include ../../luci.mk 17 | include $(TOPDIR)/feeds/luci/luci.mk 18 | 19 | # call BuildPackage - OpenWrt buildroot signature 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # luci-app-cpu-status-mini 2 | CPU utilization info for the LuCI status page (OpenWrt webUI). 3 | 4 | OpenWrt >= 21.02. 5 | 6 | Advanced version: [luci-app-cpu-status](https://github.com/gSpotx2f/luci-app-cpu-status). 7 | 8 | ## Installation notes 9 | 10 | wget --no-check-certificate -O /tmp/luci-app-cpu-status-mini_0.2.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-cpu-status-mini_0.2.0-r1_all.ipk 11 | opkg install /tmp/luci-app-cpu-status-mini_0.2.0-r1_all.ipk 12 | rm /tmp/luci-app-cpu-status-mini_0.2.0-r1_all.ipk 13 | /etc/init.d/rpcd reload 14 | 15 | i18n-ru: 16 | 17 | wget --no-check-certificate -O /tmp/luci-i18n-cpu-status-mini-ru_0.2.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-cpu-status-mini-ru_0.2.0-r1_all.ipk 18 | opkg install /tmp/luci-i18n-cpu-status-mini-ru_0.2.0-r1_all.ipk 19 | rm /tmp/luci-i18n-cpu-status-mini-ru_0.2.0-r1_all.ipk 20 | 21 | ## Screenshots: 22 | 23 | ![](https://github.com/gSpotx2f/luci-app-cpu-status-mini/blob/master/screenshots/01.jpg) 24 | -------------------------------------------------------------------------------- /htdocs/luci-static/resources/view/status/include/18_cpu.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 'require baseclass'; 3 | 'require fs'; 4 | 5 | return baseclass.extend({ 6 | title : _('CPU Load'), 7 | 8 | cpuStatLast: null, 9 | 10 | load() { 11 | return L.resolveDefault(fs.read('/proc/stat'), null); 12 | }, 13 | 14 | render(cpuData) { 15 | if(!cpuData) return; 16 | 17 | let cpuStat = null; 18 | let statItemsArray = cpuData.trim().split('\n').filter(s => s.startsWith('cpu')); 19 | 20 | for(let str of statItemsArray) { 21 | let arr = str.split(/\s+/).slice(0, 8); 22 | if(arr[0] === 'cpu') { 23 | arr[0] = 0; 24 | arr = arr.map(e => Number(e)); 25 | cpuStat = [ 26 | arr[1] + arr[2] + arr[3] + arr[5] + arr[6] + arr[7], 27 | arr[4], 28 | ]; 29 | }; 30 | }; 31 | 32 | let cpuTable = E('table', { 'class': 'table' }); 33 | let loadAvg = 0; 34 | 35 | if(this.cpuStatLast !== null) { 36 | let idle = cpuStat[1] - this.cpuStatLast[1]; 37 | let sum = cpuStat[0] - this.cpuStatLast[0]; 38 | loadAvg = Math.round(100 * sum / (sum + idle)); 39 | }; 40 | 41 | cpuTable.append( 42 | E('tr', { 'class': 'tr' }, [ 43 | E('td', { 'class': 'td left', 'width': '33%' }, _('Total Load')), 44 | E('td', { 'class': 'td' }, 45 | E('div', { 46 | 'class': 'cbi-progressbar', 47 | 'title': (this.cpuStatLast !== null) ? loadAvg + '%' : _('Calculating') + '...', 48 | }, 49 | E('div', { 'style': 'width:' + loadAvg + '%' }) 50 | ) 51 | ), 52 | ]) 53 | ); 54 | 55 | this.cpuStatLast = cpuStat; 56 | return cpuTable; 57 | }, 58 | }); 59 | -------------------------------------------------------------------------------- /po/ru/cpu-status.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Content-Type: text/plain; charset=UTF-8\n" 4 | "Project-Id-Version: \n" 5 | "POT-Creation-Date: \n" 6 | "PO-Revision-Date: \n" 7 | "Language-Team: \n" 8 | "MIME-Version: 1.0\n" 9 | "Content-Transfer-Encoding: 8bit\n" 10 | "X-Generator: Poedit 2.3\n" 11 | "Last-Translator: \n" 12 | "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n" 13 | "Language: ru\n" 14 | 15 | msgid "Calculating" 16 | msgstr "Вычисление" 17 | 18 | msgid "CPU Load" 19 | msgstr "Загрузка ЦПУ" 20 | 21 | msgid "Total Load" 22 | msgstr "Общая загрузка" 23 | -------------------------------------------------------------------------------- /po/templates/cpu-status.pot: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8" 3 | 4 | msgid "Calculating" 5 | msgstr "" 6 | 7 | msgid "CPU Load" 8 | msgstr "" 9 | 10 | msgid "Total Load" 11 | msgstr "" 12 | -------------------------------------------------------------------------------- /root/usr/share/rpcd/acl.d/luci-app-cpu-status.json: -------------------------------------------------------------------------------- 1 | { 2 | "luci-app-cpu-status": { 3 | "description": "Grant access to cpu-status procedures", 4 | "read": { 5 | "file": { 6 | "/proc/stat": [ "read" ] 7 | } 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /screenshots/01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gSpotx2f/luci-app-cpu-status-mini/3ca76f1e25a965f140789bcb242153d1a5836ede/screenshots/01.jpg --------------------------------------------------------------------------------