Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


[HOWTO] Integrating GroundworkOpenSource and Cacti
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Informational/HOWTO's
Author Message
dudemanxtreme



Joined: 19 Oct 2006
Posts: 11

PostPosted: Thu Oct 19, 2006 9:32 am    Post subject: [HOWTO] Integrating GroundworkOpenSource and Cacti Reply with quote

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/downloads/files/groundwork-monitor-os-4.5-11.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/Adding_Tabs_to_the_Groundwork_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
Back to top
rony
Developer/Forum Admin


Joined: 17 Nov 2003
Posts: 5694
Location: Michigan, USA

PostPosted: Thu Oct 19, 2006 10:05 am    Post subject: Reply with quote

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
Back to top
dudemanxtreme



Joined: 19 Oct 2006
Posts: 11

PostPosted: Thu Oct 19, 2006 11:15 pm    Post subject: Reply with quote

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.
Back to top
egarnel
Cacti Pro User


Joined: 21 Nov 2002
Posts: 679
Location: Austin, TX

PostPosted: Fri Oct 20, 2006 7:18 am    Post subject: Reply with quote

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
Back to top
egarnel
Cacti Pro User


Joined: 21 Nov 2002
Posts: 679
Location: Austin, TX

PostPosted: Fri Oct 20, 2006 8:40 am    Post subject: Reply with quote

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"
Back to top
rony
Developer/Forum Admin


Joined: 17 Nov 2003
Posts: 5694
Location: Michigan, USA

PostPosted: Fri Oct 20, 2006 9:07 am    Post subject: Reply with quote

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.
Back to top
dudemanxtreme



Joined: 19 Oct 2006
Posts: 11

PostPosted: Sat Oct 21, 2006 9:52 pm    Post subject: um, still NO Reply with quote

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.
Back to top
sizulku
Cacti User


Joined: 04 Nov 2002
Posts: 110
Location: ACEH

PostPosted: Sun Oct 22, 2006 2:21 am    Post subject: Reply with quote

any screenshot after this integration?
Back to top
rony
Developer/Forum Admin


Joined: 17 Nov 2003
Posts: 5694
Location: Michigan, USA

PostPosted: Sun Oct 22, 2006 1:07 pm    Post subject: Reply with quote

What is your rrdtool version?

Slope mode was not introduced until rrdtool 1.2.5, I would suggest you upgrade rrdtool.
Back to top
dudemanxtreme



Joined: 19 Oct 2006
Posts: 11

PostPosted: Mon Oct 23, 2006 7:45 am    Post subject: Reply with quote

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.



snapshot1.png
 Description:
GWOS and Cacti integration
 Filesize:  112.36 KB
 Viewed:  17039 Time(s)

snapshot1.png


Back to top
egarnel
Cacti Pro User


Joined: 21 Nov 2002
Posts: 679
Location: Austin, TX

PostPosted: Mon Oct 23, 2006 8:27 am    Post subject: Re: um, still NO Reply with quote

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?
Back to top
dudemanxtreme



Joined: 19 Oct 2006
Posts: 11

PostPosted: Mon Oct 23, 2006 9:20 am    Post subject: Reply with quote

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.
Back to top
starvoise



Joined: 29 Oct 2006
Posts: 3

PostPosted: Sun Oct 29, 2006 12:00 pm    Post subject: View file example Reply with quote



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!
Back to top
dudemanxtreme



Joined: 19 Oct 2006
Posts: 11

PostPosted: Mon Oct 30, 2006 8:32 am    Post subject: Reply with quote

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.
Back to top
starvoise



Joined: 29 Oct 2006
Posts: 3

PostPosted: Wed Nov 01, 2006 9:29 pm    Post subject: Reply with quote

Thanks you very much for your help! I will try this on my production server this weekend.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Informational/HOWTO's All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 



Powered by phpBB © 2001, 2005 phpBB Group