Skip to main content

Config reader for mimamorisan

Project description

Windchill Metric Config

Configuration parser for windchill prometheus metrics. Parses json and yaml configuration files into a Python object.

End result is a grafana dashboard as follows:

Usage

To load the python object with a yaml file (as shown in chapter Example Config) change variable and save it again.

from windchill_metric_config.configurator import Metrics
metrics_config = Metrics()
dict_config = {
  system: {
    memory_total_bytes: {
      id: "process_real_memory_total_bytes",
      labels: [
        "host",
        "resource_type",
        "environment",
        "company"
      ],
      description: "system total memory in bytes",
      enabled: true
    }
  }
}
metrics_config.load_config_from_yaml_file(yaml_config_file)

metrics_config.system.cpu_usage.enabled = True

metrics_config.save_as_yaml('/config/second_config.yaml')

To load the python object as a dict (as shown in chapter Example Config) change variable and save it again.

from windchill_metric_config.configurator import Metrics
metrics_config = Metrics()

metrics_config.set_config(yaml_config_file)

print('show me the config as dict {}'.format(metrics_config.as_dict()))

To validate metrics you can call the function "validate_metric"

from windchill_metric_config.configurator import Metrics
metrics_config = Metrics()
yaml_config_file = '/config/first_config.yaml'
metrics_config.load_config_from_yaml_file(yaml_config_file)

some_metrics = {
  metric_id: "process_real_memory_total_bytes",
  labels: [
    {
      key: "environment",
      value: "anton500"
    }
  ],
  value: 20.35
}

validate = metrics_config.validate_metric(some_metrics)
print('is metric valid: {}'.format(validate))

Example Config

An Overview of all scrapeable metrics is shown below:

system:
  process_real_memory_total_bytes: false                                        # system total memory in bytes
  process_real_memory_used_bytes: false                                         # system used memory in bytes
  process_cpu_usage_percent: false                                              # cpu utilisation in percent
  process_disc_total_bytes: false                                               # total disc space in bytes
  process_disc_used_bytes: false                                                # used disc space in bytes
  process_users_total_count: false                                              # count of logged in users on os
  system_boot_timestamp: false                                                  # boot timestamp as label in iso format (ex, 2019-09-07T15:50-04:00)
  system_stats_info: false                                                      # various information about the host system, (logical cpu count, machine, node, physical_cpu_count, processor, os system, version and release)
  network:
    process_network_bytes_sent: false                                           # bytes sent over all network addresses
    process_network_packets_recv: false                                         # bytes received over all network addresses
    process_network_err_in: false                                               # total number of errors while receiving
    process_network_err_out: false                                              # total number of errors while sending
    process_network_drop_in: false                                              # total number of incoming packets which were dropped
    process_network_drop_out: false                                             # total number of outgoing packets which were dropped (always 0 on macOS and BSD)
  process_windows_service_status: false                                         # windows service information (only available on windows machines)
