cactid only runs properly as root.

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

Moderators: Developers, Moderators

Post Reply
pbrubaker
Posts: 8
Joined: Mon May 01, 2006 11:15 pm
Location: Los Angeles, CA

cactid only runs properly as root.

Post by pbrubaker »

Hey all,

I have a problem that pertains only to cactid, if I use cmd.php the problem does not exist. If you run cactid as root this is the output.

Code: Select all

[root@burns ~]# /usr/local/cactid/bin/cactid
CACTID: Using cactid config file [/etc/cactid.conf]
CACTID: Version 0.8.6f starting
CACTID: Host[1] SNMP Result: Device does not require SNMP
CACTID: Host[1] No host availability check possible for '127.0.0.1'
CACTID: Host[1] DS[22] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/linux_memory.pl MemFree:, output: 32227328
CACTID: Host[1] DS[23] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/linux_memory.pl SwapFree:, output: 542662656
CACTID: Host[1] DS[5] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/loadavg_multi.pl, output: 1min:0.00 5min:0.04 10min:0.01
CACTID: Host[1] DS[15] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/query_unix_partitions.pl  get available /dev/hda1, output: 67328
CACTID: Host[1] DS[10] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/query_unix_partitions.pl  get available /dev/hda3, output: 2123292
CACTID: Host[1] DS[11] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/query_unix_partitions.pl  get available /dev/sda1, output: 173069980
CACTID: Host[1] DS[15] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/query_unix_partitions.pl  get used /dev/hda1, output: 28539
CACTID: Host[1] DS[10] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/query_unix_partitions.pl  get used /dev/hda3, output: 4991052
CACTID: Host[1] DS[11] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/query_unix_partitions.pl  get used /dev/sda1, output: 557038336
CACTID: Host[1] DS[7] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/unix_processes.pl, output: 93
CACTID: Host[1] DS[6] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/unix_users.pl, output: 2
CACTID: Time: 0.4554 s, Threads: 1, Hosts: 2
However if you run it as cactiuser this is the output.

Code: Select all

[cactiuser@burns ~]$ /usr/local/cactid/bin/cactid
CACTID: MYSQL: Connection Failed: Access denied for user: 'cactiuser@localhost' (Using password: YES)
Connecting right to the database does work.

Code: Select all

[cactiuser@burns ~]$ mysql --database=cacti --user=cactiuser --password=XXXXXXXXX
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8417 to server version: 3.23.58

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
I am running...

Linux 2.6.12-2.3.legacy_FC3smp #1 SMP Sun Feb 19 08:53:09 EST 2006 i686 i686 i386 GNU/Linux

