cactid 0.8.6.d

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

Moderators: Developers, Moderators

Post Reply
_alex_
Posts: 17
Joined: Wed Feb 02, 2005 12:20 pm

cactid 0.8.6.d

Post by _alex_ »

Hi ,
I have found why cactid doesn't want to run, my linux box don't accept
DB_Host localhost
I should use
DB_Host 127.0.0.1
but I have another problem, when I run poller.php from CLI I have this error message.
/var/www/cacti/cactid: error while loading shared libraries: /var/www/cacti/cactid: undefined symbol: mysql_thread_init
Could someone ask me with witch librairie I have a problem.

Thanks

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

Post by rony »

What Linux Distrubution are you running? And version?
[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]
Jonathan
Posts: 4
Joined: Thu Mar 24, 2005 4:40 pm

Post by Jonathan »

I personally am also having issues running cactid though I've tried with both the 0.8.6d and with the patched 0.8.6e.

I've narrowed down the specific problem with my install to two hosts that I'm monitoring using the 2000/XP host template.

If I disable both of those hosts then cactid runs just fine. However with either of them enabled, cactid bombs out with a segfault whenever trying to update them.

Specific to my install with one of the machines enabled here is the last bit of output from cactid in full DEBUG mode.
CACTID: DEBUG: The Value of Active Threads is 1
CACTID: DEBUG: In Poller, About to Start Polling of Host
CACTID: MYSQL: Connecting to MySQL database 'cacti' on '127.0.0.1'...
CACTID: Host[6] SNMP Result: Host responded to SNMP
CACTID: DEBUG: SQLCMD: update host set status='3',status_event_count='0', status_fail_date='0000-00-00 00:00:00',status_rec_date='0000-00-00 00:00:00',status_last_error='',min_time='0.395490',max_time='999.999990',cur_time='0.561000',avg_time='489.209369',total_polls='371',failed_polls='0',availability='100.0000' where id='6'

CACTID: Host[6] RECACHE: Processing 3 items in the auto reindex cache for '192.168.0.253'
Segmentation fault
_alex_
Posts: 17
Joined: Wed Feb 02, 2005 12:20 pm

Post by _alex_ »

rony wrote:What Linux Distrubution are you running? And version?
I must ask it , to my sysadmin, because it's our internal company distribution, as soon as I have the specification I send it to you.
_alex_
Posts: 17
Joined: Wed Feb 02, 2005 12:20 pm

Post by _alex_ »

ok , it was a compilation problem, seems that cactid had lost path to mysql librairies .
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Ah, I was wondering... I was going to suggest. :)
[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]
Jonathan
Posts: 4
Joined: Thu Mar 24, 2005 4:40 pm

Post by Jonathan »

I've debugged my issue enought to see that it has something to do with poller items that use the script server. A back trace shows that just before the segfault it enters the php_cmd function in php.c and dies on line 53 with the snprintf statement.

But I'm not sure where to go from here...
Jonathan
Posts: 4
Joined: Thu Mar 24, 2005 4:40 pm

Post by Jonathan »

Ok, I took it one step further, but I still can't understand what the issue is yet. I set a breakpoint in gbd to break at the php_cmd function. Here is the output from that

Code: Select all

(gdb) run
Starting program: /usr/local/cactid/cactid
[Thread debugging using libthread_db enabled]
[New Thread -151320352 (LWP 32017)]
CACTID: Using cactid config file [cactid.conf]
WARNING: Unrecongized directive: LogFile=/var/log/cactid.log in cactid.conf
CACTID: Non Window envrionment, running as root, ICMP Ping available
CACTID: Version 0.8.6d starting
Detaching after fork from child process 32022.
[New Thread -153982032 (LWP 32024)]
[Thread -153982032 (zombie) exited]
[New Thread -153982032 (LWP 32026)]
Detaching after fork from child process 32028.
Detaching after fork from child process 32030.
Detaching after fork from child process 32034.
Detaching after fork from child process 32038.
Detaching after fork from child process 32042.
[Thread -153982032 (LWP 32026) exited]
[New Thread -153982032 (LWP 32046)]
[Thread -153982032 (LWP 32046) exited]
[New Thread -153982032 (LWP 32048)]
[Switching to Thread -153982032 (LWP 32048)]

Breakpoint 1, php_cmd (php_command=0x9f676a0 "\006") at php.c:47
47      char *php_cmd(char *php_command) {
(gdb) next
53              snprintf(command, sizeof(command), php_command, strlen(php_command));
(gdb) next

Program received signal SIGSEGV, Segmentation fault.
0x0066896b in strlen () from /lib/tls/libc.so.6
Jonathan
Posts: 4
Joined: Thu Mar 24, 2005 4:40 pm

Post by Jonathan »

Ok In finally figured out what was going on for certain and have it fixed for my installation.

In my particular install it just so happens that our SNMP community string contains a % symbol. In fact not only does it contain the % symbol, but it just so happens that the % symbol is immediately followed in the SNMP community string by an s. So the problem came in on this line in php.c

Code: Select all

snprintf(command, sizeof(command), php_command, strlen(php_command));
From what I can tell here, I'm not really sure why you're using the snprintf function here, as basically what you are trying to accomplish is to copy the string from php_command into command which is a character array with 5 more characters then the length of php_command. Then you add the /r/n to the end of it in the next line of code.

For now on my install I replace the above line with the following:

Code: Select all

strcpy(command, php_command);
Unless I'm missing something that is all that is necessary in this case. with the snprintf function anyone who happens to have a %s in their SNMP community string (admitably probably pretty slim) will segfault at this point because the snprintf fucntion trys to find an argument to plug in place of the %s in the php_command, and can't find it.

Can anyone tell me a specific reason why strcpy doesn't work just as well in this case as snprintf?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests