Hi I have configured this module : #SYSTEM SWAPPING module_begin module_name Swap module_type generic_proc module_exec if [ `free -m | tail -n 1 | awk '{print $3}'` = "0" ]; then echo 1; else echo 0; fi module_description SWAP OK module_end So if swap is used, the value is set to 0 (BAD) I swap is not used, the value is set to 1 (GOOD) But when i restart the pandrafms service, always a 0 and a 1 is written in events
But if you launch manually the command in cli : if [ `free -m | tail -n 1 | awk '{print $3}'` = "0" ]; then echo 1; else echo 0; fi The value is always 1. So why i have 0 in events ?? Thanks for your help
Boolean module always return 0 and 1 in events
troublestarterxxx · 6 mar 2020, 14:14 · 10 mensajes · 71 visitas
- Inicio del debate
Hi I have configured this module : #SYSTEM SWAPPING module_begin module_name Swap module_type generic_proc module_exec if [ `free -m | tail -n 1 | awk '{print $3}'` = "0" ]; then echo 1; else echo 0; fi module_description SWAP OK module_end So if swap is used, the value is set to 0 (BAD) I swap is not used, the value is set to 1 (GOOD) But when i restart the pandrafms service, always a 0 and a 1 is written in events
But if you launch manually the command in cli : if [ `free -m | tail -n 1 | awk '{print $3}'` = "0" ]; then echo 1; else echo 0; fi The value is always 1. So why i have 0 in events ?? Thanks for your helpHello troublestarterxxx, how are you? My advice: «So if swap is used (swap used > 0), the value is set to 0 (BAD)»
if [ `free -m | grep "Swap" | awk {'print $3}'` > "0" ]; then echo 0; else echo 1; fiNote: Column 1: «Swap», (memory type). Column 2: «total». Column 3: «used». Column 4: «free». etc. Use grep command for choose the exact line, if you please. Edited: fixed, working with numbers
valor=`free -m | grep "Swap" | awk {'print $3}'`; if [ $(($valor+0)) > 0 ]; then echo 0; else echo 1; fiHI First, thanks for your reply. But 2 questions : - Why my command not work properly ? the command return always the good result in CLI, but not in PandoraFMS - Your command return correct value in cli, but have the same problem, it return always 0 then 1 at every pandora service restart ... Seems only change the FF Threshold to solve this issue. Actually, i ask for every change status, i has to pass in minimum 2 or 3 change in FF Threshold.
Hello troublestarterxxx, We have tried to replicate the bug you have in our machines without success, in which version do you currently have PandoraFMS? Maybe this problem has been solved in past versions of pandora. Also, could you tell us where you are configuring this module and what service you are restarting? Greetings Diego
HI First, thanks for your reply. But 2 questions : - Why my command not work properly ? the command return always the good result in CLI, but not in PandoraFMS - Your command return correct value in cli, but have the same problem, it return always 0 then 1 at every pandora service restart ... Seems only change the FF Threshold to solve this issue. Actually, i ask for every change status, i has to pass in minimum 2 or 3 change in FF Threshold.
Wait a moment, please! You have a great issue for... BASH! Numerical values in BASH are little tricky, let me see again that script and after we analyze how works Pandora FMS with it. Reading: https://linuxhint.com/variables-bash-programming/
Hello troublestarterxxx, We have tried to replicate the bug you have in our machines without success, in which version do you currently have PandoraFMS? Maybe this problem has been solved in past versions of pandora. Also, could you tell us where you are configuring this module and what service you are restarting? Greetings Diego
I restart the pandora_agent on the client. Our version is 191231 in update manager. Client version of pandora is pandorafms_agent_unix-7.0NG.735-1.noarch Thanks for your reply.
Hello troublestarterxxx, We have tried to replicate the bug you have in our machines without success, in which version do you currently have PandoraFMS? Maybe this problem has been solved in past versions of pandora. Also, could you tell us where you are configuring this module and what service you are restarting? Greetings Diego
I restart the pandorafms client service. Pandorafms agent version : pandorafms_agent_unix-7.0NG.735-1.noarch Pandorafms server version : 191231
Hello troublestarterxxx, The version of Pandora is visible on the footer of the console, and got this format: "Pandora FMS v7.0NG.744 - Build PC200312 - MR 36". Send us again the version, but i suspect you must update pandora. Greetings Diego
Hello troublestarterxxx, The version of Pandora is visible on the footer of the console, and got this format: "Pandora FMS v7.0NG.744 - Build PC200312 - MR 36". Send us again the version, but i suspect you must update pandora. Greetings Diego
Sorry for the delay, here is the version : v7.0NG.733 I wil try update Pandora FMS server version
Hello troublestarterxxx, I recommend you to update both the console and the Pandora FMS server, I'm afraid you have an outdated version and maybe the bug you suffer will be fixed with the new versions. Greetings Diego
Entra en tu cuenta para publicar.
