Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build/*
generated/*
.idea/*
9 changes: 9 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ run: build/node_exporter_aix

bff: clean build/node_exporter_aix
sed "s/VERSION/$(GIT_VERSION)/; s%PWD%$(PWD)%;" bff_template > build/bff_template
sudo rm -rf build/root
rm -rf build/root
mkdir -p build/root/usr/local/bin/
cp build/node_exporter_aix build/root/usr/local/bin/
sudo chown root.system build/root/usr/local/bin/node_exporter_aix
sudo mkinstallp -d build/root -T build/bff_template
chown root.system build/root/usr/local/bin/node_exporter_aix
mkinstallp -d build/root -T build/bff_template
cp build/root/tmp/node_exporter_aix.$(GIT_VERSION).bff build/

clean:
sudo rm -rf build/* generated/*
rm -rf build/* generated/*
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ flag | Description
-a | net adapter statistics
-b | net buffer statistics
-p | partition statistics
-U | Busy Consumed CPU statistics
-R | Process statistics

## Install package
installp -ac -d <package_file.bff>
Expand Down Expand Up @@ -75,6 +77,57 @@ To see all available configuration flags:

./build/node_exporter_aix -h

## Building on IBM Cloud

Create an AIX7.1 Machine
Login and enter a bash shell

Instructions for 7.1
Create space
Allow more partitions

`chvg -t 10 rootvg`

Extend volumegroup

`extendvg rootvg hdisk1`

Add space to filesystem to opt folder where yum items are installed

`chfs -a size=+5G /dev/hd10opt`
`chfs -a size=+10G /dev/hd3`
`chfs -a size=+10G /dev/hd9var`
`chfs -a size=+5G /dev/hd2`
`chfs -a size=+5G /dev/hd4`

Start installing dev tools

`curl -O https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc-7.1/gcc/gcc-8-1.aix7.1.ppc.rpm`

`rpm -i gcc-8-1.aix7.1.ppc.rpm`

`export PATH=/opt/freeware/bin/:$PATH`

`yum install gcc-cplusplus-8-1.aix7.1.ppc.rpm`

`curl -O https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/git/git-core-2.35.1-1.aix7.1.ppc.rpm`

`yum install git-core-2.35.1-1.aix7.1.ppc.rpm`

`curl -O https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/curl/curl-7.83.1-1.aix7.1.ppc.rpm`

`yum install curl-7.83.1-1.aix7.1.ppc.rpm`

`curl -O https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/make/make-4.3-1.aix6.1.ppc.rpm`

`yum install make-4.3-1.aix6.1.ppc.rpm`

`smitty install_all`

Enter input device by hitting f4 and select /usr/sys/inst.images then find package installp

Finally go to the root directory and run `gmake`

# Contributing
Please see [CONTRIBUTING.md](CONTRIBUTING.md). We welcome issues, pull requests and general suggestions.

Expand Down
4 changes: 3 additions & 1 deletion collectors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void output_cpus_stat(std::ostream& response, const std::string& static_labels,
void gather_cpus_compat(std::ostream& response, const std::string& static_labels) {
int cpu_count = perfstat_cpu(NULL, NULL, sizeof(perfstat_cpu_t), 0);

perfstat_cpu_t cpus[cpu_count];
perfstat_cpu_t *cpus = new perfstat_cpu_t[cpu_count];
perfstat_id_t firstcpu;

strcpy(firstcpu.name, FIRST_CPU);
Expand All @@ -76,6 +76,8 @@ void gather_cpus_compat(std::ostream& response, const std::string& static_labels
output_cpus_stat_mode(response, static_labels, "node_cpu", "idle", "Seconds the cpus spent in each mode.", cpus, cpu_count, [](perfstat_cpu_t& cpu) { return (u_longlong_t)cpu.idle/100; });
output_cpus_stat_mode(response, static_labels, "node_cpu", "sys", "Seconds the cpus spent in each mode.", cpus, cpu_count, [](perfstat_cpu_t& cpu) { return (u_longlong_t)cpu.sys/100; });
output_cpus_stat_mode(response, static_labels, "node_cpu", "wait", "Seconds the cpus spent in each mode.", cpus, cpu_count, [](perfstat_cpu_t& cpu) { return (u_longlong_t)cpu.wait/100; });
delete [] cpus;

}


Expand Down
12 changes: 1 addition & 11 deletions data_sources/diskadapter.multiple
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,4 @@ gauge dk_bsize Number of Bytes in a block for this disk
counter dk_rxfers Number of transfers from disk
counter dk_rserv read or receive service time
counter dk_wserv write or send service time
counter min_rserv Minimum read service time
counter max_rserv Maximum read service time
counter min_wserv Minimum Write service time
counter max_wserv Maximum write service time
gauge wq_depth driver wait queue depth
counter wq_sampled accumulated sampled dk_wq_depth
counter wq_time accumulated wait queueing time
gauge wq_min_time minimum wait queueing time
gauge wq_max_time maximum wait queueing time
counter q_full "Service" queue full occurrence count (number of times the adapter/devices connected to the adapter is not accepting any more request)
counter q_sampled accumulated sampled
counter min_rserv Minimum read service time
1 change: 0 additions & 1 deletion data_sources/diskpath.multiple
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ counter wfailed number of failed write requests
counter min_wserv min write or send service time
counter max_wserv max write or send service time
counter wq_depth instantaneous wait queue depth (number of requests waiting to be sent to disk)
counter wq_sampled accumulated sampled dk_wq_depth
counter wq_time accumulated wait queueing time
counter wq_min_time min wait queueing time
counter wq_max_time max wait queueing time
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate_multiple.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ done
tail -n +3 $input | sed "s/\"/'/g" | while read type name desc; do
echo "\toutput_${struct_name}_stat_mode(response, static_labels, \"aix_${struct_name}_${name}\", \"${type}\", \"${desc}\", ${struct_name}s, ${struct_name}_count, [](perfstat_${struct_name}_t& ${struct_name}) { return ${struct_name}.${name}; });" >> $output
done

echo "delete [] "$struct_name"s;" >> $output
echo "}" >> $output
3 changes: 3 additions & 0 deletions server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <string>
#include <thread>
#include <sstream>
#include <libperfstat.h>

#include "server_http.hpp"

Expand All @@ -17,8 +18,10 @@ using HttpServer = SimpleWeb::Server<SimpleWeb::HTTP>;

int start_server(int port, int flags) {

perfstat_reset();
HttpServer server;
server.config.port = port;
server.config.timeout_request = 30;

server.default_resource["GET"] = [flags](std::shared_ptr<HttpServer::Response> response, std::shared_ptr<HttpServer::Request> request) {
std::ostringstream output;
Expand Down
22 changes: 19 additions & 3 deletions templates/generate_multiple.template
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@
#include <iostream>

void output_STRUCT_NAME_stat_mode(std::ostream& response, const std::string& static_labels, const std::string& name, const std::string& type, const std::string& help, perfstat_STRUCT_NAME_t STRUCT_NAMEs[], size_t STRUCT_NAME_count, const std::function<double (perfstat_STRUCT_NAME_t&)>& func) {
response << "# HELP " << name << " " << help << std::endl;
response << "# TYPE " << name << " " << type << std::endl;

std::cout << "STRUCT_NAME getting name " << name << std::endl;

for(size_t i=0; i<STRUCT_NAME_count; i++) {
std::cout << "STRUCT_NAME index " << i << std::endl;
response << name << "{STRUCT_NAME=\"" << STRUCT_NAMEs[i].NAME_FIELD << "\",";
response << "LABEL=\"" << FORMAT_START STRUCT_NAMEs[i].LABEL FORMAT_END << "\",";
response << static_labels << "} " << func(STRUCT_NAMEs[i]) << std::endl;
response << static_labels << "} " << func(STRUCT_NAMEs[i]) << std::endl;
}
}

void gather_STRUCT_NAMEs(std::ostream& response, const std::string& static_labels) {
int STRUCT_NAME_count = perfstat_STRUCT_NAME(NULL, NULL, sizeof(perfstat_STRUCT_NAME_t), 0);

perfstat_STRUCT_NAME_t STRUCT_NAMEs[STRUCT_NAME_count];
int STRUCT_NAME_count = perfstat_STRUCT_NAME(NULL, NULL, sizeof(perfstat_STRUCT_NAME_t), 0);
std::cout << "STRUCT_NAME count is " << STRUCT_NAME_count << std::endl;
if (STRUCT_NAME_count == -1) {
std::cout << "STRUCT_NAME count returned error " << errno << std::endl;
perror("Error calling STRUCT_NAME");
return;
}
perfstat_STRUCT_NAME_t *STRUCT_NAMEs = new perfstat_STRUCT_NAME_t[STRUCT_NAME_count];
perfstat_ID_STRUCT_t firstSTRUCT_NAME;

std::cout << "STRUCT_NAME about to init " << std::endl;

INITIALIZER;

std::cout << "STRUCT_NAME inited " << std::endl;

if(perfstat_STRUCT_NAME(&firstSTRUCT_NAME, STRUCT_NAMEs, sizeof(perfstat_STRUCT_NAME_t), STRUCT_NAME_count) <= 0) {
perror("Error calling perfstat_STRUCT_NAME");
return;
}