diff --git a/scsiprint.cpp b/scsiprint.cpp
index cca0dcc..1e6314d 100644
a
|
b
|
scsiGetSmartData(scsi_device * device, bool attribs)
|
332 | 332 | } |
333 | 333 | if (255 == triptemp) |
334 | 334 | pout("Drive Trip Temperature: <not available>\n"); |
335 | | else |
336 | | pout("Drive Trip Temperature: %d C\n", triptemp); |
| 335 | else { |
| 336 | jout("Drive Trip Temperature: %d C\n", triptemp); |
| 337 | jglb["temperature"]["drive_trip"] = triptemp; |
| 338 | } |
337 | 339 | } |
338 | 340 | pout("\n"); |
339 | 341 | return err; |
… |
… |
scsiPrintGrownDefectListLen(scsi_device * device)
|
609 | 611 | print_off(); |
610 | 612 | break; |
611 | 613 | } |
612 | | if (0 == dl_len) |
613 | | pout("Elements in grown defect list: 0\n\n"); |
| 614 | if (0 == dl_len) { |
| 615 | jout("Elements in grown defect list: 0\n\n"); |
| 616 | jglb["scsi_elements_grown_list"] = 0; |
| 617 | } |
614 | 618 | else { |
615 | 619 | if (0 == div) |
616 | 620 | pout("Grown defect list length=%u bytes [unknown " |
617 | 621 | "number of elements]\n\n", dl_len); |
618 | | else |
619 | | pout("Elements in grown defect list: %u\n\n", dl_len / div); |
| 622 | else { |
| 623 | jout("Elements in grown defect list: %u\n\n", dl_len / div); |
| 624 | jglb["scsi_elements_grown_list"] = dl_len; |
| 625 | } |
620 | 626 | } |
621 | 627 | } |
622 | 628 | |
… |
… |
scsiPrintSeagateFactoryLPage(scsi_device * device)
|
704 | 710 | int num, pl, pc, len, err, good, bad; |
705 | 711 | unsigned char * ucp; |
706 | 712 | uint64_t ull; |
| 713 | static const char * jname = "format_status"; |
707 | 714 | |
708 | 715 | if ((err = scsiLogSense(device, SEAGATE_FACTORY_LPAGE, 0, gBuf, |
709 | 716 | LOG_RESP_LEN, 0))) { |
… |
… |
scsiPrintSeagateFactoryLPage(scsi_device * device)
|
758 | 765 | pl = ucp[3] + 4; |
759 | 766 | good = 0; |
760 | 767 | switch (pc) { |
761 | | case 0: pout(" number of hours powered up"); |
| 768 | case 0: jout(" number of hours powered up"); |
| 769 | jname = "scsi_hours_powered_up"; |
762 | 770 | good = 1; |
763 | 771 | break; |
764 | | case 8: pout(" number of minutes until next internal SMART test"); |
| 772 | case 8: jout(" number of minutes until next internal SMART test"); |
| 773 | jname = "scsi_minutes_next_smart_test"; |
765 | 774 | good = 1; |
766 | 775 | break; |
767 | 776 | default: |
… |
… |
scsiPrintSeagateFactoryLPage(scsi_device * device)
|
781 | 790 | k = (int)sizeof(ull); |
782 | 791 | } |
783 | 792 | ull = sg_get_unaligned_be(k, xp + 0); |
784 | | if (0 == pc) |
785 | | pout(" = %.2f\n", ull / 60.0 ); |
786 | | else |
787 | | pout(" = %" PRIu64 "\n", ull); |
| 793 | if (0 == pc) { |
| 794 | jout(" = %.2f\n", ull / 60.0 ); |
| 795 | jglb[jname] = strprintf("%.2f", ull / 60.0); |
| 796 | } |
| 797 | else { |
| 798 | jout(" = %" PRIu64 "\n", ull); |
| 799 | jglb[jname] = ull; |
| 800 | } |
788 | 801 | } |
789 | 802 | num -= pl; |
790 | 803 | ucp += pl; |
… |
… |
scsiPrintErrorCounterLog(scsi_device * device)
|
828 | 841 | "algorithm processed uncorrected\n"); |
829 | 842 | pout(" fast | delayed rewrites corrected " |
830 | 843 | "invocations [10^9 bytes] errors\n"); |
| 844 | |
| 845 | json::ref jref = jglb["scsi_error_counter_log"]; |
831 | 846 | for (int k = 0; k < 3; ++k) { |
832 | 847 | if (! found[k]) |
833 | 848 | continue; |
834 | 849 | ecp = &errCounterArr[k]; |
835 | 850 | static const char * const pageNames[3] = |
836 | 851 | {"read: ", "write: ", "verify: "}; |
837 | | pout("%s%8" PRIu64 " %8" PRIu64 " %8" PRIu64 " %8" PRIu64 |
| 852 | static const char * jpageNames[3] = |
| 853 | {"read", "write", "verify"}; |
| 854 | jout("%s%8" PRIu64 " %8" PRIu64 " %8" PRIu64 " %8" PRIu64 |
838 | 855 | " %8" PRIu64, pageNames[k], ecp->counter[0], |
839 | 856 | ecp->counter[1], ecp->counter[2], ecp->counter[3], |
840 | 857 | ecp->counter[4]); |
841 | 858 | double processed_gb = ecp->counter[5] / 1000000000.0; |
842 | | pout(" %12.3f %8" PRIu64 "\n", processed_gb, |
| 859 | jout(" %12.3f %8" PRIu64 "\n", processed_gb, |
843 | 860 | ecp->counter[6]); |
| 861 | // Error counter log info |
| 862 | jref[jpageNames[k]]["errors_corrected_by_eccfast"] = ecp->counter[0]; |
| 863 | jref[jpageNames[k]]["errors_corrected_by_eccdelayed"] = ecp->counter[1]; |
| 864 | jref[jpageNames[k]]["errors_corrected_by_rereads_rewrites"] = ecp->counter[2]; |
| 865 | jref[jpageNames[k]]["total_errors_corrected"] = ecp->counter[3]; |
| 866 | jref[jpageNames[k]]["correction_algorithm_invocations"] = ecp->counter[4]; |
| 867 | jref[jpageNames[k]]["gigabytes_processed"] = strprintf("%.3f", processed_gb); |
| 868 | jref[jpageNames[k]]["total_uncorrected_errors"] = ecp->counter[6]; |
844 | 869 | } |
845 | 870 | } |
846 | 871 | else |
… |
… |
scsiPrintBackgroundResults(scsi_device * device)
|
1175 | 1200 | else |
1176 | 1201 | pout("unknown [0x%x] background scan status value\n", j); |
1177 | 1202 | j = sg_get_unaligned_be32(ucp + 4); |
1178 | | pout(" Accumulated power on time, hours:minutes %d:%02d " |
| 1203 | jout(" Accumulated power on time, hours:minutes %d:%02d " |
1179 | 1204 | "[%d minutes]\n", (j / 60), (j % 60), j); |
1180 | | pout(" Number of background scans performed: %d, ", |
| 1205 | jglb["accumulated_power_on_time_minutes"] = j; |
| 1206 | jout(" Number of background scans performed: %d, ", |
1181 | 1207 | sg_get_unaligned_be16(ucp + 10)); |
| 1208 | jglb["number_sacns_performed"] = sg_get_unaligned_be16(ucp + 10); |
1182 | 1209 | pout("scan progress: %.2f%%\n", |
1183 | 1210 | (double)sg_get_unaligned_be16(ucp + 12) * 100.0 / 65536.0); |
1184 | | pout(" Number of background medium scans performed: %d\n", |
| 1211 | jout(" Number of background medium scans performed: %d\n", |
1185 | 1212 | sg_get_unaligned_be16(ucp + 14)); |
| 1213 | jglb["scsi_number_medium_scans_performed"] = sg_get_unaligned_be16(ucp + 14); |
1186 | 1214 | break; |
1187 | 1215 | default: |
1188 | 1216 | if (noheader) { |
… |
… |
scsiPrintSSMedia(scsi_device * device)
|
1274 | 1302 | print_off(); |
1275 | 1303 | return FAILSMART; |
1276 | 1304 | } |
1277 | | pout("Percentage used endurance indicator: %d%%\n", ucp[7]); |
| 1305 | jout("Percentage used endurance indicator: %d%%\n", ucp[7]); |
| 1306 | jglb["percentage_used_endurance_indicator"] = ucp[7]; |
1278 | 1307 | default: /* ignore other parameter codes */ |
1279 | 1308 | break; |
1280 | 1309 | } |
… |
… |
scsiPrintTemp(scsi_device * device)
|
2224 | 2253 | } |
2225 | 2254 | if (255 == trip) |
2226 | 2255 | pout("Drive Trip Temperature: <not available>\n"); |
2227 | | else |
2228 | | pout("Drive Trip Temperature: %d C\n", trip); |
| 2256 | else { |
| 2257 | jout("Drive Trip Temperature: %d C\n", trip); |
| 2258 | jglb["temperature"]["drive_trip"] = trip; |
| 2259 | } |
2229 | 2260 | pout("\n"); |
2230 | 2261 | } |
2231 | 2262 | |