Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Sun Apr 23, 2017 6:56 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: [HOWTO] Integrating GroundworkOpenSource and Cacti
PostPosted: Thu Oct 19, 2006 9:32 am 
Offline

Joined: Thu Oct 19, 2006 9:30 am
Posts: 11
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"


Last edited by dudemanxtreme on Mon Oct 30, 2006 8:31 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 19, 2006 10:05 am 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 5941
Location: Michigan, USA
FYI, Goundwork Open Source has intergration in their commercial product.

_________________
Tony Roman
Experience is what causes a person to make new mistakes instead of old ones.
There are only 3 way to complete a project: Good, Fast or Cheap, pick two.
With age comes wisdom, what you choose to do with it determines whether or not you are wise.


Last edited by rony on Fri Oct 20, 2006 9:06 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 19, 2006 11:15 pm 
Offline

Joined: Thu Oct 19, 2006 9:30 am
Posts: 11
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.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 20, 2006 7:18 am 
Offline
Cacti Pro User
User avatar

Joined: Thu Nov 21, 2002 8:55 am
Posts: 703
Location: Austin, TX
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

_________________
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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 20, 2006 8:40 am 
Offline
Cacti Pro User
User avatar

Joined: Thu Nov 21, 2002 8:55 am
Posts: 703
Location: Austin, TX
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/community/forums/viewtopic.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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 20, 2006 9:07 am 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 5941
Location: Michigan, USA
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.


Um.... NO....

Go into Cacti Settings and tell it you are using RRDTool 1.0.x.

_________________
Tony Roman
Experience is what causes a person to make new mistakes instead of old ones.
There are only 3 way to complete a project: Good, Fast or Cheap, pick two.
With age comes wisdom, what you choose to do with it determines whether or not you are wise.


Top
 Profile  
 
 Post subject: um, still NO
PostPosted: Sat Oct 21, 2006 9:52 pm 
Offline

Joined: Thu Oct 19, 2006 9:30 am
Posts: 11
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.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 22, 2006 2:21 am 
Offline
Cacti User
User avatar

Joined: Mon Nov 04, 2002 9:15 am
Posts: 110
Location: ACEH
any screenshot after this integration?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 22, 2006 1:07 pm 
Offline
Developer/Forum Admin
User avatar

Joined: Mon Nov 17, 2003 6:35 pm
Posts: 5941
Location: Michigan, USA
What is your rrdtool version?

Slope mode was not introduced until rrdtool 1.2.5, I would suggest you upgrade rrdtool.

_________________
Tony Roman
Experience is what causes a person to make new mistakes instead of old ones.
There are only 3 way to complete a project: Good, Fast or Cheap, pick two.
With age comes wisdom, what you choose to do with it determines whether or not you are wise.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 23, 2006 7:45 am 
Offline

Joined: Thu Oct 19, 2006 9:30 am
Posts: 11
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.


Attachments:
File comment: GWOS and Cacti integration
snapshot1.png
snapshot1.png [ 112.36 KiB | Viewed 22982 times ]
Top
 Profile  
 
 Post subject: Re: um, still NO
PostPosted: Mon Oct 23, 2006 8:27 am 
Offline
Cacti Pro User
User avatar

Joined: Thu Nov 21, 2002 8:55 am
Posts: 703
Location: Austin, TX
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.


I would like to see how you did the fedora install. Also, are you doing this on existing Cacti installs? or just starting fresh?

_________________
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 23, 2006 9:20 am 
Offline

Joined: Thu Oct 19, 2006 9:30 am
Posts: 11
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.


Top
 Profile  
 
 Post subject: View file example
PostPosted: Sun Oct 29, 2006 12:00 pm 
Offline

Joined: Sun Oct 29, 2006 11:55 am
Posts: 3
:D :D :D

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!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 30, 2006 8:32 am 
Offline

Joined: Thu Oct 19, 2006 9:30 am
Posts: 11
starvoise,

Thanks for being patient, I did get your messages/IM, but only this morning. I have updated the instructions, unfortunately the board truncates lots of code, so make sure and use proper tags when you create your view file.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 01, 2006 9:29 pm 
Offline

Joined: Sun Oct 29, 2006 11:55 am
Posts: 3
:D Thanks you very much for your help! I will try this on my production server this weekend.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group