| 1 |
|
#!/usr/bin/perl -w |
| 2 |
|
|
| 3 |
+ |
# |
| 4 |
+ |
# i-scream central monitoring system |
| 5 |
+ |
# http://www.i-scream.org.uk |
| 6 |
+ |
# Copyright (C) 2000-2002 i-scream |
| 7 |
+ |
# |
| 8 |
+ |
# This program is free software; you can redistribute it and/or |
| 9 |
+ |
# modify it under the terms of the GNU General Public License |
| 10 |
+ |
# as published by the Free Software Foundation; either version 2 |
| 11 |
+ |
# of the License, or (at your option) any later version. |
| 12 |
+ |
# |
| 13 |
+ |
# This program is distributed in the hope that it will be useful, |
| 14 |
+ |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
+ |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
+ |
# GNU General Public License for more details. |
| 17 |
+ |
# |
| 18 |
+ |
# You should have received a copy of the GNU General Public License |
| 19 |
+ |
# along with this program; if not, write to the Free Software |
| 20 |
+ |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 21 |
+ |
# |
| 22 |
+ |
|
| 23 |
|
#----------------------------------------------------------------- |
| 24 |
|
# i-scream host plugin - top parsing (cpu, proc, mem, & swap) |
| 25 |
|
# $Author$ |
| 52 |
|
} |
| 53 |
|
elsif ($ostype eq "Linux") { |
| 54 |
|
# covers: Debian r2.2 |
| 55 |
< |
$topbin = "/usr/bin/top -d1 -n2 -b -p0"; |
| 55 |
> |
$topbin = "/usr/bin/top -d1 -n2 -b"; |
| 56 |
|
} |
| 57 |
|
elsif ($ostype eq "FreeBSD") { |
| 58 |
|
# covers: FreeBSD 4.X |
| 166 |
|
|
| 167 |
|
# get RAM slightly differently |
| 168 |
|
my($real) = `$sysctlbin -n hw.physmem`; |
| 169 |
< |
my($free) = $real - `$sysctlbin -n hw.usermem`; |
| 169 |
> |
my($v_free_count) = `$sysctlbin -n vm.stats.vm.v_free_count`; |
| 170 |
> |
my($v_page_size) = `$sysctlbin -n vm.stats.vm.v_page_size`; |
| 171 |
> |
my($free) = $v_free_count * $v_page_size; |
| 172 |
|
|
| 173 |
|
# turn bytes to megabytes |
| 174 |
|
$real = ($real / 1024) / 1024; |