# Cacti Problem - Poller and Graphs



## cybercoke (Jan 24, 2012)

Hi everyone,

i have installed *Cacti 0.8.7i* on a *FreeBSD 8.0-RELEASE*, with php5-5.3.8, net-snmp-5.7.1_3, rrdtool-1.4.5 and apache-2.2.20.

Cacti was installed on /usr/local/share/cacti with permissions drwxr-xr-x and owner:group www:www.

The problem is that only when a run the /usr/local/share/cacti/poller.php manually, the hosts start to be in recovering mode and the rrd graphs being to be created, but not populated. If I put on cron to run poller.php as it should be, it gave me the following at cacti.log:


```
01/24/2012 10:48:00 AM - POLLER: Poller[0] NOTE: Poller Int: '60', Cron Int: '60', Time Since Last: '60', Max Runtime '58', Poller Runs: '1'
01/24/2012 10:48:00 AM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/local/bin/php, ARGS: -q
 "/usr/local/share/cacti/cmd.php" 0 4]
01/24/2012 10:48:00 AM - CMDPHP: Poller[0] Host[3] PING: ICMP ping Timed out
01/24/2012 10:48:00 AM - CMDPHP: Poller[0] Host[3] SNMP: SNMP not performed due to setting or ping result.
01/24/2012 10:48:00 AM - CMDPHP: Poller[0] Host[4] PING: ICMP ping Timed out
01/24/2012 10:48:00 AM - CMDPHP: Poller[0] Time: 0.0074 s, Theads: N/A, Hosts: 2
01/24/2012 10:48:00 AM - SYSTEM STATS: Time:0.1387 Method:cmd.php Processes:1 Threads:N/A Hosts:3 HostsPerProcess:3 DataSources:7
 RRDsProcessed:0
```

Here the cacti.log when I run poller.php manually:


```
PHP Deprecated:  Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
PHP Deprecated:  Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
01/24/2012 10:52:45 AM - POLLER: Poller[0] NOTE: Poller Int: '60', Cron Int: '60', Time Since Last: '45', Max Runtime '58', Poller Runs: '1'
01/24/2012 10:52:45 AM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/local/bin/php, ARGS: -q
 "/usr/local/share/cacti/cmd.php" 0 4]
PHP Deprecated:  Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
PHP Deprecated:  Directive 'register_long_arrays' is deprecated in PHP 5.3 and greater in Unknown on line 0
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
01/24/2012 10:52:45 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/servidor_www_users_59.rrd
 --template users 1327409565:1
OK u:0.01 s:0.00 r:0.04
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
01/24/2012 10:52:45 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/servidor_www_hdd_free_64.rrd
 --template hdd_used:hdd_free 1327409565:949326:4653562
OK u:0.01 s:0.00 r:0.05
Waiting on 1 of 1 pollers.
01/24/2012 10:52:45 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/neomap-firewall_hdd_free_54.rrd
 --template hdd_free:hdd_used 1327409565:161543904:80227112
OK u:0.01 s:0.00 r:0.06
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
01/24/2012 10:52:45 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/neomap-firewall_mem_cache_49.rrd
 --template mem_cache 1327409565:1524420
OK u:0.01 s:0.00 r:0.09
01/24/2012 10:52:45 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/neomap-firewall_cpu_user_44.rrd
 --template cpu_user 1327409565:5955422
OK u:0.01 s:0.00 r:0.09
01/24/2012 10:52:45 AM - SYSTEM STATS: Time:0.2055 Method:cmd.php Processes:1 Threads:N/A Hosts:3 HostsPerProcess:3 DataSources:7
 RRDsProcessed:5
Loop  Time is: 0.21
Sleep Time is: 59.79
Total Time is: 0.21
```

The host are configured as Generic SNMP Enabled Host, and the response from snmp when I save it was the following:


```
Web WWW (localhost)
SNMP Information
System:FreeBSD neomail 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Mon Jul 5
/obj/usr/src/sys/NEOPROXY i386
Uptime: 542540 (0 days, 1 hours, 30 minutes)
Hostname: neomail
Location: xxxx
Contact: xxxxx

Ping Results
ICMP Ping Success (0.051 ms)
```