windchill:
  windchill_apache_status: false                                                # windchill apache status (503=not running, >1=http code)
  windchill_windchill_status: false                                             # windchill app status (503=not running, >1=http code)
  windchill_api_response_time_seconds: false                                    # windchill api (/Windchill/api/v1/publishmonitor/getworkerinfo.jsp) response time
  windchill_active_users_total: false                                           # windchill total active users count
  windchill_version_info: false                                                 # windchill version and release info
  windchill_version_info_simple: false                                          # windchill version and release info
  windchill_installed_languages: false                                          # windchill installed languages
  method_server:
    windchill_server_status_runtime_start_time: false                           # windchill apache status (0=not running, >1=http code)
    windchill_server_status_runtime_uptime: false                               # windchill apache status (0=not running, >1=http code)
  queue_worker:
    windchill_worker_status: false                                              # windchill worker status (0=Off, 1=On, 2=Busy, 3=FailsToStart, 4=NotDefined)
    windchill_queue_jobs_failed: false                                          # windchill queue failed jobs amount
    windchill_queue_jobs_total: false                                           # windchill queue total jobs queue count
  garbage_collector:
    windchill_garbage_coll_time_spent_in_threshold_percent: false               # Garbage collection time spent in threshold percent
    windchill_garbage_coll_recent_time_spent_percent: false                     # Garbage collection time spent recent percent
    windchill_garbage_coll_overall_time_spent_percent: false                    # Garbage collection time spent overall percent
  memory:
    windchill_memory_heap_usage_threshold_percent: false                        # Heap memory usage threshold in percent
    windchill_memory_heap_usage_percent: false                                  # Heap memory usage in percent
    windchill_memory_perm_gen_usage_threshold_percent: false                    # Perm gen memory usage threshold in percent
    windchill_memory_perm_gen_usage_percent: false                              # Perm gen memory usage in percent
  method_context:
    windchill_mc_active_context_average: false                                  # activeContextsAverage
    windchill_mc_active_context_end: false                                      # activeContextsEnd
    windchill_mc_active_context_max: false                                      # activeContextsMax
    windchill_mc_active_context_start: false                                    # activeContextsStart
    windchill_mc_blocked_count_per_context: false                               # averageBlockedCountPerContext
    windchill_mc_cobra_calls_per_context_average: false                         # averageCORBACallsPerContext
    windchill_mc_jdbc_calls_per_context_average: false                          # averageJDBCCallsPerContext
    windchill_mc_jndi_calls_per_context_average: false                          # averageJNDICallsPerContext
    windchill_mc_remote_cache_calls_per_context_average: false                  # averageRemoteCacheCallsPerContext
    windchill_mc_waited_count_per_context: false                                # averageWaitedCountPerContext
    windchill_mc_completed_context: false                                       # completedContexts
    windchill_mc_cpu_seconds_average: false                                     # contextCpuSecondsAverage
    windchill_mc_jdbc_conn_wait_seconds_average: false                          # contextJDBCConnWaitSecondsAverage
    windchill_mc_seconds_average: false                                         # contextSecondsAverage
    windchill_mc_seconds_max: false                                             # contextSecondsMax
    windchill_mc_user_seconds_average: false                                    # contextUserSecondsAverage
    windchill_mc_context_per_seconds: false                                     # contextsPerSecond
    windchill_mc_error_count: false                                             # errorCount
    windchill_mc_blocked_time_per_context_percentage: false                     # percentageOfContextTimeBlocked
    windchill_mc_cobra_time_of_context_percentage: false                        # percentageOfContextTimeInCORBACalls
    windchill_mc_jdbc_time_of_context_percentage: false                         # percentageOfContextTimeInJDBCCalls
    windchill_mc_jdbc_time_conn_wait_percentage: false                          # windchill_mc_jdbc_time_conn_wait_percentage
    windchill_mc_jndi_time_of_context_percentage: false                         # percentageOfContextTimeInJDBCConnWait
    windchill_mc_remote_cache_time_of_context_percentage: false                 # percentageOfContextTimeInJNDICalls
    windchill_mc_time_waited_time_of_context_percentage: false                  # percentageOfContextTimeWaited
    windchill_mc_redirect_count: false                                          # redirectCount
  sessions:
    windchill_active_sessions_average: false                                    # activeSessionsAverage
    windchill_active_sessions_end: false                                        # activeSessionsEnd
    windchill_active_sessions_max: false                                        # activeSessionsMax
    windchill_active_sessions_start: false                                      # activeSessionsStart
    windchill_sessions_activated: false                                         # sessionsActivated
    windchill_sessions_created: false                                           # sessionsCreated
    windchill_sessions_destroyed: false                                         # sessionsDestroyed
    windchill_sessions_passivated: false                                        # sessionsPassivated
  servlet_requests:
    windchill_servlet_active_requests_average: false                            # activeRequestsAverage
    windchill_servlet_active_requests_end: false                                # activeRequestsEnd
    windchill_servlet_active_requests_max: false                                # activeRequestsMax
    windchill_servlet_active_requests_start: false                              # activeRequestsStart
    windchill_servlet_blocked_count_per_request: false                          # averageBlockedCountPerRequest
    windchill_servlet_ie_calls_per_request: false                               # averageIECallsPerRequest
    windchill_servlet_jndi_calls_per_request: false                             # averageJNDICallsPerRequest
    windchill_servlet_rmi_calls_per_request: false                              # averageRMICallsPerRequest
    windchill_servlet_soap_call_per_request: false                              # averageSOAPCallsPerRequest
    windchill_servlet_waited_count_per_request: false                           # averageWaitedCountPerRequest
    windchill_servlet_completed_requests: false                                 # completedRequests
    windchill_servlet_error_count: false                                        # errorCount
    windchill_servlet_blocked_time_percentage: false                            # percentageOfRequestTimeBlocked
    windchill_servlet_ie_calls_time_percentage: false                           # percentageOfRequestTimeInIECalls
    windchill_servlet_jndi_calls_time_percentage: false                         # percentageOfRequestTimeInJNDICalls
    windchill_servlet_rmi_calls_time_percentage: false                          # percentageOfRequestTimeInRMICalls
    windchill_servlet_soap_calls_time_percentage: false                         # percentageOfRequestTimeInSOAPCalls
    windchill_servlet_time_waited_percentage: false                             # percentageOfRequestTimeWaited
    windchill_servlet_cpu_seconds_average: false                                # requestCpuSecondsAverage
    windchill_servlet_requests_seconds_average: false                           # requestSecondsAverage
    windchill_servlet_requests_seconds_max: false                               # requestSecondsMax
    windchill_servlet_requests_user_seconds_average: false                      # requestUserSecondsAverage
    windchill_servlet_requests_per_second: false                                # requestsPerSecond

upload to pypi.org

py -m build
py -m twine upload --repository pypi dist/*

Changelog

v0.0.32

  • more labels (former company and environment => new label1, label2, label3, label4)
  • better documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

windchill-metric-config-0.0.32.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

windchill_metric_config-0.0.32-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file windchill-metric-config-0.0.32.tar.gz.

File metadata

  • Download URL: windchill-metric-config-0.0.32.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for windchill-metric-config-0.0.32.tar.gz
Algorithm Hash digest
SHA256 bbee0a5d5d12f6e9ac573d84239909f41ed4e3470b82ea504eab05cd673f5efe
MD5 01e56625da13656d209b4a0eedcc1c39
BLAKE2b-256 b2a385c972ab46960db79720683326809c0ac47ad45a253ccea441531e1b8b64

See more details on using hashes here.

File details

Details for the file windchill_metric_config-0.0.32-py3-none-any.whl.

File metadata

  • Download URL: windchill_metric_config-0.0.32-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for windchill_metric_config-0.0.32-py3-none-any.whl
Algorithm Hash digest
SHA256 61f837abde0cc6c7bfd1849e591a822c2b1d3b09a1e9284d85f683d993008149
MD5 c755f4d90075086c91cca8aa9ccbce9c
BLAKE2b-256 80dfc2032ccf4c459ac1211b72fd557a76698e979e3f85bd53ea47ab8fc6d0a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page