Ad blocker detected: Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker on our website.
I had the hostname set to something other than localhost in the device that is configured to graph the MySQL information so the scripts were not able to connet to mysqld.
I apologize for the wild goose chase. The mysql scripts are now working properly.
It was mentioned that there is an easy fix for the openldap_operations.pl script.
Echo everything in one echo statement and not in multiple. That is a requirement per the documentation. I don't wait on EOF to close the script. So, you have one chance to output. Spine takes no prisoners.
TheWitness
True understanding begins only when we realize how little we truly understand...
TheWitness wrote:Echo everything in one echo statement and not in multiple. That is a requirement per the documentation. I don't wait on EOF to close the script. So, you have one chance to output. Spine takes no prisoners.
I'm no Perl expert, but it looks like that is what the script is doing. This is the bottom part of the openldap_operations.pl Perl script:
foreach ($search->entries) {
my $cn = lc($_->get_value('cn'));
my $initiated = $_->get_value('monitorOpInitiated');
my $completed = $_->get_value('monitorOpCompleted');
$initiated = "U" unless defined $initiated;
$completed = "U" unless defined $completed;
print "$cn-initiated:$initiated ";
print "$cn-completed:$completed ";
}
print "\n";
which outputs the following from command line. It looks like everything is printed out successively without a linebreak until the very end before the script exits.
To make it work in spine, there should only be 1 print statement in the whole file. So, assign the output in the loop to a variable and at the very end, echo to the terminal using a print of that variable.
TheWitness
True understanding begins only when we realize how little we truly understand...
OK I modified the script to create an empty string, loop through all variables, append each one to the string, and then print the string ONCE before exiting:
TheWitness wrote:Echo everything in one echo statement and not in multiple. That is a requirement per the documentation. I don't wait on EOF to close the script. So, you have one chance to output. Spine takes no prisoners.
TheWitness
'lo,
I've also just upgraded spine and cacti to 0.8.7g ... I couldn't find any mention of this new "only 1 print statement" in the Changelog, maybe you're referring to other documentation ? I've had to adapt some of the perl scripts after upgrading, some of them even improved a bit !
I am using cacti spine 0.8.7 compiled from source and also had problems with openldap_operations.pl and another shell script.
The problem with both scripts was the trailing space in the output of the scripts, it was something like that "bind-initiated:... completed:0 ". When I changed the scripts to remove that space character it was ok.