cacti-0.8.6h.fc3.i386 (Installed from RPM.)
cacti-cactid-0.8.6g (Compiled source.

PHP 4.3.11 (cgi) (built: Nov 8 2005 06:24:40)
MySQL 3.23.58

I do have the MySQL permissions setup correctly and the cactid configuration matches the config.php configuration.

I must be missing something. For now I am running poller.php with root permissions but I would like to change that.

Any insight?
pbrubaker
Posts: 8
Joined: Mon May 01, 2006 11:15 pm
Location: Los Angeles, CA

Post by pbrubaker »

Actually I think I found the problem. The either the install of cactid or an initial running as root (or both) improperly sets the permissions of:

Code: Select all

/etc/cactid.conf
/var/net-snmp
/var/net-snmp/cactid.conf
The default install of net-snmp sets the permissions of /var/net-snmp to '700'. It seems kind of hokey that cactid wants to store something there. Perhaps it should be storing that data elsewhere, like somewhere it has write permissions to?

Anyway, I've changed the permissions of the aformentioned files and directories so that cactiuser has the proper permissions and everything works now.

Just so people know how to fix it these are what the permissions/ownership should be set to.

Code: Select all

-rw-r-----  1 cactiuser cactiuser 2.5K Apr 30 18:33 /etc/cactid.conf
drwxrwxrwx   2 root    root    4.0K May  1 21:35 /var/net-snmp
-rw-------  1 cactiuser cactiuser 664 May  1 21:35 /var/net-snmp/cactid.conf
With those permissions 'cactid' run as 'cactiuser' outputs.

Code: Select all

[cactiuser@burns ~]$ /usr/local/cactid/bin/cactid
CACTID: Using cactid config file [/etc/cactid.conf]
CACTID: Version 0.8.6f starting
CACTID: Host[1] SNMP Result: Device does not require SNMP
CACTID: Host[1] No host availability check possible for '127.0.0.1'
CACTID: Host[1] DS[22] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/linux_memory.pl MemFree:, output: 21471232
CACTID: Host[1] DS[23] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/linux_memory.pl SwapFree:, output: 542662656
CACTID: Host[1] DS[5] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/loadavg_multi.pl, output: 1min:0.16 5min:0.03 10min:0.01
CACTID: Host[1] DS[15] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/query_unix_partitions.pl  get available /dev/hda1, output: 67328
CACTID: Host[1] DS[10] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/query_unix_partitions.pl  get available /dev/hda3, output: 2123272
CACTID: Host[1] DS[11] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/query_unix_partitions.pl  get available /dev/sda1, output: 173069980
CACTID: Host[1] DS[15] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/query_unix_partitions.pl  get used /dev/hda1, output: 28539
CACTID: Host[1] DS[10] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/query_unix_partitions.pl  get used /dev/hda3, output: 4991076
CACTID: Host[1] DS[11] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/query_unix_partitions.pl  get used /dev/sda1, output: 557038336
CACTID: Host[1] DS[7] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/unix_processes.pl, output: 103
CACTID: Host[1] DS[6] SCRIPT: /usr/bin/perl /var/www/html/cacti/scripts/unix_users.pl, output: 2
CACTID: Time: 0.3519 s, Threads: 1, Hosts: 2
pbrubaker
Posts: 8
Joined: Mon May 01, 2006 11:15 pm
Location: Los Angeles, CA

Post by pbrubaker »

Actually, now I'm having another problem. I have no idea what's going on here...

Code: Select all

Content-type: text/html
X-Powered-By: PHP/4.3.11

Waiting on -1/1 pollers.
OK u:0.00 s:0.00 r:0.01
OK u:0.00 s:0.00 r:0.01
OK u:0.00 s:0.00 r:0.01
OK u:0.00 s:0.00 r:0.01
OK u:0.00 s:0.00 r:0.01
OK u:0.00 s:0.00 r:0.01
OK u:0.00 s:0.00 r:0.01
OK u:0.00 s:0.00 r:0.01
Waiting on -1/1 pollers.
<snip about 100 entries>
Waiting on -1/1 pollers.
05/01/2006 10:14:54 PM - POLLER: Poller[0] Maximum runtime of 292 seconds exceeded. Exiting.
05/01/2006 10:14:54 PM - SYSTEM STATS: Time:293.0512 Method:cactid Processes:1 Threads:1 Hosts:2 HostsPerProcess:2 DataSources:11 RRDsProcessed:8
PHP Warning:  pclose(): 41 is not a valid stream resource in /var/www/html/cacti/lib/rrd.php on line 48
Any ideas?
pbrubaker
Posts: 8
Joined: Mon May 01, 2006 11:15 pm
Location: Los Angeles, CA

Resolved...

Post by pbrubaker »

I think I figured out this one as well.

When cacti is installed via rpm it adds /etc/cron.d/cacti but the docs tell you to put the poller.php line in /etc/crontab. So I had both. The reason that it was working for a while was because I had it running as root in /etc/crontab and the other one (ran as cactiuser) failed because of the above error.

When I fixed the above error they were both running properly at the same time. Removing the duplicate execution seems to have fixed the problem.

Sorry for all messages the forums!
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Resolved...

Post by gandalf »

pbrubaker wrote: When cacti is installed via rpm it adds /etc/cron.d/cacti but the docs tell you to put the poller.php line in /etc/crontab. So I had both. The reason that it was working for a while was because I had it running as root in /etc/crontab and the other one (ran as cactiuser) failed because of the above error.

When I fixed the above error they were both running properly at the same time. Removing the duplicate execution seems to have fixed the problem.
You're not the first one. This is a common problem for rpm based installs
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests