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.
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)
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?
Hello,
The Volumes information is taken from SNMP - it uses hrStorageUsed (1.3.6.1.2.1.25.2.3.1.6) and hrStorageAllocationUnits (1.3.6.1.2.1.25.2.3.1.4) for computing the used space.
The "du" command returns estimate file space usage (according to documentation). So maybe this information is not accurate or doesn't contain space used by system.
Unfortunately I'm not Linux expert to answer why there is this discrepancy between data returned by SNMP and data returned by shell command.
Thanks,
Lukas Belza
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.
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community. More than 195,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process.