Commit 8f90a409 authored by Manuel Wudka-Robles's avatar Manuel Wudka-Robles
Browse files

kineticstat exapmles prints log messages

parent a9181414
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ else(USE_LOCAL_KINETIC_CLIENT)
        kinetic_cpp_client
        PREFIX "vendor"
        GIT_REPOSITORY "git@github.com:Seagate/Kinetic-C-Client.git"
        GIT_TAG "296c7e182bc63b3b3daa999fac65821f7d0c505c"
        GIT_TAG "41a699b7e4c64e323ef23f5141ecd261f05fed91"
        BUILD_IN_SOURCE 1
        INSTALL_COMMAND ""
    )
@@ -70,4 +70,3 @@ add_example_target(delete_file_blocking)
add_example_target(write_file_nonblocking)
add_example_target(firmware_update)
add_example_target(write_file_blocking_threads)
+14 −1
Original line number Diff line number Diff line
@@ -21,8 +21,9 @@ void print_operation_stats_report(const DriveLog& drive_log, bool print_headers)
int main(int argc, char* argv[]) {
    (void) argc;

    if (argc != 2 && argc != 4) {
    if (argc < 2 || argc > 4) {
        printf("Usage: %s <host>\n", argv[0]);
        printf("       %s <host> log", argv[0]);
        printf("       %s <host> <temp|utilization|stat> <interval>\n", argv[0]);
        return 1;
    }
@@ -50,6 +51,15 @@ int main(int argc, char* argv[]) {
        }

        dump_all_information(*drive_log);
    } else if(argc == 3) {
        // User wants the logs
        unique_ptr<DriveLog> drive_log;
        if(!connection->blocking().GetLog(drive_log).ok()) {
            printf("Unable to get log\n");
            return 1;
        }

        printf("%s\n", drive_log->messages.c_str());
    } else {
        // User wants to poll host so figure out the information so start
        // the polling
@@ -125,6 +135,9 @@ void dump_all_information(const DriveLog& drive_log) {
        ++it) {
        printf("  %s: %.0f\u00B0C\n", it->name.c_str(), it->current_degc);
    }

    printf("\nMessages:\n");
    printf("%s\n", drive_log.messages.c_str());
}

void print_temp_report(const DriveLog& drive_log, bool print_headers) {
+2 −2
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ int main(int argc, char* argv[]) {
                key,
                "",
                kinetic::IGNORE_VERSION,
                make_shared<KineticRecord>(value, "", "", Message_Algorithm_SHA1)).ok()) {
                KineticRecord(value, "", "", Message_Algorithm_SHA1)).ok()) {
            printf("Unable to write a chunk\n");
            return 1;
        }
@@ -76,7 +76,7 @@ int main(int argc, char* argv[]) {
            kinetic_key,
            "",
            kinetic::IGNORE_VERSION,
            make_shared<KineticRecord>(std::to_string(inputfile_stat.st_size), "", "", Message_Algorithm_SHA1)).ok()) {
            KineticRecord(std::to_string(inputfile_stat.st_size), "", "", Message_Algorithm_SHA1)).ok()) {
        printf("Unable to write metadata\n");
        return 1;
    }
+2 −2
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ int main(int argc, char* argv[]) {
            kinetic_key,
            "",
            kinetic::IGNORE_VERSION,
            make_shared<KineticRecord>(std::to_string(inputfile_stat.st_size), "", "", Message_Algorithm_SHA1)).ok()) {
            KineticRecord(std::to_string(inputfile_stat.st_size), "", "", Message_Algorithm_SHA1)).ok()) {
        printf("Unable to write metadata\n");
        return 1;
    }
@@ -133,7 +133,7 @@ void put_range(int64_t start, int64_t end, int64_t total_size, const char* kinet
                key,
                "",
                kinetic::IGNORE_VERSION,
                make_shared<KineticRecord>(value, "", "", Message_Algorithm_SHA1)).ok()) {
                KineticRecord(value, "", "", Message_Algorithm_SHA1)).ok()) {
            printf("Unable to write chunk\n");
            return;
        }