mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
sysutils/node_exporter: replace textfile directory TextField with BooleanField
Per reviewer feedback: use a checkbox with a fixed hardcoded path (/var/db/node_exporter/textfile) instead of a free-text directory field to avoid arbitrary path/command injection.
This commit is contained in:
parent
c64f5f8cfc
commit
17c5ed428f
4 changed files with 9 additions and 9 deletions
|
|
@ -9,7 +9,7 @@ Changelog
|
|||
|
||||
1.3
|
||||
|
||||
* Add textfile collector directory support
|
||||
* Add textfile collector support (fixed directory: /var/db/node_exporter/textfile)
|
||||
|
||||
1.2
|
||||
|
||||
|
|
|
|||
|
|
@ -84,9 +84,9 @@
|
|||
<help>Enable the ZFS collector.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>general.textfile_directory</id>
|
||||
<label>Textfile Directory</label>
|
||||
<type>text</type>
|
||||
<help>Path to a directory read by the textfile collector. Files ending in .prom in this directory will be exposed as metrics. Leave empty to disable. Example: /var/db/node_exporter</help>
|
||||
<id>general.textfile</id>
|
||||
<label>Textfile Collector</label>
|
||||
<type>checkbox</type>
|
||||
<help>Enable the textfile collector. When enabled, .prom files placed in /var/db/node_exporter/textfile will be exposed as metrics.</help>
|
||||
</field>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,6 @@
|
|||
<interrupts type="BooleanField"/>
|
||||
<ntp type="BooleanField"/>
|
||||
<zfs type="BooleanField"/>
|
||||
<textfile_directory type="TextField"/>
|
||||
<textfile type="BooleanField"/>
|
||||
</items>
|
||||
</model>
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@
|
|||
{%- set zfs = no_collector + "zfs " -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if not helpers.empty('OPNsense.NodeExporter.textfile_directory') -%}
|
||||
{%- set textfile_directory = "--collector.textfile.directory=" + OPNsense.NodeExporter.textfile_directory + " " -%}
|
||||
{%- if OPNsense.NodeExporter.textfile == '1' -%}
|
||||
{%- set textfile = "--collector.textfile.directory=/var/db/node_exporter/textfile " -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if ':' in OPNsense.NodeExporter.listenaddress -%}
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
{%- set listenaddress = OPNsense.NodeExporter.listenaddress -%}
|
||||
{%- endif -%}
|
||||
|
||||
node_exporter_args="{{ cpu }}{{ exec }}{{ filesystem }}{{ loadavg }}{{ meminfo }}{{ netdev }}{{ ntp }}{{ time }}{{ devstat }}{{ zfs }}{{ textfile_directory }}"
|
||||
node_exporter_args="{{ cpu }}{{ exec }}{{ filesystem }}{{ loadavg }}{{ meminfo }}{{ netdev }}{{ ntp }}{{ time }}{{ devstat }}{{ zfs }}{{ textfile }}"
|
||||
node_exporter_listen_address="{{ listenaddress }}:{{ OPNsense.NodeExporter.listenport }}"
|
||||
node_exporter_enable="YES"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue