Add check if some IOs related functions supported

This commit is contained in:
Ilia Ross
2024-11-12 01:05:19 +02:00
parent c7a709c837
commit 1c991f9635
2 changed files with 28 additions and 0 deletions

View File

@ -189,5 +189,19 @@ if (!$?) {
return ( $w[-3], $w[-2], $w[-1], 0, 0, $bi, $bo );
}
# has_disk_stats()
# Returns 1 if disk I/O stats are available
sub has_disk_stats
{
return &has_command("iostat") ? 1 : 0;
}
# has_network_stats()
# Returns 1 if network I/O stats are available
sub has_network_stats
{
return &has_command("netstat") ? 1 : 0;
}
1;

View File

@ -716,5 +716,19 @@ if (&has_command("vmstat")) {
return undef;
}
# has_disk_stats()
# Returns 1 if disk I/O stats are available
sub has_disk_stats
{
return 1;
}
# has_network_stats()
# Returns 1 if network I/O stats are available
sub has_network_stats
{
return 1;
}
1;