Hello, I have put together a bash script for a custom SSH Script Sensor so that I can monitor used INode counts. We have a Linux server that seems to spike on INode or open file usage and crashes. I should mention that I am fairly new to the world of PRTG and bash scripting. My script works in that I can set a threshold count range and it will produce the correct value count, plus PRTG recognizes the state changes (OK, Warning, Error).
The problem I'm hoping to get some help with is that when I set the return value to a "2" by the nature of that being seen as a system error, PRTG doesn't seem to display any integer counts in the "Value" channel. But it will display them if you change the return value to a "0" or a "1". So an example sensor message with the "2" value might look like this: "System Error: Count EXCEEDED Test (Code: PE022). Graph = Value > No data.
We'd like to be able graph the used INodes data when it crashes and goes into a down state or "2". This is the script that works on our Linux server:
#!/bin/bash #A shell script to monitor INode counts for root output=$(df -i | grep root | awk '{print $3}') if [ "$output" -ge 0 ] && [ "$output" -le 30000 ]; then echo 0:$output:Count OK elif [ "$output" -ge 30000 ] && [ "$output" -le 36000 ]; then echo 1:$output:Count WARNING elif [ "$output" -ge 36000 ] && [ "$output" -gt 42000 ]; then echo "2:$output:$output:Count EXCEEDED Test" fi
I put the extra $output in the code because I found that PRTG will put the correct INode integer counts in the header that way, but it still won't graph the data.
Is there a way to get the values to produce for the "2" return value and if so, might someone have a suggestion as to how I can do this? Thanks for any help you can offer!
Add comment