[HOWTO] Integrating GroundworkOpenSource and Cacti
Moderators: Developers, Moderators
-
- Posts: 11
- Joined: Thu Oct 19, 2006 9:30 am
[HOWTO] Integrating GroundworkOpenSource and Cacti
For those of you who may care, I have integrated GWOS and Cacti, and written a small step by step guide, included below.
he instructions are specific to my install on SuSE 10.1, so you may need to do some modification for your distribution.
FYI, I have not been able to get php-snmp working yet, when/if I do, I'll post more.
****************BEGIN**************
Install the following packages
smart install mysql
installs mysql,mysql-client,mysql-shared, perl-DBD-mysql, perl-data-show table
(if using smart installer, you may want to remove the download.opensuse.org channel and add mirrors.kernel.org/suse/.... or add the local mirrors from suse.cs.utah.edu )
Configure MySQL:
sudo mysql_install_db
chown -R mysql:mysql /var/lib/mysql/
Scary Part**
as root, "export MYSQL_ROOT=password" (mysqlpass)
**
edit /etc/hosts to look like
127.0.0.1 localhost localhost.localdomain
xxx.xxx.xxx.xxx gwservername gwservername.domain.end
Install GWOS rpm
wget http://groundworkopensource.com/downloa ... 1.i586.rpm
fix libexpat problem before installing rpm...
ln -s /usr/lib/libexpat.so.1.5.0 /usr/lib/libexpat.so.0
rpm -Uvh groundwork-monitor-os-xxx
Set Firewall Appropriately...
___________
Time to install Cacti
download the latest Cacti from www.cacti.net
wget http://www.cacti.net/dolwnloads/cacti-0.8.6i.tar.gz
untar cacti
tar xvfz cacti-0.8.6i.tar.gz
and rename
mv cacti-0.8.6i/ cacti
then move cacti directory to GWOS
mv cacti/ /usr/local/groundwork/cacti
now, cd /usr/local/groundwork/cacti
__
$%@#%$^ Should we install net-snmp?? $^@%&#^*^
Time to create cacti user and group...
Create a new user via yast or useradd named cactiuser (or whatever your cacti user name wants to be)
Make sure to add cactiuser to your nagios, nagioscmd, mysql, and nobody groups.
You will probably want to disable user login... set cactiuser password, make sure to remember it... my default is "cacti" for configuration purposes.
Time to own directories...
Inside your cacti directory:
sudo chown -R cactiuser rra/ log/
cd include
Now edit config.php with your preferred editor. (emacs config.php in my case)
edit the $database variables to fit your preferred installation.
If you've followed my default configuration, you will only need to change the $database_password, which will be the same as your cactiuser password.
save and exit your editor
_
Now to build our DB
from /cacti
#:sudo mysqladmin -u root -p create cacti
#: mysql -u root -p cacti <cacti> grant all on cacti.* to cactiuser@localhost identified by 'yercactiuserpassword';
> grant all on cacti.* to cactiuser;
> grant all on cacti.* to root@localhost;
> grant all on cacti.* to root;
> flush privileges;
> exit
__
Time to cron the poller
There are several ways to do this...
swith to cactiuser
#: su cactiuser
#: crontab -e
insert this line to poll every 5 minutes.. make sure you use proper paths, we want to use GWOS' php binary.
*/5 * * * * /usr/local/groundwork/bin/php /usr/local/groundwork/cacti/poller.php > /dev/nell 2>&1
esc shift-ZZ to exit
__
Now to build Cacti into the GWOS tabs.
Instructions for adding a tab to GWOS can be found at https://wiki.chpc.utah.edu/index.php/Ad ... _Interface
Specific instructions:
mkdir /usr/local/groundwork/guava/packages/cacti
mkdir /usr/local/groundwork/guava/packages/cacti/support
mkdir /usr/local/groundwork/guava/packages/cacti/sysmodules
mkdir /usr/local/groundwork/guava/packages/cacti/views
now we create the package definition
cd /usr/local/groundwork/guava/packages/cacti
emacs package.pkg
create contents appropriately
My package.pkg is as follows:
/* Cacti Package File */
define package {
name = Cacti
shortname = Cacti
description = cacti graphing utility
version_major = 1
version_minor = 0
}
define view {
name = Cacti
description = Cacti Graph Viewer
classname = CactiMainView
file = views/cacti.inc.php
}
___
Now to create the view file:
cd /usr/local/groundwork/guava/packages/cacti/views
emacs cacti.inc.php
Example contents:
*the cacti.net message board edits the php, so make sure and enclose this in php tags without quotes*
class CactiMainView extends View {
function __construct(){
parent::__construct("Cacti");
}
public function init() {
// Empty
}
public function close() {
// Empty
}
public function menuCommand($command) {
// No need to do anything
}
public function refresh () {
// Empty
}
public function render() {
header("Location: http://mywebserver/cacti/");
}
}
____
Now you must set permissions for cacti
chown -R nagios.nagios /usr/local/groundwork/guava/packages/cacti/
chmod -R a+r /usr/local/groundwork/guava/packages/cacti/
Installing cacti into GW
Login to GWOS
Select the Administration tab
Select packages from below the Administration tab
Select Cacti from the main menu
Select Install this package now
Now select the Users link below the Administration tab
Select Administrators from the Roles submenu.
At the bottom of the page click the drop menu "Add View to This Role" and select Cacti, click the "Add View" button
Now logout of GWOS, then log back in. The Cacti tab should now be available.
__
For my apache config (below) to work, you must simlink cacti into the apache2 dir.
#: ln -s /usr/local/groundwork/cacti /usr/local/groundwork/apache2/htdocs/cacti
Now for apache configuration... I am not an apache guru, so this is a hackaround...
edit your httpd.conf from /usr/local/groundwork/apache2/conf/httpd.conf
add index.php to your DirectoryIndex list
below the monitor/ alias directory add
Alias /cacti/ "/usr/local/groundwork/apache2/htdocs/cacti/"
<Directory>
Options Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
restart apache now
#: /usr/local/groundwork/apache2/bin/apachectl restart
Now go back to GWOS and click the Cacti tab. You should see an index of the cacti directory. Click the install dir link and then the index.php link. You will be prompted through new installation, make sure and set your binary paths to those in the GWOS directory. i.e. /usr/local/groundwork/bin/rrdtool
At this point I had a permission problem, probably due to the simlink above... if you followed my instructions, you will need to do this to fix the problem.
#: chown -R nagios.nagios /usr/local/groundwork/cacti
#: cd /usr/local/groundwork/cacti
#: chown -R cactiuser.users rra/ log/
Restart apache, reload the GW page, and Presto, the Cacti tab should bring you directly to the Cacti login screen.
Let me know if you have problems. It's well within the bounds of probable that I made a mistake.
Jeff
The Forum won't write the cacti Alias directory, so here you go...
after the Alias /cacti/ line, in the Directory <> add "/usr/local/groundwork/apache2/cacti"
he instructions are specific to my install on SuSE 10.1, so you may need to do some modification for your distribution.
FYI, I have not been able to get php-snmp working yet, when/if I do, I'll post more.
****************BEGIN**************
Install the following packages
smart install mysql
installs mysql,mysql-client,mysql-shared, perl-DBD-mysql, perl-data-show table
(if using smart installer, you may want to remove the download.opensuse.org channel and add mirrors.kernel.org/suse/.... or add the local mirrors from suse.cs.utah.edu )
Configure MySQL:
sudo mysql_install_db
chown -R mysql:mysql /var/lib/mysql/
Scary Part**
as root, "export MYSQL_ROOT=password" (mysqlpass)
**
edit /etc/hosts to look like
127.0.0.1 localhost localhost.localdomain
xxx.xxx.xxx.xxx gwservername gwservername.domain.end
Install GWOS rpm
wget http://groundworkopensource.com/downloa ... 1.i586.rpm
fix libexpat problem before installing rpm...
ln -s /usr/lib/libexpat.so.1.5.0 /usr/lib/libexpat.so.0
rpm -Uvh groundwork-monitor-os-xxx
Set Firewall Appropriately...
___________
Time to install Cacti
download the latest Cacti from www.cacti.net
wget http://www.cacti.net/dolwnloads/cacti-0.8.6i.tar.gz
untar cacti
tar xvfz cacti-0.8.6i.tar.gz
and rename
mv cacti-0.8.6i/ cacti
then move cacti directory to GWOS
mv cacti/ /usr/local/groundwork/cacti
now, cd /usr/local/groundwork/cacti
__
$%@#%$^ Should we install net-snmp?? $^@%&#^*^
Time to create cacti user and group...
Create a new user via yast or useradd named cactiuser (or whatever your cacti user name wants to be)
Make sure to add cactiuser to your nagios, nagioscmd, mysql, and nobody groups.
You will probably want to disable user login... set cactiuser password, make sure to remember it... my default is "cacti" for configuration purposes.
Time to own directories...
Inside your cacti directory:
sudo chown -R cactiuser rra/ log/
cd include
Now edit config.php with your preferred editor. (emacs config.php in my case)
edit the $database variables to fit your preferred installation.
If you've followed my default configuration, you will only need to change the $database_password, which will be the same as your cactiuser password.
save and exit your editor
_
Now to build our DB
from /cacti
#:sudo mysqladmin -u root -p create cacti
#: mysql -u root -p cacti <cacti> grant all on cacti.* to cactiuser@localhost identified by 'yercactiuserpassword';
> grant all on cacti.* to cactiuser;
> grant all on cacti.* to root@localhost;
> grant all on cacti.* to root;
> flush privileges;
> exit
__
Time to cron the poller
There are several ways to do this...
swith to cactiuser
#: su cactiuser
#: crontab -e
insert this line to poll every 5 minutes.. make sure you use proper paths, we want to use GWOS' php binary.
*/5 * * * * /usr/local/groundwork/bin/php /usr/local/groundwork/cacti/poller.php > /dev/nell 2>&1
esc shift-ZZ to exit
__
Now to build Cacti into the GWOS tabs.
Instructions for adding a tab to GWOS can be found at https://wiki.chpc.utah.edu/index.php/Ad ... _Interface
Specific instructions:
mkdir /usr/local/groundwork/guava/packages/cacti
mkdir /usr/local/groundwork/guava/packages/cacti/support
mkdir /usr/local/groundwork/guava/packages/cacti/sysmodules
mkdir /usr/local/groundwork/guava/packages/cacti/views
now we create the package definition
cd /usr/local/groundwork/guava/packages/cacti
emacs package.pkg
create contents appropriately
My package.pkg is as follows:
/* Cacti Package File */
define package {
name = Cacti
shortname = Cacti
description = cacti graphing utility
version_major = 1
version_minor = 0
}
define view {
name = Cacti
description = Cacti Graph Viewer
classname = CactiMainView
file = views/cacti.inc.php
}
___
Now to create the view file:
cd /usr/local/groundwork/guava/packages/cacti/views
emacs cacti.inc.php
Example contents:
*the cacti.net message board edits the php, so make sure and enclose this in php tags without quotes*
class CactiMainView extends View {
function __construct(){
parent::__construct("Cacti");
}
public function init() {
// Empty
}
public function close() {
// Empty
}
public function menuCommand($command) {
// No need to do anything
}
public function refresh () {
// Empty
}
public function render() {
header("Location: http://mywebserver/cacti/");
}
}
____
Now you must set permissions for cacti
chown -R nagios.nagios /usr/local/groundwork/guava/packages/cacti/
chmod -R a+r /usr/local/groundwork/guava/packages/cacti/
Installing cacti into GW
Login to GWOS
Select the Administration tab
Select packages from below the Administration tab
Select Cacti from the main menu
Select Install this package now
Now select the Users link below the Administration tab
Select Administrators from the Roles submenu.
At the bottom of the page click the drop menu "Add View to This Role" and select Cacti, click the "Add View" button
Now logout of GWOS, then log back in. The Cacti tab should now be available.
__
For my apache config (below) to work, you must simlink cacti into the apache2 dir.
#: ln -s /usr/local/groundwork/cacti /usr/local/groundwork/apache2/htdocs/cacti
Now for apache configuration... I am not an apache guru, so this is a hackaround...
edit your httpd.conf from /usr/local/groundwork/apache2/conf/httpd.conf
add index.php to your DirectoryIndex list
below the monitor/ alias directory add
Alias /cacti/ "/usr/local/groundwork/apache2/htdocs/cacti/"
<Directory>
Options Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
restart apache now
#: /usr/local/groundwork/apache2/bin/apachectl restart
Now go back to GWOS and click the Cacti tab. You should see an index of the cacti directory. Click the install dir link and then the index.php link. You will be prompted through new installation, make sure and set your binary paths to those in the GWOS directory. i.e. /usr/local/groundwork/bin/rrdtool
At this point I had a permission problem, probably due to the simlink above... if you followed my instructions, you will need to do this to fix the problem.
#: chown -R nagios.nagios /usr/local/groundwork/cacti
#: cd /usr/local/groundwork/cacti
#: chown -R cactiuser.users rra/ log/
Restart apache, reload the GW page, and Presto, the Cacti tab should bring you directly to the Cacti login screen.
Let me know if you have problems. It's well within the bounds of probable that I made a mistake.
Jeff
The Forum won't write the cacti Alias directory, so here you go...
after the Alias /cacti/ line, in the Directory <> add "/usr/local/groundwork/apache2/cacti"
Last edited by dudemanxtreme on Mon Oct 30, 2006 8:31 am, edited 1 time in total.
- rony
- Developer/Forum Admin
- Posts: 6022
- Joined: Mon Nov 17, 2003 6:35 pm
- Location: Michigan, USA
- Contact:
FYI, Goundwork Open Source has intergration in their commercial product.
Last edited by rony on Fri Oct 20, 2006 9:06 am, edited 1 time in total.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
-
- Posts: 11
- Joined: Thu Oct 19, 2006 9:30 am
Alas, paying for it is well out of small shop capabilities....
So... to make v4.5 GWOS/Cacti solution work without upgrading cacti's rrdtool package, run through my instructions, then comment out or delete the following lines from cacti/lib/rrd.php:
/* rrdtool 1.2.x does not provide smooth lines, let's force it */
if (read_config_option("rrdtool_version") == "rrd-1.2.x") {
$graph_opts .= "--slope-mode" . RRD_NL;
}
Presto, everything works.
So... to make v4.5 GWOS/Cacti solution work without upgrading cacti's rrdtool package, run through my instructions, then comment out or delete the following lines from cacti/lib/rrd.php:
/* rrdtool 1.2.x does not provide smooth lines, let's force it */
if (read_config_option("rrdtool_version") == "rrd-1.2.x") {
$graph_opts .= "--slope-mode" . RRD_NL;
}
Presto, everything works.
oooh, oooh.... I am definately going to try this! too cool.
I will try and set it up on my test cacti server, if successful, I will post the details on how to add it to a CactiEZ (CentOS based) install
I will try and set it up on my test cacti server, if successful, I will post the details on how to add it to a CactiEZ (CentOS based) install
Cacti1 OS: CentOS 5.6 | 300+ devices
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey
oops, I made a mess!!! Fortunately, the cacti part was unphased, just some ugliness from apache.
No success as of yet, but here is a helpful link if anyone is wanting to venture down this road....
http://groundworkopensource.com/communi ... .php?t=352
It looks like it is fairly straightforward to install on a new Cacti install, or at least a server that is not running any critical mysql apps, but fitting it into an existing install is another story.
"Kids, don't try this at home"
No success as of yet, but here is a helpful link if anyone is wanting to venture down this road....
http://groundworkopensource.com/communi ... .php?t=352
It looks like it is fairly straightforward to install on a new Cacti install, or at least a server that is not running any critical mysql apps, but fitting it into an existing install is another story.
"Kids, don't try this at home"
Cacti1 OS: CentOS 5.6 | 300+ devices
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey
- rony
- Developer/Forum Admin
- Posts: 6022
- Joined: Mon Nov 17, 2003 6:35 pm
- Location: Michigan, USA
- Contact:
Um.... NO....dudemanxtreme wrote:Alas, paying for it is well out of small shop capabilities....
So... to make v4.5 GWOS/Cacti solution work without upgrading cacti's rrdtool package, run through my instructions, then comment out or delete the following lines from cacti/lib/rrd.php:
/* rrdtool 1.2.x does not provide smooth lines, let's force it */
if (read_config_option("rrdtool_version") == "rrd-1.2.x") {
$graph_opts .= "--slope-mode" . RRD_NL;
}
Presto, everything works.
Go into Cacti Settings and tell it you are using RRDTool 1.0.x.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
-
- Posts: 11
- Joined: Thu Oct 19, 2006 9:30 am
um, still NO
Specifiying 1.0.x did not graph either!!! Only commenting out the slope mode stuff worked. I've now done this on SuSE 10, 10.1, slackware 10.2, 11, and Fedora Core 5.
Odd.
Odd.
- rony
- Developer/Forum Admin
- Posts: 6022
- Joined: Mon Nov 17, 2003 6:35 pm
- Location: Michigan, USA
- Contact:
What is your rrdtool version?
Slope mode was not introduced until rrdtool 1.2.5, I would suggest you upgrade rrdtool.
Slope mode was not introduced until rrdtool 1.2.5, I would suggest you upgrade rrdtool.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
-
- Posts: 11
- Joined: Thu Oct 19, 2006 9:30 am
Rony, I've not had any luck upgrading rrdtool w/ gwos's libraries, I'm just not quite that saavy yet unfortunately, though if anyone can help me out with it, that would be awesome!!!
I'm attaching a screenshot of my integrated view, FYI.
I'm attaching a screenshot of my integrated view, FYI.
- Attachments
-
- GWOS and Cacti integration
- snapshot1.png (112.36 KiB) Viewed 25767 times
Re: um, still NO
I would like to see how you did the fedora install. Also, are you doing this on existing Cacti installs? or just starting fresh?dudemanxtreme wrote:Specifiying 1.0.x did not graph either!!! Only commenting out the slope mode stuff worked. I've now done this on SuSE 10, 10.1, slackware 10.2, 11, and Fedora Core 5.
Odd.
Cacti1 OS: CentOS 5.6 | 300+ devices
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey
-
- Posts: 11
- Joined: Thu Oct 19, 2006 9:30 am
Continuing down this route, no longer comment out the above slope mode lines... instead it's time to upgrade rrdtool.
Download the latest rrdtool
Untar it, and cd into the rrdtool-x.x.x. directory.
In your BASH shell type
BUILD_DIR=/usr/local/groundwork
then
INSTALL_DIR=/usr/local/groundwork
then
IR=-I$BUILD_DIR/include
CPPFLAGS="$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng"
LDFLAGS="-L$BUILD_DIR/lib"
CFLAGS=-O3
export CPPFLAGS LDFLAGS CFLAG
then it's time to configure...
./configure --prefix=$INSTALL_DIR --disable-python --disable-tcl
make clean
make
make install
Now you're done! I suggest going to /usr/local/groundwork/bin and run rrdtool -v just to make sure it updated correctly.
If you already commented out lines in rrd.php, you can uncomment them, then you should probably restart apache.
BIG THANKS to LVM! Thank you very much.
Download the latest rrdtool
Untar it, and cd into the rrdtool-x.x.x. directory.
In your BASH shell type
BUILD_DIR=/usr/local/groundwork
then
INSTALL_DIR=/usr/local/groundwork
then
IR=-I$BUILD_DIR/include
CPPFLAGS="$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng"
LDFLAGS="-L$BUILD_DIR/lib"
CFLAGS=-O3
export CPPFLAGS LDFLAGS CFLAG
then it's time to configure...
./configure --prefix=$INSTALL_DIR --disable-python --disable-tcl
make clean
make
make install
Now you're done! I suggest going to /usr/local/groundwork/bin and run rrdtool -v just to make sure it updated correctly.
If you already commented out lines in rrd.php, you can uncomment them, then you should probably restart apache.
BIG THANKS to LVM! Thank you very much.
View file example
First of, I would like to thank you for sharing your method of integration of Cacti with GroundWorks.
(: However I have not been able to get it running, for there is no content of the View file in your instructions. I have followed the adding tab to Guava part and it did not work either...
Would you be so kind to share your view file, please?
Thank you in advance!
-
- Posts: 11
- Joined: Thu Oct 19, 2006 9:30 am
Who is online
Users browsing this forum: No registered users and 1 guest