cactid and Script/Command

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
naag
Posts: 1
Joined: Sat Jul 02, 2005 6:40 am

cactid and Script/Command

Post by naag »

I have written a bash script which parses MIMEDefang logmessages and returns mail statistics such as how many spams or viruses were detected. This script worked perfectly in combination with cacti-0.8.6e cmd.php. However, after switching to cactid-0.8.6e only four of ten output values were recognized by the poller.

It turned out that the following lines in my script caused the error:

Code: Select all

echo -n "mail_in:${mail_in} mail_out_relay:${mail_out_relay} mail_out_auth:${mail_out_auth} mail_out_drac:${mail_out_drac} "
echo -n "message_partial:${message_partial} non_multipart:${non_multipart} spam:${spam} virus:${virus} "
echo    "suspicious_chars:${suspicious_chars} mail_sum:${mail_sum}"
I then replaced these lines with the following ones:

Code: Select all

result="mail_in:${mail_in} mail_out_relay:${mail_out_relay} mail_out_auth:${mail_out_auth} mail_out_drac:${mail_out_drac}"
result="${result} message_partial:${message_partial} non_multipart:${non_multipart} spam:${spam} virus:${virus}"
result="${result} suspicious_chars:${suspicious_chars} mail_sum:${mail_sum}"

echo "${result}"
So you may not use multiple echo-s because cactid will recognize the end of the script output after it completed it's first echo command. It was a little hard to find out, as you only see one output line when executing the script on a shell. Never use "echo -n" in combination with cactid ;-)

Now cactid-0.8.6e works like a charm, almost 10 times faster than cmd.php. Thanks for all the great work :-)
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Your welcome :)
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest