This file is indexed.

/usr/lib/ruby/vendor_ruby/mcollective/runnerstats.rb is in mcollective-common 2.6.0+dfsg-2.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
module MCollective
  # Class to store stats about the mcollectived, it should live in the PluginManager
  # so that agents etc can get hold of it and return the stats to callers
  class RunnerStats
    def initialize
      @starttime = Time.now.to_i
      @validated = 0
      @unvalidated = 0
      @filtered = 0
      @passed = 0
      @total = 0
      @replies = 0
      @ttlexpired = 0

      @mutex = Mutex.new
    end

    # Records a message that failed TTL checks
    def ttlexpired
      Log.debug("Incrementing ttl expired stat")
      @ttlexpired += 1
    end

    # Records a message that passed the filters
    def passed
      Log.debug("Incrementing passed stat")
      @passed += 1
    end

    # Records a message that didnt pass the filters
    def filtered
      Log.debug("Incrementing filtered stat")
      @filtered += 1
    end

    # Records a message that validated ok
    def validated
      Log.debug("Incrementing validated stat")
      @validated += 1
    end

    def unvalidated
      Log.debug("Incrementing unvalidated stat")
      @unvalidated += 1
    end

    # Records receipt of a message
    def received
      Log.debug("Incrementing total stat")
      @total += 1
    end

    # Records sending a message
    def sent
      @mutex.synchronize do
        Log.debug("Incrementing replies stat")
        @replies += 1
      end
    end

    # Returns a hash with all stats
    def to_hash
      stats = {:validated => @validated,
        :unvalidated => @unvalidated,
        :passed => @passed,
        :filtered => @filtered,
        :starttime => @starttime,
        :total => @total,
        :ttlexpired => @ttlexpired,
        :replies => @replies}

      reply = {:stats => stats,
        :threads => [],
        :pid => Process.pid,
        :times => {} }

      ::Process.times.each_pair{|k,v|
        k = k.to_sym
        reply[:times][k] = v
      }

      Thread.list.each do |t|
        reply[:threads] << "#{t.inspect}"
      end

      reply[:agents] = Agents.agentlist
      reply
    end
  end
end