The screenshot shows a default Linux Perl script to monitor disk space for the root partition. Where do I edit the script to point to another partition instead? Specifically either the /boot or /dev/shm partition?
Thanks for any help.
Hello,
Try to use "du" Linux command that summarize disk usage of each FILE, recursively for directories (du - Linux Command - Unix Command) with parameters "-s " (summarize) and "-b" (print size in bytes). I'm not sure, but default value is in kilobytes.
#!/usr/bin/perl
@stat=split(" ", `du -sb /boot`);
$exit=`echo $?`;
if ($exit == 0) {
print "Message: Directory size of /boot is $stat[0] B\n";
print "Statistic: $stat[0]\n";
exit 0;
}
print "Message: ERROR: Check the command (du) syntax in script.\n";
exit 1;
I hope that helps.
Lukas Belza (SolarWinds development)
That did not work. See the screenshot of the script output message:
Any idea why it did not work?
Please change $stat[3] to $stat[0] (because "du" command returns the disk usage in the first column). Or you can copy and paste my whole script. One note - the original script returns the available space, but my script returns used space by specified directory.
OK, that last change at least caused the script to run correctly, but now the statistical result seems to be incorrect. The first screenshot shows the space information for the target node from the NPM node details page, while the second screenshot is the output for the Linux monitor script.
Why the discrepancy?
SAM 6.3 Beta 2 is now available which includes a Linux Agent for Node, Volume, Interface, and Application monitoring. This agent should address many of the shortcomings associated with monitoring Linux host via SNMP, up to and including properly calculating volume usage statistics referenced in this thread. If you already own Server & Application Monitor and are under active maintenance, you can sign-up to participate in the beta at the link below.