I can do Associate Data Queries with no errors, like SNMP - Interface Statistics and Unix - Get Mounted Partitions.

I can create new graphs with those DataQueries, but they are not populate.

So, my 2 problems are: 

1 - Make poller.php run on cron
2 - Make rrd populate the rrd files.

Thanks at all!


----------



## SirDice (Jan 24, 2012)

FreeBSD 8.0 went End-Of-Life on 30 November 2010.


----------



## cybercoke (Jan 24, 2012)

Hi SirDice, ok, I will update it as soon as possible, but right now, it was working good. It can run cacti ok. Can you help me solve that problem? Thank you.


----------



## SirDice (Jan 24, 2012)

It fails to ping the host, this usually means the SNMP query is skipped too (it's no use trying to scan a device that's offline).

Can you ping the host from the monitoring server? Is cacti perhaps running in a jail?


----------



## cybercoke (Jan 24, 2012)

SirDice said:
			
		

> It fails to ping the host, this usually means the SNMP query is skipped too (it's no use trying to scan a device that's offline).
> 
> Can you ping the host from the monitoring server? Is cacti perhaps running in a jail?



Yes, I can ping it. It was the same machine (localhost). I can make poller.php runs by hand, but when it was on cron, it dosen't run well.

I understand that not try to scan an offline host.

Thanks.


----------



## SirDice (Jan 24, 2012)

It does take a little while when you create a new graph for the data to appear. It needs a couple of data points before it's able to produce a graph.


----------



## cybercoke (Jan 24, 2012)

SirDice said:
			
		

> It does take a little while when you create a new graph for the data to appear. It needs a couple of data points before it's able to produce a graph.



Yes, I know it, but I'm two days waiting and running poller by hand and nothing.

The rrd files are created and updated by rrdtool. I know it because date/time and size of files are updated after I run the poller.

Thanks.


----------



## SirDice (Jan 24, 2012)

I suddenly remembered I have a working cacti on one of my servers 

How did you create the cron entry?

`# crontab -u cacti -e`
It should look like this:

```
*/5     *       *       *       *       /usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null 2>&1
```


----------



## cybercoke (Jan 24, 2012)

SirDice said:
			
		

> I suddenly remembered I have a working cacti on one of my servers
> 
> How did you create the cron entry?
> 
> ...



My cron is that way:


```
*/5 * * * * /usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null 2>/usr/local/share/cacti/log/cacti.log
```

This cron is on root. I try to put in cacti user but it does not start.
I'll try again.

What is the permissions and owners of you cacti directory ?

Thx.


----------



## SirDice (Jan 24, 2012)

cybercoke said:
			
		

> This cron is on root. I try to put in cacti user but it does not start.


Yes, from a security perspective you don't want this stuff running as root. There's no need for it either.



> What is the permissions and owners of you cacti directory ?




