Cacti Polling Host

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

c3226026
Cacti User
Posts: 87
Joined: Mon Jan 17, 2011 12:15 pm

Re: Cacti Polling Host

Post by c3226026 »

To delete thanks
CanDee
Posts: 11
Joined: Wed Jul 23, 2008 12:47 am

Re: Cacti Polling Host

Post by CanDee »

php /var/www/cacti-0.8.7g/scripts/cacti_user_stats.php
valid:0 invalid:0 active:U sleeping:U garbage:U uactive:U usleeping:U

this is what i get while i'am logged in.

why are there Results "U" and why is my active session unrecognized please?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Cacti Polling Host

Post by gandalf »

At least some of those scripts do fail in our installation due to missing permissions (which we won't resolve due to security policies)
R.
tosage
Cacti User
Posts: 164
Joined: Wed Jul 28, 2010 5:05 am
Location: France

Re: Cacti Polling Host

Post by tosage »

Hello Gandalf, I have a question, on one of my installation of cacti i have the same result when i launch the php script with www-data user :

sudo -u www-data /usr/bin/php -q /usr/share/cacti/site/scripts/cacti_user_stats.php
valid:0 invalid:0 active:U sleeping:U garbage:U uactive:U usleeping:U

And the same command with root privilege :
sudo /usr/bin/php -q /usr/share/cacti/site/scripts/cacti_user_stats.php
valid:0 invalid:0 active:1 sleeping:0 garbage:0 uactive:1 usleeping:0

my ls -all on the script :

sudo ls -all /usr/share/cacti/site/scripts/cacti_user_stats.php
-rwxr-xr-x 1 root root 5010 2011-02-13 00:21 /usr/share/cacti/site/scripts/cacti_user_stats.php

I don't understand why my www-data user have this answer when he launch your script :/
Do you have a track on which I run to find the fault ?

And i have a question in your ss_poller.php, when the poller time exceed 300 seconds, the value isn't graph.
Why ?

Thanks in advance :)
Cacti Version - 0.8.8a
Plugin Architecture - 3.1
Poller Type - spine
Server Info - Linux
Web Server - Apache/2.2.22 (Ubuntu)
PHP - 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli)
MySQL - 5.5.29-0ubuntu0.12.04.2
RRDTool - 1.4.7
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Cacti Polling Host

Post by noname »

tosage wrote:sudo -u www-data /usr/bin/php -q /usr/share/cacti/site/scripts/cacti_user_stats.php
valid:0 invalid:0 active:U sleeping:U garbage:U uactive:U usleeping:U
Try this test code (borrowed from cacti_user.stats.php)

Code: Select all

<?php

echo get_session_save_path();

function get_session_save_path() {

        if(session_save_path() !== "") {
                return realpath(session_save_path());
        }elseif(function_exists('sys_get_temp_dir')) {
                return realpath(sys_get_temp_dir());
        }elseif($temp=getenv('TMP') | $temp=getenv('TEMP') | $temp=getenv('TMPDIR') ) {
                return $temp;
        }else{
                return "cannot be determined";
        }
}

?>
like this:
# sudo -u www-data /usr/bin/php -q /tmp/test.php

(In my environment, its result is "/var/tmp".)

Then,
1) Is your poller running as www-data?
2) In that directory, is there any sess_* file which www-data can read? (And is it created most recently?)
tosage
Cacti User
Posts: 164
Joined: Wed Jul 28, 2010 5:05 am
Location: France

Re: Cacti Polling Host

Post by tosage »

re Hello noname :)

I have test your code and the result in my Ubuntu Server system is /var/lib/php5
In this folder i have files prefixed sess_xxxxxxxxxxxxxxxx with www-data:www-data in permission with a rw only for www-data

My Poller is execute from www-data user

Code: Select all

MAILTO=root
*/5 * * * * www-data php /usr/share/cacti/site/poller.php >/dev/null 2>/var/log/cacti/poller-error.log
I have found my problem, right on the /var/lib/php5 is incorrect.
sudo ls -all /var/lib/ | grep php5
drwx-wx-wt 2 root root 143360 2011-08-01 11:17 php5

I have grant r for others on this folder as my other server which the script function and now it's function perfectly :)

Thnaks you again for your Help :wink:
Cacti Version - 0.8.8a
Plugin Architecture - 3.1
Poller Type - spine
Server Info - Linux
Web Server - Apache/2.2.22 (Ubuntu)
PHP - 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli)
MySQL - 5.5.29-0ubuntu0.12.04.2
RRDTool - 1.4.7
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests