proc.plugin: dont log if pressure/irq does not exist (#15732)
Ilya Mashchenko committed
Aug 3, 2023 at 21:15 UTC
c3a40401c5c36437ca85ff3abc1f1b4bb430e3a7
1 file changed
+13
-3
collectors/proc.plugin/proc_pressure.c
+13
-3
@@ -178,6 +178,9 @@ int do_proc_pressure(int update_every, usec_t dt) {
178
procfile *ff = resource_info[i].pf;
179
int do_some = resources[i].some.enabled, do_full = resources[i].full.enabled;
180
181
+ if (!resources[i].some.available && !resources[i].full.available)
182
+ continue;
183
+
184
if (unlikely(!ff)) {
185
char filename[FILENAME_MAX + 1];
186
char config_key[CONFIG_MAX_NAME + 1];
@@ -200,12 +203,19 @@ int do_proc_pressure(int update_every, usec_t dt) {
203
do_full = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_PRESSURE, config_key, do_full);
204
resources[i].full.enabled = do_full;
205
203
- if(!do_full && !do_some)
206
+ if (!do_full && !do_some) {
207
+ resources[i].some.available = false;
208
+ resources[i].full.available = false;
209
continue;
210
+ }
211
206
- ff = procfile_open(filename, " =", PROCFILE_FLAG_DEFAULT);
212
+ ff = procfile_open(filename, " =", PROCFILE_FLAG_NO_ERROR_ON_FILE_IO);
213
if (unlikely(!ff)) {
208
- collector_error("Cannot read pressure information from %s.", filename);
214
+ // PSI IRQ was added recently (https://github.com/torvalds/linux/commit/52b1364ba0b105122d6de0e719b36db705011ac1)
215
+ if (strcmp(resource_info[i].name, "irq") != 0)
216
+ collector_error("Cannot read pressure information from %s.", filename);
217
+ resources[i].some.available = false;
218
+ resources[i].full.available = false;
219
continue;
220
}
221
}