```
root@intranetz:/usr/local/share#ls -al /usr/local/share/cacti/
total 2077
drwxr-xr-x  12 root   wheel      53 Nov  3 21:57 .
drwxr-xr-x  30 root   wheel      30 Nov 10 22:34 ..
-rw-r--r--   1 root   wheel   15141 Nov  1 21:41 LICENSE
-rw-r--r--   1 root   wheel      48 Nov  1 21:41 README
-rw-r--r--   1 root   wheel    6199 Nov  1 21:41 about.php
-rw-r--r--   1 root   wheel    5096 Nov  1 21:41 auth_changepassword.php
-rw-r--r--   1 root   wheel   12250 Nov  1 21:41 auth_login.php
-rw-r--r--   1 root   wheel  175610 Nov  3 22:18 cacti.sql
-rw-r--r--   1 root   wheel   21643 Nov  1 21:41 cdef.php
drwxr-xr-x   2 root   wheel      22 Nov  3 21:57 cli
-rw-r--r--   1 root   wheel   19760 Nov  1 21:41 cmd.php
-rw-r--r--   1 root   wheel    6974 Nov  1 21:41 color.php
-rw-r--r--   1 root   wheel   25025 Nov  1 21:41 data_input.php
-rw-r--r--   1 root   wheel   35455 Nov  1 21:41 data_queries.php
-rw-r--r--   1 root   wheel   57925 Nov  1 21:41 data_sources.php
-rw-r--r--   1 root   wheel   32871 Nov  1 21:41 data_templates.php
drwxr-xr-x   5 root   wheel       8 Nov  3 21:57 docs
-rw-r--r--   1 root   wheel    6107 Nov  1 21:41 gprint_presets.php
-rw-r--r--   1 root   wheel   12072 Nov  1 21:41 graph.php
-rw-r--r--   1 root   wheel    3450 Nov  1 21:41 graph_image.php
-rw-r--r--   1 root   wheel    7805 Nov  1 21:41 graph_settings.php
-rw-r--r--   1 root   wheel   26606 Nov  1 21:41 graph_templates.php
-rw-r--r--   1 root   wheel   10006 Nov  1 21:41 graph_templates_inputs.php
-rw-r--r--   1 root   wheel   18526 Nov  1 21:41 graph_templates_items.php
-rw-r--r--   1 root   wheel   38470 Nov  1 21:41 graph_view.php
-rw-r--r--   1 root   wheel    5840 Nov  1 21:41 graph_xport.php
-rw-r--r--   1 root   wheel   59544 Nov  1 21:41 graphs.php
-rw-r--r--   1 root   wheel   17409 Nov  1 21:41 graphs_items.php
-rw-r--r--   1 root   wheel   39850 Nov  1 21:41 graphs_new.php
-rw-r--r--   1 root   wheel   57342 Nov  1 21:41 host.php
-rw-r--r--   1 root   wheel   20016 Nov  1 21:41 host_templates.php
drwxr-xr-x   2 root   wheel      63 Nov  3 21:57 images
drwxr-xr-x   4 root   wheel      18 Nov  3 21:57 include
-rw-r--r--   1 root   wheel    2242 Nov  1 21:41 index.php
drwxr-xr-x   2 root   wheel      26 Nov  3 21:57 install
drwxr-xr-x   3 root   wheel      37 Nov  3 21:57 lib
drwxr-xr-x   2 cacti  cacti       3 Nov  3 21:57 log
-rw-r--r--   1 root   wheel    2641 Nov  1 21:41 logout.php
-rw-r--r--   1 root   wheel   17691 Nov  1 21:41 poller.php
-rw-r--r--   1 root   wheel    4304 Nov  1 21:41 poller_commands.php
-rw-r--r--   1 root   wheel    2243 Nov  1 21:41 poller_export.php
drwxr-xr-x   5 root   wheel       5 Nov  3 21:57 resource
drwxr-xr-x   2 cacti  cacti      20 Nov  6 19:40 rra
-rw-r--r--   1 root   wheel    7233 Nov  1 21:41 rra.php
-rw-r--r--   1 root   wheel    8270 Nov  1 21:41 script_server.php
-rw-r--r--   1 root   wheel     353 Nov  1 21:41 script_server.pl
drwxr-xr-x   2 root   wheel      22 Nov  3 21:57 scripts
-rw-r--r--   1 root   wheel    4995 Nov  1 21:41 settings.php
-rw-r--r--   1 root   wheel    6086 Nov  1 21:41 templates_export.php
-rw-r--r--   1 root   wheel    6526 Nov  1 21:41 templates_import.php
-rw-r--r--   1 root   wheel   19435 Nov  1 21:41 tree.php
-rw-r--r--   1 root   wheel   44285 Nov  1 21:41 user_admin.php
-rw-r--r--   1 root   wheel   64878 Nov  1 21:41 utilities.php
```

Note the *cacti* user on log and rra.


----------



## cybercoke (Jan 24, 2012)

Ok SirDice, I just put in the root's crontab for test only. It was now on cacti's cron and running (poller.php). 

The permissions are the same, include log/ and rra/.

I was wondering why on the cacti web interface the ICMP ping was "OK" , and the same if I run the poller by hand, but not if they are on the cron.

Thanks.


----------



## cybercoke (Jan 26, 2012)

Hi guys, thank you for the help, but yesterday I tried to remove cacti at all and reinstall. I do this by ports installing cacti 0.8.7.h and then upgrade to 0.8.7.i from cacti.net. Installing plugin monitor and everything works fine. Who knows.

Thank you again.


----------

