<commit_before># uses http://wiki.nginx.org/HttpStubStatusModule

class ZabbixRubyClient
  module Plugins
    module Nginx
      extend self

      def collect(*args)
        host = args[0]
        info = get_status

        time = Time.now.to_i
        back = []
        back << "#{host} nginx[total] #{time} #{ret[:total]}"
        back << "#{host} nginx[reading] #{time} #{ret[:reading]}"
        back << "#{host} nginx[writing] #{time} #{ret[:writing]}"
        back << "#{host} nginx[waiting] #{time} #{ret[:waiting]}"
        back << "#{host} nginx[accepted] #{time} #{ret[:accepted]}"
        back << "#{host} nginx[handled] #{time} #{ret[:handled]}"
        back << "#{host} nginx[requests] #{time} #{ret[:requests]}"
        return back
      end

      def get_status
        ret = {}
        open "http://127.0.0.1:8090/nginx_status" do |f|
          f.each_line do |line|<commit_msg>more nginx fixes<commit_after># uses http://wiki.nginx.org/HttpStubStatusModule

class ZabbixRubyClient
  module Plugins
    module Nginx
      extend self

      def collect(*args)
        host = args[0]
        info = get_status

        time = Time.now.to_i
        back = []
        back << "#{host} nginx[total] #{time} #{info[:total]}"
        back << "#{host} nginx[reading] #{time} #{info[:reading]}"
        back << "#{host} nginx[writing] #{time} #{info[:writing]}"
        back << "#{host} nginx[waiting] #{time} #{info[:waiting]}"
        back << "#{host} nginx[accepted] #{time} #{info[:accepted]}"
        back << "#{host} nginx[handled] #{time} #{info[:handled]}"
        back << "#{host} nginx[requests] #{time} #{info[:requests]}"
        return back
      end

      def get_status
        ret = {}
        open "http://127.0.0.1:8090/nginx_status" do |f|
          f.each_line do |line|
{'fraction_non_alphanumeric': 0.18555555555555556, 'fraction_numerical': 0.012222222222222223, 'mean_word_length': 2.5663366336633664, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4027812', 'n_tokens_mistral': 640, 'n_tokens_neox': 600, 'n_words': 137}