b74824bd91
information to create graphs and populates them with data in a MySQL database. The frontend is completely PHP driven. Along with being able to maintain Graphs, Data Sources, and Round Robin Archives in a database, cacti handles the data gathering also. There is also SNMP support for those used to creating traffic graphs with MRTG. The Plugin Architecture for Cacti was designed to be both simple in nature and robust enough to allow freedom to do almost anything in Cacti. The Plugin Architecture for Cacti is integrated into this package. (created from wip/cacti by pettai)
23 lines
453 B
Perl
23 lines
453 B
Perl
#!/usr/bin/perl
|
|
|
|
if (($ARGV[0] =~ /Cached:/) || ($ARGV[0] =~ /SwapFree:/)) {
|
|
open(PROCESS, "pstat -ks |");
|
|
$s = 0;
|
|
while (<PROCESS>) {
|
|
if (!/^Device/) {
|
|
split();
|
|
$s += $_[3];
|
|
}
|
|
}
|
|
print "$s";
|
|
}
|
|
else { # $ARGV[0] is Buffers:, MemFree:, or anything else
|
|
open(PROCESS, "vmstat -H |");
|
|
while (<PROCESS>) {
|
|
if (!/p/) { # the numbers line happens not to have "p"
|
|
split();
|
|
print("$_[4]");
|
|
}
|
|
}
|
|
}
|
|
close(PROCESS);
|