{"id":333,"date":"2022-10-14T14:09:29","date_gmt":"2022-10-14T06:09:29","guid":{"rendered":"https:\/\/note.dayday.work\/?p=333"},"modified":"2022-10-17T14:46:19","modified_gmt":"2022-10-17T06:46:19","slug":"proxmox-%e5%84%80%e8%a1%a8%e6%9d%bf%e5%a2%9e%e5%8a%a0cpu%e6%ba%ab%e5%ba%a6%e9%a1%af%e7%a4%ba","status":"publish","type":"post","link":"https:\/\/note.dayday.work\/?p=333","title":{"rendered":"Proxmox \u5100\u8868\u677f\u589e\u52a0cpu\u6eab\u5ea6\u986f\u793a"},"content":{"rendered":"\n<figure class=\"wp-block-gallery columns-2 is-cropped\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"768\" height=\"441\" src=\"https:\/\/note.dayday.work\/wp-content\/uploads\/2022\/10\/proxmoxtemp1-768x441.jpg\" alt=\"\" data-id=\"350\" data-full-url=\"https:\/\/note.dayday.work\/wp-content\/uploads\/2022\/10\/proxmoxtemp1.jpg\" data-link=\"https:\/\/note.dayday.work\/?attachment_id=350\" class=\"wp-image-350\" srcset=\"https:\/\/note.dayday.work\/wp-content\/uploads\/2022\/10\/proxmoxtemp1-768x441.jpg 768w, https:\/\/note.dayday.work\/wp-content\/uploads\/2022\/10\/proxmoxtemp1-300x172.jpg 300w, https:\/\/note.dayday.work\/wp-content\/uploads\/2022\/10\/proxmoxtemp1-1024x588.jpg 1024w, https:\/\/note.dayday.work\/wp-content\/uploads\/2022\/10\/proxmoxtemp1.jpg 1147w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"768\" height=\"441\" src=\"https:\/\/note.dayday.work\/wp-content\/uploads\/2022\/10\/proxmoxtemp2-768x441.jpg\" alt=\"\" data-id=\"351\" data-full-url=\"https:\/\/note.dayday.work\/wp-content\/uploads\/2022\/10\/proxmoxtemp2.jpg\" data-link=\"https:\/\/note.dayday.work\/?attachment_id=351\" class=\"wp-image-351\" srcset=\"https:\/\/note.dayday.work\/wp-content\/uploads\/2022\/10\/proxmoxtemp2-768x441.jpg 768w, https:\/\/note.dayday.work\/wp-content\/uploads\/2022\/10\/proxmoxtemp2-300x172.jpg 300w, https:\/\/note.dayday.work\/wp-content\/uploads\/2022\/10\/proxmoxtemp2-1024x587.jpg 1024w, https:\/\/note.dayday.work\/wp-content\/uploads\/2022\/10\/proxmoxtemp2.jpg 1147w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p><strong>\u5b89\u88dd\u8edf\u9ad4<\/strong><\/p>\n\n\n\n<p><span>\u5b89\u88dd&nbsp;<\/span><code>lm-sensors<\/code><span> \u5957\u4ef6\uff0c\u76e3\u63a7\u611f\u61c9\u5668\u670d\u52d9\uff0c\u63d0\u4f9b\u76e3\u63a7\u6eab\u5ea6\u3001\u96fb\u63a7\u3001\u6fd5\u5ea6\u548c\u98a8\u6247\u7684\u5de5\u5177<\/span>\u5b89\u88dd\u5b8c\u5f8c\u57f7\u884c\u6383\u63cf<span>&nbsp;<\/span><code>sensors-detect<\/code><span>&nbsp;<\/span><br>\u8dd1\u5b8c\u7b2c\u4e00\u6b21\u786c\u9ad4\u898f\u683c\u6383\u63cf\u5f8c\u518d\u57f7\u884c<span>&nbsp;<\/span><code>sensors<\/code>\uff0c\u6703\u986f\u793a\u76ee\u524d\u7cfb\u7d71\u6eab\u5ea6<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>sudo apt-get update\nsudo apt-get install lm-sensors\n#\u5b89\u88dd\u5b8c\u5f8c\u57f7\u6383\u63cf\u786c\u9ad4\nsudo sensors-detect \nsudo \u00a0sensors<\/code><\/pre><\/div>\n\n\n\n<p><strong>\u7b2c1\u7a2e\u65b9\u6cd5<\/strong><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>vim \/usr\/share\/perl5\/PVE\/API2\/Nodes.pm\n\n\t$res-&gt;{pveversion} = PVE::pvecfg::package() . &quot;\/&quot; .\n\t    PVE::pvecfg::version_text();\n\n\t$res-&gt;{thermalstate} = `sensors`; &lt;&lt;&lt;\u9019\u88e1\u589e\u52a0\u9019\u4e00\u884c\n\n\tmy $dinfo = df(&#39;\/&#39;, 1);     # output is bytes\n\n\t$res-&gt;{rootfs} = {\n\t    total =&gt; $dinfo-&gt;{blocks},\n\t    avail =&gt; $dinfo-&gt;{bavail},\n\t    used =&gt; $dinfo-&gt;{used},\n\t    free =&gt; $dinfo-&gt;{blocks} - $dinfo-&gt;{used},\n\t};<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>vim \/usr\/share\/pve-manager\/js\/pvemanagerlib.js\n\n# \u7b2c\u4e00\u6bb5\nExt.define(&#39;PVE.node.StatusView&#39;, {\n    extend: &#39;PVE.panel.StatusView&#39;,\n    alias: &#39;widget.pveNodeStatus&#39;,\n\n    height: 320, &lt;&lt;&lt;\u5c07\u9019\u500b\u9810\u8a2d 300 \u4fee\u6539\u6210 320\n    bodyPadding: &#39;20 15 20 15&#39;,\n\n    layout: {\n\ttype: &#39;table&#39;,\n\tcolumns: 2,\n\ttableAttrs: {\n\t    style: {\n\t\twidth: &#39;100%&#39;\n\t    }\n\t}\n\n# \u7b2c\u4e8c\u6bb5\n{\n\t    itemId: &#39;version&#39;,\n\t    colspan: 2,\n\t    printBar: false,\n\t    title: gettext(&#39;PVE Manager Version&#39;),\n\t    textField: &#39;pveversion&#39;,\n\t    value: &#39;&#39;\n\t}, &lt;&lt;&lt; \u9019\u88e1\u6709\u4e00\u500b , \u865f\u4e0d\u7136\u6703\u6709\u554f\u984c\n#\u589e\u52a0\u9019\u4e00\u6bb5\n\t{\n\t\t itemId: &#39;thermal&#39;,\n\t\t colspan: 2,\n\t\t printBar: false,\n\t\t title: gettext(&#39;CPU Thermal State&#39;),\n\t\t textField: &#39;thermalstate&#39;,\n\t\t renderer:function(value){\n\t\t\t const c0 = value.match(\/Core 0.*?\\+([\\d\\.]+)\u00c2\/)[1];\n\t\t\t const c1 = value.match(\/Core 1.*?\\+([\\d\\.]+)\u00c2\/)[1];\n\t\t\t const c2 = value.match(\/Core 2.*?\\+([\\d\\.]+)\u00c2\/)[1];\n\t\t\t const c3 = value.match(\/Core 3.*?\\+([\\d\\.]+)\u00c2\/)[1];\n\t\t\t return `Core 0: ${c0} \u2103 | Core 1: ${c1} \u2103 | Core 2: ${c2} \u2103 | Core 3: ${c3} \u2103`\n\t\t }\n\t}<\/code><\/pre><\/div>\n\n\n\n<p><strong>\u7b2c2\u7a2e\u65b9\u6cd5<\/strong><br><a href=\"https:\/\/medium.com\/help-14\/add-amd-cpu-gpu-nvme-temperature-monitoring-to-proxmox-7-a95147df71cd\" data-type=\"URL\" data-id=\"https:\/\/medium.com\/help-14\/add-amd-cpu-gpu-nvme-temperature-monitoring-to-proxmox-7-a95147df71cd\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/medium.com\/help-14\/add-amd-cpu-gpu-nvme-temperature-monitoring-to-proxmox-7-a95147df71cd<\/a><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>vim \/usr\/share\/perl5\/PVE\/API2\/Nodes.pm\n\n\t$res-&gt;{pveversion} = PVE::pvecfg::package() . &quot;\/&quot; .\n\t    PVE::pvecfg::version_text();\n\n\t$res-&gt;{CPUtemperature} = `sensors`; &lt;&lt;&lt;\u9019\u88e1\u589e\u52a0\u9019\u4e00\u884c\n  $res-&gt;{GPUtemperature} = `sensors`;\n  $res-&gt;{Nvmetemperature} = `sensors`;\n  $res-&gt;{HDDCPUtemperature} = `hddtemp \/dev\/sda`;\n\n\tmy $dinfo = df(&#39;\/&#39;, 1);     # output is bytes\n\n\t$res-&gt;{rootfs} = {\n\t    total =&gt; $dinfo-&gt;{blocks},\n\t    avail =&gt; $dinfo-&gt;{bavail},\n\t    used =&gt; $dinfo-&gt;{used},\n\t    free =&gt; $dinfo-&gt;{blocks} - $dinfo-&gt;{used},\n\t};<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>vim \/usr\/share\/pve-manager\/js\/pvemanagerlib.js\n\n# \u7b2c\u4e00\u6bb5\nExt.define(&#39;PVE.node.StatusView&#39;, {\n    extend: &#39;PVE.panel.StatusView&#39;,\n    alias: &#39;widget.pveNodeStatus&#39;,\n\n    height: 320, &lt;&lt;&lt;\u5c07\u9019\u500b\u9810\u8a2d 300 \u4fee\u6539\u6210 320 or 420\n    bodyPadding: &#39;20 15 20 15&#39;,\n\n    layout: {\n\ttype: &#39;table&#39;,\n\tcolumns: 2,\n\ttableAttrs: {\n\t    style: {\n\t\twidth: &#39;100%&#39;\n\t    }\n\t}\n\n# \u7b2c\u4e8c\u6bb5\n{\n\t    itemId: &#39;version&#39;,\n\t    colspan: 2,\n\t    printBar: false,\n\t    title: gettext(&#39;PVE Manager Version&#39;),\n\t    textField: &#39;pveversion&#39;,\n\t    value: &#39;&#39;\n\t}, &lt;&lt;&lt; \u9019\u88e1\u6709\u4e00\u500b , \u865f\u4e0d\u7136\u6703\u6709\u554f\u984c\n#\u589e\u52a0\u9019\u4e00\u6bb5\u56e0\u70ba\u6211\u7684CPU\u662fcore\u6240\u4ee5\u66f4\u52d5\n{\n            itemId: &#39;CPUtemperature&#39;,\n            colspan: 2,\n            printBar: false,\n            title: gettext(&#39;CPU Temperature&#39;),\n            textField: &#39;CPUtemperature&#39;,\n            renderer: function(value){\n                const dieTemp = Array.from(value.matchAll(\/Core .*?\\+([\\d\\.]+)?\/g), m=&gt;m[1]);\n                return dieTemp.map((element, index) =&gt; `CPU Core ${index+1}: ${element}\u2103`).join(&#39; | &#39;);\n                                        }\n        },<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"638\" height=\"422\" src=\"https:\/\/note.dayday.work\/wp-content\/uploads\/2022\/10\/proxmoxtemp3.jpg\" alt=\"\" class=\"wp-image-348\" srcset=\"https:\/\/note.dayday.work\/wp-content\/uploads\/2022\/10\/proxmoxtemp3.jpg 638w, https:\/\/note.dayday.work\/wp-content\/uploads\/2022\/10\/proxmoxtemp3-300x198.jpg 300w\" sizes=\"(max-width: 638px) 100vw, 638px\" \/><\/figure>\n\n\n\n<p>\u91cd\u65b0\u555f\u52d5pveproxy<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>systemctl restart pveproxy<\/code><\/pre><\/div>\n\n\n\n<p><strong>Vim \u641c\u5c0b\u65b9\u6cd5<\/strong><\/p>\n\n\n\n<p><span>\u5728 Vim \u7de8\u8f2f\u5668\u4e2d\u82e5\u8981\u641c\u5c0b\u6a94\u6848\u4e2d\u7684\u95dc\u9375\u5b57\uff0c<br \/>\u53ef\u4ee5\u4f7f\u7528\u00a0<\/span><code>\/<\/code><span>\uff08\u5411\u5f8c\u641c\u5c0b\uff09\u6216\u00a0<\/span><code>?<\/code><span>\uff08\u5411\u524d\u641c\u5c0b\uff09\uff0c\u4f8b\u5982\u5411\u5f8c\u641c\u5c0b\u00a0<\/span><code>Gun<\/code><span>\u00a0\u9019\u500b\u95dc\u9375\u5b57\uff1a<\/span><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>\\Gun\n?Gun<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88dd\u8edf\u9ad4 \u5b89\u88dd&nbsp;lm-sensors \u5957\u4ef6\uff0c\u76e3\u63a7\u611f\u61c9\u5668\u670d\u52d9\uff0c\u63d0\u4f9b\u76e3\u63a7\u6eab\u5ea6\u3001\u96fb\u63a7\u3001\u6fd5\u5ea6\u548c\u98a8\u6247\u7684\u5de5\u5177\u5b89\u88dd &#8230; <span class=\"more\"><a class=\"more-link\" href=\"https:\/\/note.dayday.work\/?p=333\">[Read more&#8230;]<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[6,23],"tags":[37],"_links":{"self":[{"href":"https:\/\/note.dayday.work\/index.php?rest_route=\/wp\/v2\/posts\/333"}],"collection":[{"href":"https:\/\/note.dayday.work\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/note.dayday.work\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/note.dayday.work\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/note.dayday.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=333"}],"version-history":[{"count":10,"href":"https:\/\/note.dayday.work\/index.php?rest_route=\/wp\/v2\/posts\/333\/revisions"}],"predecessor-version":[{"id":355,"href":"https:\/\/note.dayday.work\/index.php?rest_route=\/wp\/v2\/posts\/333\/revisions\/355"}],"wp:attachment":[{"href":"https:\/\/note.dayday.work\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/note.dayday.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/note.dayday.work\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}