Generally, on IBM AIX, nmon is the performance monitoring tool most widely used. However, a lot of organizations have a standardized performance monitoring tool across their landscape based on their needs, skill set, and experience. Also, with the proliferation of open source software and tools in enterprise computing arena, we see that more and more organizations are interested in running the open source software and tools as they want to leverage their open source software and tools skill set onto other UNIX platforms such as AIX.
One such open source performance monitoring tool is collectd, which is very popular on Linux and other open source operating system platforms. Based on the information provided at https://collectd.org/download.shtml, we can understand that a lot of open source operating systems have pre-packaged binary files available for collectd. Unfortunately, AIX is not one of them, and therefore, there is a need to build it from the available sources.
If you are intending to run collectd on AIX, then this tutorial is for you as it lists the steps to compile and build collectd from sources on AIX that we have found to be working.
To build collectd on AIX using source code, we need some open source tools as a prerequisite.
If your AIX installation does not have the YUM tool enabled for AIX Toolbox repository, follow the instructions given at: https://www.ibm.com/support/pages/aix-toolbox-linux-applications-downloads-alpha
After installing YUM successfully, on your AIX setup, you can find the following repositories listed:
After enabling the AIX Toolbox repository, you need to install a few packages using the following
yum command to build collectd successfully:
[root@AIX_host] yum install git flex bison autoconf automake pkgconfig libtool gcc cmake make
On most modern AIX systems, the procedure to build and compile collectd should take about one to two hours, depending on the speed of your network and system resources.
Steps for building and compiling collectd
Perform the following steps to build and compile collectd on an AIX platform:
Add /opt/freeware/bin to the beginning of the current
Download the collectd source code from the Git repository.
git clone https://github.com/collectd/collectd
Change the directory to the location where the collectd source code is downloaded.
Run the build script.
Create a backup of the original configuration file.
cp /Downloads/COLLECTD/collectd/configure /Downloads/COLLECTD/collectd/configure.ORIG
It has been observed that the
bexpalloption is not exporting some of the symbols in the collectd daemon that are required by some of the plug-ins. Therefore, you need to replace
bexpfull, which exports all the symbols. Using vi or any other editor, replace the keyword,
bexpfullin the configure file such that there are no instances of
[c565prodlpr170e1]:/Downloads/COLLECTD/collectd >grep -n bexpall ./configure | grep -v "#" [c565prodlpr170e1]:/Downloads/COLLECTD/collectd >grep -n bexpfull ./configure | grep -v "#" 10349: export_dynamic_flag_spec='$wl-bexpfull' 15037: export_dynamic_flag_spec_CXX='$wl-bexpfull'
By default, the AIX build environment is 32 bit. However, here we need to perform a 64-bit build. So, add –
CCflags and set
OBJECT_MODE=64to make sure that some of the build utilities such as
aroperate on 64-bit object files. Run the following commands to set up the required environment variables for compilation.
export CC="gcc -maix64 -O2" export OBJECT_MODE=64 export LDFLAGS="-Wl,-brtl"
Sometimes there will be slight mismatch in the function prototypes between AIX and the open source code . If it is acceptable, then the compiler throws warning messages and continues. Generally, most of the open source code does this but here in collectd, it is not that case. So run the
configurecommand with the
disable-werroroption to ignore the warnings and proceed.
Compile and install collectd.
make && make install
By default, the collectd binary file is built in the /opt/collectd/bin directory. Before running collectd, it is recommended that you make the required changes in the collectd configuration file. By default, /opt/collected/etc/collectd.conf is the location of the collectd configuration file. If located elsewhere, you can override it using the
-C option when running
collectd. We highly recommend that you modify the logfile plug-in in the collectd configuration file (collectd.conf) to generate the log file as mentioned below.
The logfile plug-in:
LoadPlugin logfile <Plugin logfile> LogLevel info File "/opt/collectd/var/log/collectd.log" ⇐ This is the location of the log file for collectd. Timestamp true PrintSeverity false </Plugin>
Note: The above configuration will create a log file in the /opt/collectd/var/log/ directory, which you can tail to see what is happening while loading and running collectd.
Now, start the
collectd daemon as follows:
rdc5vpc0lpr7 : /opt/collectd/sbin > ./collectd Collectd configuration location. [2021-07-08 12:05:40] plugin_load: plugin "logfile" successfully loaded. rdc5vpc0lpr7 : /opt/collectd/sbin >
For example, in our setup, tailing the collectd.log shows the following output:
[c565prodlpr170e1]:/opt/collectd/var/log >pwd /opt/collectd/var/log rdc5vpc0lpr7 : /opt/collectd/sbin > tail -n 40 ../var/log/collectd.log [2021-07-08 12:05:40] plugin_load: plugin "cpu" successfully loaded. [2021-07-08 12:05:40] plugin_load: plugin "interface" successfully loaded. [2021-07-08 12:05:40] plugin_load: plugin "load" successfully loaded. [2021-07-08 12:05:40] plugin_load: plugin "memory" successfully loaded. [2021-07-08 12:05:40] plugin_load: plugin "network" successfully loaded. [2021-07-08 12:05:40] Initialization complete, entering read-loop. [2021-07-08 12:05:50] network plugin: getaddrinfo (ff18::efc0:4a42, 25826) failed: Hostname and service name not provided or found [2021-07-08 12:05:50] network plugin: Successfully resolved "126.96.36.199". [2021-07-08 12:05:50] network plugin: setsockopt (ipv4-multicast-if): Invalid argument [2021-07-08 12:05:50] network plugin: getaddrinfo (ff18::efc0:4a42, 25826) failed: Hostname and service name not provided or found
In this tutorial, we have shown that with minimal effort and basic coding skills it is possible to compile and build collectd on the AIX platform. Additionally, the IBM Toolbox for open source repository makes the prerequisite process almost a breeze.
So, good luck and happy building and running collectd on AIX. Let me know if you find this tutorial useful, and if you notice any omission or need for correction. Really appreciate your feedback. Thanks!