Hi,
I have seen some postings about converted scripts and installation hints for FreeBSD. Have anyone gatherd this in one place and done some kind of HOWTO? I've tried to get CACTI running on FreeBSD for a cuple of days now, but have'nt had any luck yet. Can't seem to get cmd.php and related scripts to work (only as root - no data in the graphs thou). Problems with SNMP allso. I am a *nix newbie and are using MRTG currently. CACTI looks very nice and I'd like to convert to it as soon as possible.
Second question:
Does CACTI work like this...
Cmd.php reads information about what data and how to gather it in the MySQL DB and then gather it and puts it in the rrd-files.
Then when a user visits the CACTI webserver PHP reads the rrd-files and graphs it?
Help/Hints about installation on FreeBSD much apreciated.
TIA Lasse
Cacti 0.6.8 on FreeBSD
Moderators: Developers, Moderators
I haven't played with this much but it's my understanding that you need the Linux compat. stuff installed in BSD for those to work.
Regarding the second question - you're correct except for one detail. PHP doesn't generate the graphs. PHP generates the command line that calls the rrdtool executable to create the graph.
Hope that helps.
Rob.
Regarding the second question - you're correct except for one detail. PHP doesn't generate the graphs. PHP generates the command line that calls the rrdtool executable to create the graph.
Hope that helps.
Rob.
This last answer is inaccurate. Linux compat on FreeBSD is for running Linux binaries.
PHP scripts are text files, including cmd.php. Your problem may be, if you installed PHP via /usr/ports, that you didn't build PHP as a standalone cgi app. I built PHP as both an Apache mod and a standalone like so:
1) Install /usr/ports/www/mod_php4 like normal: # make install clean
2) Having done the clean above, remake it as a standalone via: make PORTNAME=php4_standalone -DSTANDALONE install
This creates a second installed package (Ports, once they're installed are effecitvely a package, and likewise a package is nothing more than a Port that a 'make package' has been done on) called php4_standalone-4.X.Y and you'll see both if you do 'pkg_info | grep php4". Thus there is no conflict between the Apache module and your PHP standalone cgi.
If your problem is elsewhere then it's a PEBKAC. There is nothing Linux specific about either rrdtool or cacti.
This response is several months late, but is posted so others can find it.
PHP scripts are text files, including cmd.php. Your problem may be, if you installed PHP via /usr/ports, that you didn't build PHP as a standalone cgi app. I built PHP as both an Apache mod and a standalone like so:
1) Install /usr/ports/www/mod_php4 like normal: # make install clean
2) Having done the clean above, remake it as a standalone via: make PORTNAME=php4_standalone -DSTANDALONE install
This creates a second installed package (Ports, once they're installed are effecitvely a package, and likewise a package is nothing more than a Port that a 'make package' has been done on) called php4_standalone-4.X.Y and you'll see both if you do 'pkg_info | grep php4". Thus there is no conflict between the Apache module and your PHP standalone cgi.
If your problem is elsewhere then it's a PEBKAC. There is nothing Linux specific about either rrdtool or cacti.
This response is several months late, but is posted so others can find it.
I beg to differ
Allow me to clarify as the post is not inaccurate, you just misunderstood it.
My post above was referring to the info in /proc that the scripts called by cmd.php use to collect data. As BSD doesn't have as complete a /proc as Linux does, you need to be running the Linux compat for several of the stock data-collection modules to pull accurate data.
I wasn't speaking about PHP working, I was referring to the scripts included w/ Cacti.
Rob.
My post above was referring to the info in /proc that the scripts called by cmd.php use to collect data. As BSD doesn't have as complete a /proc as Linux does, you need to be running the Linux compat for several of the stock data-collection modules to pull accurate data.
I wasn't speaking about PHP working, I was referring to the scripts included w/ Cacti.
Rob.
Here's some FreeBSD compat script changes... not perfect, but you get the idea.
[scrips/ping.pl]
#!/usr/bin/perl
## dropped the second arg and '-w'. hard coded '1' count.
$ping = `ping -c 1 $ARGV[0] |grep icmp_seq`;
$ping =~ s/(.*time=)(.*) (ms|usec)//;
print $2;
[scripts/memfree.pl]
#!/usr/bin/perl
## uses top in batch mode instead.
## valid args are: 'Active', 'Inact', 'Wired', 'Cache', 'Buf', 'Free'
## linux compat just seemed too expensive to me
## i think vmstat could work here too.
$mem = `top -b | grep -w "Mem:"`;
$mem =~ s/(.* )(.*[0-9])(K|M)( $ARGV[0])//;
print $2;
[scripts/tcp.pl]
#!/usr/bin/perl
## replaced ':' w/ 'p4'
#gets inbound and outbound tcp connections
if ($ARGV[0] eq "tcp") {
$conn = `netstat -n | grep -c \"p4\"`;
chomp $conn;
}else{
$conn = `netstat -na | grep -c LISTEN`;
}
$conn =~ s/ //;
print $conn;
Chainey
[scrips/ping.pl]
#!/usr/bin/perl
## dropped the second arg and '-w'. hard coded '1' count.
$ping = `ping -c 1 $ARGV[0] |grep icmp_seq`;
$ping =~ s/(.*time=)(.*) (ms|usec)//;
print $2;
[scripts/memfree.pl]
#!/usr/bin/perl
## uses top in batch mode instead.
## valid args are: 'Active', 'Inact', 'Wired', 'Cache', 'Buf', 'Free'
## linux compat just seemed too expensive to me
## i think vmstat could work here too.
$mem = `top -b | grep -w "Mem:"`;
$mem =~ s/(.* )(.*[0-9])(K|M)( $ARGV[0])//;
print $2;
[scripts/tcp.pl]
#!/usr/bin/perl
## replaced ':' w/ 'p4'
#gets inbound and outbound tcp connections
if ($ARGV[0] eq "tcp") {
$conn = `netstat -n | grep -c \"p4\"`;
chomp $conn;
}else{
$conn = `netstat -na | grep -c LISTEN`;
}
$conn =~ s/ //;
print $conn;
Chainey
I had a little bit of trouble with sql.php returning data properly for rrdtool update. Not sure what was causing the problem, but I rewrote sql.php which seemed to take care of it.
(FreeBSD 4.6.1, mysql-server-3.23.51, mod_php4-4.2.1_2, php4-4.2.3)
[scripts/sql.php]
<?
$do_not_read_config = true;
include ("../include/config.php");
if ($database_password == "") {
exec("/usr/local/bin/mysqladmin -h$database_hostname -u$database_username status", $sql);
}else{
exec("/usr/local/bin/mysqladmin -h$database_hostname -u$database_username -p$database_password status", $sql);
$pat = " ";
foreach($sql as $element) {
$arr = split($pat, $element);
}
}
print $arr[7];
?>
Chainey
(FreeBSD 4.6.1, mysql-server-3.23.51, mod_php4-4.2.1_2, php4-4.2.3)
[scripts/sql.php]
<?
$do_not_read_config = true;
include ("../include/config.php");
if ($database_password == "") {
exec("/usr/local/bin/mysqladmin -h$database_hostname -u$database_username status", $sql);
}else{
exec("/usr/local/bin/mysqladmin -h$database_hostname -u$database_username -p$database_password status", $sql);
$pat = " ";
foreach($sql as $element) {
$arr = split($pat, $element);
}
}
print $arr[7];
?>
Chainey
Who is online
Users browsing this forum: No registered users and 0 guests