Projet

Général

Profil

Révision bffbc23a

IDbffbc23a4e118c16b90273e331b1a5b812fe56da
Parent 675dedf1
Enfant 6f0e91f8

Ajouté par HaseHarald il y a plus de 5 ans

Fix linting issues.

Voir les différences:

plugins/disk/btrfs_device_stats
1
#!/usr/bin/python3
1
#!/usr/bin/env python3
2 2
#
3 3
# This file contains a munin-plugin to gather btrfs statistics per device.
4 4
#
......
28 28
    print("graph_title btrfs total device stats for " + fs.path)
29 29
    print("graph_category disk")
30 30
    print("graph_info This graph shows the total stats of devices used by btrfs")
31
    
31

  
32 32
    print("corruption_errs_total.label Corruption Errors")
33 33
    print("flush_errs_total.label Flush Errors")
34 34
    print("generation_errs_total.label Generation Errors")
......
36 36
    print("write_errs_total.label Write Errors")
37 37
    print("nr_items_total.label Nr. of Items")
38 38
    print("flags_total.label Nr. of Flags")
39
    
39

  
40 40
    print("")
41
    
41

  
42 42
    devices = fs.devices()
43 43
    for this_device in devices:
44 44
        this_dev_info = fs.dev_info(this_device.devid)
......
49 49
        print("graph_title btrfs device stats for " + this_dev_name)
50 50
        print("graph_category disk")
51 51
        print("graph_info This graph shows stats of devices used by btrfs")
52
        
52

  
53 53
        print("corruption_errs.label Corruption Errors")
54 54
        print("corruption_errs.warming 1")
55 55
        print("flush_errs.label Flush Errors")
......
63 63
        print("nr_items.label Nr. of Items")
64 64
        print("flags.label Nr. of Flags")
65 65
        print("flags.warming 1")
66
        
66

  
67 67
        print("")
68 68

  
69 69

  
......
75 75
    write_errs_total = 0
76 76
    nr_items_total = 0
77 77
    flags_total = 0
78
    
78

  
79 79
    fsid = str(fs.fsid).replace('-', '_')
80 80
    devices = fs.devices()
81
    
81

  
82 82
    for this_device in devices:
83 83
        this_dev_stat = fs.dev_stats(this_device.devid, False)
84
        
84

  
85 85
        corruption_errs = this_dev_stat.corruption_errs
86 86
        flush_errs = this_dev_stat.flush_errs
87 87
        generation_errs = this_dev_stat.generation_errs
......
89 89
        write_errs = this_dev_stat.write_errs
90 90
        nr_items = this_dev_stat.nr_items
91 91
        flags = this_dev_stat.flags
92
        
92

  
93 93
        corruption_errs_total = corruption_errs_total + corruption_errs
94 94
        flush_errs_total = flush_errs_total + flush_errs
95 95
        generation_errs_total = generation_errs_total + generation_errs
......
97 97
        write_errs_total = write_errs_total + write_errs
98 98
        nr_items_total = nr_items_total + nr_items
99 99
        flags_total = flags_total + flags
100
        
100

  
101 101
        print("multigraph btrfs_device_stats_" + fsid + "." + str(this_device.devid))
102
        
102

  
103 103
        print("corruption_errs.value " + str(corruption_errs))
104 104
        print("flush_errs.value " + str(flush_errs))
105 105
        print("generation_errs.value " + str(generation_errs))
......
107 107
        print("write_errs.value " + str(write_errs))
108 108
        print("nr_items.value " + str(nr_items))
109 109
        print("flags.value " + str(flags))
110
        
110

  
111 111
        print("")
112
    
112

  
113 113
    print("multigraph btrfs_device_stats_" + fsid)
114
    
114

  
115 115
    print("corruption_errs_total.value " + str(corruption_errs_total))
116 116
    print("flush_errs_total.value " + str(flush_errs_total))
117 117
    print("generation_errs_total.value " + str(generation_errs_total))
......
119 119
    print("write_errs_total.value " + str(write_errs_total))
120 120
    print("nr_items_total.value " + str(nr_items_total))
121 121
    print("flags_total.value " + str(flags_total))
122
    
122

  
123 123
    print("")
124 124

  
125 125

  

Formats disponibles : Unified diff