Cacti -- How to get Collection/Polling Started ?

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
AhLek
Posts: 13
Joined: Fri Oct 14, 2005 4:21 pm

Cacti -- How to get Collection/Polling Started ?

Post by AhLek »

Hi,
I am very new to Cacti -- just managed to get that installed and configured on a SUN Aparc Solaris 8.

I have also read the User's manual, not throughly I msut admit.

With that, I have created Users, added devices, and configure new graphs for the devices. Those are all done from the Console Menu.

My Questions are:
-- how I get collection of data started.
I cannot see any thing I can run from the "Console" menu to do that.

-- Also, when setting up a graph, can I have more than 1 metric ?
Thank you in advance for any assistance.
Regards
AhLek
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Data polling is done via crontab (at least for unix flavour of OSses). The docs at http://www.cacti.net/downloads/docs/htm ... _unix.html describe in step 7 how to do that.
If you have installed from rpm, please have a look at /etc/cron.d/cacti. If this file exists, you may wish to take it instead of /etc/crontab. Please take only one!
You may run the command at cli to have a look, whether it's running fine. Polling output is logged typically at <path_cacti>/log/cacti.log, though you may configure this entry freely.
Reinhard
AhLek
Posts: 13
Joined: Fri Oct 14, 2005 4:21 pm

Post by AhLek »

Ivm,
thank you for responding.
I looked at the doc you pointed you.

This is the Step I found that is most apt.
+++++++++++++++
7. Add a line to your /etc/crontab file similar to:

*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1

Replace cactiuser with the valid user specified in the previous step.

Replace /var/www/html/cacti/ with your full Cacti path.
-----------------------------

I am running on a SUN Solaris 8 system. That crontab entry do not look syntaxically good.

If I want to run the poller every 5 minutes, and the user i s"nsm" how can I code the crontab entry ?

Thank you
AhLek
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Sorry, not a Solaris guy. Please try man crontab
Reinhard
AhLek
Posts: 13
Joined: Fri Oct 14, 2005 4:21 pm

Post by AhLek »

Hi,
I know how a Solaris crontab entry should be.

What I am not clear is:
Does that Step 7. just want me to run 'php fullpath-poller.php' every 5 minutes ?

-- using poller.php's full pathname and when logged in as user "nsm".
My system do not have a UNIX accounjt call "cactiuser".
In my configs -- I used user nsm.

This is what I tried ran:
0,5,10,,15,20,35,40,45,50,55 * * * * * php
/usr/local/home/nsm/.profile-cacti/poller.php

That cron job was ran by user "nsm".
-- instead of cacti user, I am using "nsm"

In poller.php, there are two statements to run the db_execute commands.
The first one is:

/* Update web paths for the poller */
db_execute("replace into settings (name,value) values ('path_webroot','" . addsl
ashes(($config["cacti_server_os"] == "win32") ? strtolower(substr(dirname(__FILE
__), 0, 1)) . substr(dirname(__FILE__), 1) : dirname(__FILE__)) . "')");

ran fine.

The 2nd db_execute statement in poller.php
db_execute("replace into settings (name,value) values ('date',NOW())");

-- spits out the following error message:
sh: /usr/local/home/nsm/Root/php-5.0.4/usr/local/php/bin: cannot execute


Any ideas ?
Q: what is the statement:
"db_execute("replace into settings (name,value) values ('date',NOW())");"
trying to do ?

Q: what is the syntax of db_query command ?

Thanks again
AhLek
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

AhLek wrote:What I am not clear is:
Does that Step 7. just want me to run 'php fullpath-poller.php' every 5 minutes ?

-- using poller.php's full pathname and when logged in as user "nsm".
My system do not have a UNIX accounjt call "cactiuser".
In my configs -- I used user nsm.

This is what I tried ran:
0,5,10,,15,20,35,40,45,50,55 * * * * * php
/usr/local/home/nsm/.profile-cacti/poller.php
Yes, crontab must run poller.php every 5 min (what about the double comma at "10,,15"?). It should pipe the output either to /dev/null or to <patch_cacti>/log/poller.log (I prefer the last one to keep track of the output of the last polling cycle).
It is recommended to define a specific userid for cacti, e.g. for security reasons. It is not a must AFAIK. Then you have to pay attention to the ownership of <patch_cacti/log and .../rra accordingly as describe in the docs.
As to the rest of your last post, sorry, I can't help
Reinhard
AhLek
Posts: 13
Joined: Fri Oct 14, 2005 4:21 pm

Post by AhLek »

Oops,
yup there is too many ".." in the entry.Should be
0,5,10,15,20,25,30,35,40,45,50,55 * * * * php ....

My problem is not the crontab entry syntax.

It is the db_execute statements and php that I am not familiar.

Can someone please assist ?
Thanks
AhLek
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
AhLek
Posts: 13
Joined: Fri Oct 14, 2005 4:21 pm

Post by AhLek »

Hi Witness,
I actually have read that linnk. Thanks anyway.
Also, I put the execution ogf the poller in a wrapper; this is to ensure I have all the the correct environment vaqriables ( like LD_LIBRARY_PATH ) set up.

Here's the wrapper:
++ ++++++++++
#!/bin/sh
. /usr/local/home/nsm/.profile-cacti
fnmLog=$ALC_CACTI/log/poller.log

ECHO() { echo "$*" >> $fnmLog ; }
ECHO "Poller started at `date`"
ECHO " Poller pathname is: \"$ALC_CACTI/poller.php\""
ECHO " Log filename, fnmLog = \"$fnmLog\""

$ALC_PHP/php/bin/php $ALC_CACTI/poller.php >>$ALC_CACTI/log/poller.log 2>&1
------------------

As I have previously mentioned, my problem is with the db_execute statements in the poller.php script.

The following statement works fine:
+++++++++

/* Update web paths for the poller */
db_execute("replace into settings (name,value) values ('path_webroot','" . addsl
ashes(($config["cacti_server_os"] == "win32") ? strtolower(substr(dirname(__FILE
__), 0, 1)) . substr(dirname(__FILE__), 1) : dirname(__FILE__)) . "')");

-----------------

However this db_execute statement fails:
++++++++++++++
/* insert the current date/time for graphs */
db_execute("replace into settings (name,value) values ('date',NOW())");
------------------------
The error message displyed by the above command is:
sh: /usr/local/home/nsm/Root/php-5.0.4/usr/local/php/bin: cannot execute


I have read most I can on Cacti, mysql and php -- just cannot figure out wht that db_execute command do not work.

Any assistance will be appreciated.

ps: I actually ran that wrapper manually with same results.

Thanks
AhLek
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

I enjoy your enthusiasm, but please post your question in only one place. You have posted this basic question 3 times.

Also, for us to help you, please post the errors you are getting, not an analisys of the code lines that are causing the errors.
[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]
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests