flexmetric 0.2.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {flexmetric-0.2.0 → flexmetric-0.3.0}/PKG-INFO +41 -10
  2. {flexmetric-0.2.0 → flexmetric-0.3.0}/README.md +39 -8
  3. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric/metric_process/prometheus_agent.py +34 -19
  4. flexmetric-0.3.0/flexmetric/metric_process/views.py +38 -0
  5. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric.egg-info/PKG-INFO +41 -10
  6. {flexmetric-0.2.0 → flexmetric-0.3.0}/setup.py +2 -2
  7. flexmetric-0.2.0/flexmetric/metric_process/views.py +0 -29
  8. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric/__init__.py +0 -0
  9. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric/config/__init__.py +0 -0
  10. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric/config/configuration.py +0 -0
  11. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric/file_recognition/__init__.py +0 -0
  12. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric/file_recognition/exec_file.py +0 -0
  13. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric/logging_module/__init__.py +0 -0
  14. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric/logging_module/logger.py +0 -0
  15. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric/metric_process/__init__.py +0 -0
  16. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric/metric_process/database_processing.py +0 -0
  17. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric/metric_process/expiring_queue.py +0 -0
  18. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric/metric_process/process_commands.py +0 -0
  19. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric.egg-info/SOURCES.txt +0 -0
  20. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric.egg-info/dependency_links.txt +0 -0
  21. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric.egg-info/entry_points.txt +0 -0
  22. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric.egg-info/requires.txt +0 -0
  23. {flexmetric-0.2.0 → flexmetric-0.3.0}/flexmetric.egg-info/top_level.txt +0 -0
  24. {flexmetric-0.2.0 → flexmetric-0.3.0}/setup.cfg +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flexmetric
3
- Version: 0.2.0
4
- Summary: A flexible Prometheus exporter for commands, databases, functions, and scripts.
3
+ Version: 0.3.0
4
+ Summary: A secure flexible Prometheus exporter for commands, databases, functions, and scripts.
5
5
  Home-page: https://github.com/nikhillingadhal1999/custom_prometheus_agent
6
6
  Author: Nikhil Lingadhal
7
7
  License: MIT
@@ -29,18 +29,23 @@ Dynamic: summary
29
29
 
30
30
  # FlexMetric
31
31
 
32
- FlexMetric is a lightweight, flexible, and extensible Prometheus exporter that allows you to expose system metrics, database query results, Python function outputs, and externally submitted metrics via an optional Flask API as Prometheus-compatible metricswith minimal setup and maximum customization.
32
+ FlexMetric is a lightweight, flexible, and extensible Prometheus exporter that allows you to securely expose system metrics, database query results, Python function outputs, and externally submitted metricsvia an optional Flask API with HTTPS support—as Prometheus-compatible metrics, all with minimal setup and maximum customization.
33
33
 
34
34
  ---
35
35
 
36
36
  ## Features
37
37
 
38
- - Run shell commands and expose the results as Prometheus metrics.
39
- - Execute SQL queries (e.g., SQLite) and monitor database statistics.
38
+ - Run shell commands and expose the results as Prometheus metrics.
39
+ **Harmful commands (e.g., file deletion, system shutdown) are blocked for safety.**
40
+ - Execute SQL queries (e.g., SQLite) and monitor database statistics.
41
+ ➔ **Potentially dangerous queries (e.g., `DROP`, `DELETE`, `TRUNCATE`) are not allowed.**
40
42
  - Automatically discover and expose Python function outputs as metrics.
41
43
  - Expose an optional **Flask API** (`/update_metric`) to receive external metrics dynamically.
42
44
  - Modular and easy to extend—add your own custom integrations.
43
45
  - Built-in Prometheus HTTP server (`/metrics`) with configurable port.
46
+ - **Supports HTTPS** to securely expose both metrics and API endpoints.
47
+ - **Input sanitization** is performed to ensure only safe commands and queries are executed.
48
+
44
49
 
45
50
  ---
46
51
 
@@ -86,7 +91,7 @@ To use the Flask API for submitting external metrics, you need to start the agen
86
91
  ### Start FlexMetric with Flask API
87
92
 
88
93
  ```bash
89
- flexmetric --expose-api --flask-port <port> --flask-host <host> --metrics-port <metrics-port>
94
+ flexmetric --expose-api --port <port> --host <host>
90
95
  ```
91
96
 
92
97
  ## Example: Running FlexMetric with Flask API
@@ -94,11 +99,11 @@ flexmetric --expose-api --flask-port <port> --flask-host <host> --metrics-port <
94
99
  To run FlexMetric with both Prometheus metrics and the Flask API enabled:
95
100
 
96
101
  ```bash
97
- flexmetric --expose-api --flask-port 5000 --flask-host 0.0.0.0 --port 8000
102
+ flexmetric --expose-api --port 5000 --host 0.0.0.0
98
103
  ```
99
104
 
100
105
  Prometheus metrics exposed at:
101
- http://localhost:8000/metrics
106
+ http://localhost:5000/metrics
102
107
 
103
108
  Flask API exposed at:
104
109
  http://localhost:5000/update_metric
@@ -116,6 +121,30 @@ curl -X POST http://localhost:5000/update_metric \
116
121
 
117
122
  ```
118
123
 
124
+ ### Using flex metrics in secure mode
125
+
126
+ ```bash
127
+ flexmetric --port 5000 --host 0.0.0.0 --enable-https --ssl-cert=cert.pem --ssl-key=key.pem
128
+ ```
129
+ Prometheus metrics exposed at:
130
+ https://localhost:5000/metrics
131
+
132
+ Flask API exposed at:
133
+ https://localhost:5000/update_metric
134
+
135
+ ### Submitting a Metric to the Flask API
136
+ ```bash
137
+ curl -k -X POST https://localhost:5000/update_metric \
138
+ -H "Content-Type: application/json" \
139
+ -d '{
140
+ "result": [
141
+ { "label": "cpu_usage", "value": 42.5 }
142
+ ],
143
+ "labels": ["cpu"]
144
+ }'
145
+
146
+ ```
147
+
119
148
  ### commands.yaml
120
149
 
121
150
  ```yaml
@@ -181,11 +210,13 @@ The following command-line options are available when running FlexMetric:
181
210
  | `--queries-config` | Path to queries YAML file | `queries.yaml` |
182
211
  | `--functions` | Enable Python functions mode | |
183
212
  | `--functions-file` | Path to functions file | `executable_functions.txt` |
184
- | `--scripts` | Enable shell scripts mode | |
185
- | `--scripts-config` | Path to scripts YAML file | `scripts.yaml` |
186
213
  | `--expose-api` | Enable Flask API mode to receive external metrics | |
187
214
  | `--flask-port` | Port for the Flask API (`/update_metric`) | `5000` |
188
215
  | `--flask-host` | Hostname for the Flask API | `0.0.0.0` |
216
+ | `--enable-https` | Enable HTTPS for the Flask API | |
217
+ | `--ssl-cert` | Path to SSL certificate file (`cert.pem`) | |
218
+ | `--ssl-key` | Path to SSL private key file (`key.pem`) | |
219
+
189
220
  ### Example Command:
190
221
 
191
222
  ```bash
@@ -1,17 +1,22 @@
1
1
  # FlexMetric
2
2
 
3
- FlexMetric is a lightweight, flexible, and extensible Prometheus exporter that allows you to expose system metrics, database query results, Python function outputs, and externally submitted metrics via an optional Flask API as Prometheus-compatible metricswith minimal setup and maximum customization.
3
+ FlexMetric is a lightweight, flexible, and extensible Prometheus exporter that allows you to securely expose system metrics, database query results, Python function outputs, and externally submitted metricsvia an optional Flask API with HTTPS support—as Prometheus-compatible metrics, all with minimal setup and maximum customization.
4
4
 
5
5
  ---
6
6
 
7
7
  ## Features
8
8
 
9
- - Run shell commands and expose the results as Prometheus metrics.
10
- - Execute SQL queries (e.g., SQLite) and monitor database statistics.
9
+ - Run shell commands and expose the results as Prometheus metrics.
10
+ **Harmful commands (e.g., file deletion, system shutdown) are blocked for safety.**
11
+ - Execute SQL queries (e.g., SQLite) and monitor database statistics.
12
+ ➔ **Potentially dangerous queries (e.g., `DROP`, `DELETE`, `TRUNCATE`) are not allowed.**
11
13
  - Automatically discover and expose Python function outputs as metrics.
12
14
  - Expose an optional **Flask API** (`/update_metric`) to receive external metrics dynamically.
13
15
  - Modular and easy to extend—add your own custom integrations.
14
16
  - Built-in Prometheus HTTP server (`/metrics`) with configurable port.
17
+ - **Supports HTTPS** to securely expose both metrics and API endpoints.
18
+ - **Input sanitization** is performed to ensure only safe commands and queries are executed.
19
+
15
20
 
16
21
  ---
17
22
 
@@ -57,7 +62,7 @@ To use the Flask API for submitting external metrics, you need to start the agen
57
62
  ### Start FlexMetric with Flask API
58
63
 
59
64
  ```bash
60
- flexmetric --expose-api --flask-port <port> --flask-host <host> --metrics-port <metrics-port>
65
+ flexmetric --expose-api --port <port> --host <host>
61
66
  ```
62
67
 
63
68
  ## Example: Running FlexMetric with Flask API
@@ -65,11 +70,11 @@ flexmetric --expose-api --flask-port <port> --flask-host <host> --metrics-port <
65
70
  To run FlexMetric with both Prometheus metrics and the Flask API enabled:
66
71
 
67
72
  ```bash
68
- flexmetric --expose-api --flask-port 5000 --flask-host 0.0.0.0 --port 8000
73
+ flexmetric --expose-api --port 5000 --host 0.0.0.0
69
74
  ```
70
75
 
71
76
  Prometheus metrics exposed at:
72
- http://localhost:8000/metrics
77
+ http://localhost:5000/metrics
73
78
 
74
79
  Flask API exposed at:
75
80
  http://localhost:5000/update_metric
@@ -87,6 +92,30 @@ curl -X POST http://localhost:5000/update_metric \
87
92
 
88
93
  ```
89
94
 
95
+ ### Using flex metrics in secure mode
96
+
97
+ ```bash
98
+ flexmetric --port 5000 --host 0.0.0.0 --enable-https --ssl-cert=cert.pem --ssl-key=key.pem
99
+ ```
100
+ Prometheus metrics exposed at:
101
+ https://localhost:5000/metrics
102
+
103
+ Flask API exposed at:
104
+ https://localhost:5000/update_metric
105
+
106
+ ### Submitting a Metric to the Flask API
107
+ ```bash
108
+ curl -k -X POST https://localhost:5000/update_metric \
109
+ -H "Content-Type: application/json" \
110
+ -d '{
111
+ "result": [
112
+ { "label": "cpu_usage", "value": 42.5 }
113
+ ],
114
+ "labels": ["cpu"]
115
+ }'
116
+
117
+ ```
118
+
90
119
  ### commands.yaml
91
120
 
92
121
  ```yaml
@@ -152,11 +181,13 @@ The following command-line options are available when running FlexMetric:
152
181
  | `--queries-config` | Path to queries YAML file | `queries.yaml` |
153
182
  | `--functions` | Enable Python functions mode | |
154
183
  | `--functions-file` | Path to functions file | `executable_functions.txt` |
155
- | `--scripts` | Enable shell scripts mode | |
156
- | `--scripts-config` | Path to scripts YAML file | `scripts.yaml` |
157
184
  | `--expose-api` | Enable Flask API mode to receive external metrics | |
158
185
  | `--flask-port` | Port for the Flask API (`/update_metric`) | `5000` |
159
186
  | `--flask-host` | Hostname for the Flask API | `0.0.0.0` |
187
+ | `--enable-https` | Enable HTTPS for the Flask API | |
188
+ | `--ssl-cert` | Path to SSL certificate file (`cert.pem`) | |
189
+ | `--ssl-key` | Path to SSL private key file (`key.pem`) | |
190
+
160
191
  ### Example Command:
161
192
 
162
193
  ```bash
@@ -11,7 +11,11 @@ from flexmetric.metric_process.database_processing import process_database_queri
11
11
  from flexmetric.metric_process.expiring_queue import metric_queue
12
12
  import argparse
13
13
  import os
14
- from flexmetric.metric_process.views import run_flask
14
+ from flexmetric.metric_process.views import (
15
+ run_flask,
16
+ add_update_metric_route,
17
+ secure_flask_run,
18
+ )
15
19
  import sched
16
20
  import threading
17
21
 
@@ -77,16 +81,25 @@ def arguments():
77
81
  "--port", type=int, default=8000, help="port on which exportor runs"
78
82
  )
79
83
  parser.add_argument(
80
- "--flask-host",
84
+ "--host",
81
85
  type=str,
82
86
  default="0.0.0.0",
83
87
  help="The hostname or IP address on which to run the Flask server (default: 0.0.0.0)",
84
88
  )
85
89
  parser.add_argument(
86
- "--flask-port",
87
- type=int,
88
- default=5000,
89
- help="The port number on which to run the Flask server (default: 5000)",
90
+ "--enable-https",
91
+ action="store_true",
92
+ help="Enable HTTPS for Flask API using SSL certificates.",
93
+ )
94
+ parser.add_argument(
95
+ "--ssl-cert",
96
+ type=str,
97
+ help="Path to the SSL certificate file (cert.pem) for HTTPS.",
98
+ )
99
+ parser.add_argument(
100
+ "--ssl-key",
101
+ type=str,
102
+ help="Path to the SSL private key file (key.pem) for HTTPS.",
90
103
  )
91
104
 
92
105
  return parser.parse_args()
@@ -111,7 +124,9 @@ gauges = {}
111
124
  def validate_required_files(mode_name, required_files):
112
125
  missing = [desc for desc, path in required_files.items() if path == None]
113
126
  if missing:
114
- print(f"Missing {', '.join(missing)} for '{mode_name}' mode. Skipping...")
127
+ logger.error(
128
+ f"Missing {', '.join(missing)} for '{mode_name}' mode. Skipping..."
129
+ )
115
130
  return False
116
131
 
117
132
  return True
@@ -147,7 +162,8 @@ def validate_all_modes(args):
147
162
  "functions-file": args.functions_file,
148
163
  },
149
164
  ),
150
- (args.expose_api, "expose-api", {})
165
+ (args.expose_api, "expose-api", {}),
166
+ (args.enable_https,"enable-https",{"ssl-cert":args.ssl_cert,"ssl-key" :args.ssl_key})
151
167
  ]
152
168
 
153
169
  for is_enabled, mode_name, files in mode_validations:
@@ -161,7 +177,6 @@ def validate_all_modes(args):
161
177
  def measure(args):
162
178
  exec_result = []
163
179
  queue_items = metric_queue.pop_all()
164
- print("QUEUE_ITEMS : ", queue_items)
165
180
  if len(queue_items) != 0:
166
181
  exec_result.extend(queue_items)
167
182
  if args.database:
@@ -186,7 +201,6 @@ def measure(args):
186
201
  else:
187
202
  gauge = gauges[gauge_name]
188
203
  for result in results:
189
- print(result, isinstance(result["label"], list))
190
204
  if isinstance(result["label"], str):
191
205
  try:
192
206
  gauge.labels(result["label"]).set(
@@ -211,23 +225,24 @@ def start_scheduler(args):
211
225
 
212
226
  def main():
213
227
  args = arguments()
214
- print("Validating configuration...")
228
+ logger.info("Validating configuration...")
215
229
  if not validate_all_modes(args):
216
- print("No valid modes with proper configuration found. Exiting.")
230
+ logger.error("No valid modes with proper configuration found. Exiting.")
217
231
  exit(1)
218
232
 
219
- print(f"Starting Prometheus metrics server on port {args.port}...")
220
- print("Starting server")
221
- start_http_server(args.port)
233
+ logger.info(f"Starting Prometheus metrics server on port {args.port}...")
234
+ logger.info("Starting server")
235
+ # start_http_server(args.port)
236
+
222
237
  scheduler_thread = threading.Thread(
223
238
  target=start_scheduler, args=(args,), daemon=True
224
239
  )
225
240
  scheduler_thread.start()
226
241
  if args.expose_api:
227
- run_flask(args.flask_host, args.flask_port)
242
+ add_update_metric_route()
243
+ if args.enable_https:
244
+ secure_flask_run(args)
228
245
  else:
229
- while True:
230
- time.sleep(2)
231
-
246
+ run_flask(args.host, args.port)
232
247
 
233
248
  main()
@@ -0,0 +1,38 @@
1
+ from flask import Flask, request, jsonify, Response
2
+ from flexmetric.metric_process.expiring_queue import metric_queue
3
+ import argparse
4
+ from prometheus_client import generate_latest, REGISTRY, CONTENT_TYPE_LATEST
5
+
6
+ app = Flask(__name__)
7
+
8
+
9
+ @app.route('/metrics')
10
+ def metrics():
11
+ return Response(generate_latest(REGISTRY), mimetype=CONTENT_TYPE_LATEST)
12
+
13
+
14
+ def add_update_metric_route():
15
+ @app.route("/update_metric", methods=["POST"])
16
+ def update_metric():
17
+ try:
18
+ data = request.get_json()
19
+
20
+ if not data or "result" not in data or not isinstance(data["result"], list):
21
+ return jsonify({"status": "no"}), 400
22
+
23
+ for item in data["result"]:
24
+ if "label" not in item or "value" not in item:
25
+ return jsonify({"status": "no"}), 400
26
+
27
+ metric_queue.put(data)
28
+ print(metric_queue)
29
+ return jsonify({"status": "success"}), 200
30
+
31
+ except Exception:
32
+ return jsonify({"status": "no"}), 500
33
+
34
+
35
+ def run_flask(host, port):
36
+ app.run(host=host, port=port)
37
+ def secure_flask_run(args):
38
+ app.run(host=args.host, port=args.port, ssl_context=(args.ssl_cert, args.ssl_key))
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flexmetric
3
- Version: 0.2.0
4
- Summary: A flexible Prometheus exporter for commands, databases, functions, and scripts.
3
+ Version: 0.3.0
4
+ Summary: A secure flexible Prometheus exporter for commands, databases, functions, and scripts.
5
5
  Home-page: https://github.com/nikhillingadhal1999/custom_prometheus_agent
6
6
  Author: Nikhil Lingadhal
7
7
  License: MIT
@@ -29,18 +29,23 @@ Dynamic: summary
29
29
 
30
30
  # FlexMetric
31
31
 
32
- FlexMetric is a lightweight, flexible, and extensible Prometheus exporter that allows you to expose system metrics, database query results, Python function outputs, and externally submitted metrics via an optional Flask API as Prometheus-compatible metricswith minimal setup and maximum customization.
32
+ FlexMetric is a lightweight, flexible, and extensible Prometheus exporter that allows you to securely expose system metrics, database query results, Python function outputs, and externally submitted metricsvia an optional Flask API with HTTPS support—as Prometheus-compatible metrics, all with minimal setup and maximum customization.
33
33
 
34
34
  ---
35
35
 
36
36
  ## Features
37
37
 
38
- - Run shell commands and expose the results as Prometheus metrics.
39
- - Execute SQL queries (e.g., SQLite) and monitor database statistics.
38
+ - Run shell commands and expose the results as Prometheus metrics.
39
+ **Harmful commands (e.g., file deletion, system shutdown) are blocked for safety.**
40
+ - Execute SQL queries (e.g., SQLite) and monitor database statistics.
41
+ ➔ **Potentially dangerous queries (e.g., `DROP`, `DELETE`, `TRUNCATE`) are not allowed.**
40
42
  - Automatically discover and expose Python function outputs as metrics.
41
43
  - Expose an optional **Flask API** (`/update_metric`) to receive external metrics dynamically.
42
44
  - Modular and easy to extend—add your own custom integrations.
43
45
  - Built-in Prometheus HTTP server (`/metrics`) with configurable port.
46
+ - **Supports HTTPS** to securely expose both metrics and API endpoints.
47
+ - **Input sanitization** is performed to ensure only safe commands and queries are executed.
48
+
44
49
 
45
50
  ---
46
51
 
@@ -86,7 +91,7 @@ To use the Flask API for submitting external metrics, you need to start the agen
86
91
  ### Start FlexMetric with Flask API
87
92
 
88
93
  ```bash
89
- flexmetric --expose-api --flask-port <port> --flask-host <host> --metrics-port <metrics-port>
94
+ flexmetric --expose-api --port <port> --host <host>
90
95
  ```
91
96
 
92
97
  ## Example: Running FlexMetric with Flask API
@@ -94,11 +99,11 @@ flexmetric --expose-api --flask-port <port> --flask-host <host> --metrics-port <
94
99
  To run FlexMetric with both Prometheus metrics and the Flask API enabled:
95
100
 
96
101
  ```bash
97
- flexmetric --expose-api --flask-port 5000 --flask-host 0.0.0.0 --port 8000
102
+ flexmetric --expose-api --port 5000 --host 0.0.0.0
98
103
  ```
99
104
 
100
105
  Prometheus metrics exposed at:
101
- http://localhost:8000/metrics
106
+ http://localhost:5000/metrics
102
107
 
103
108
  Flask API exposed at:
104
109
  http://localhost:5000/update_metric
@@ -116,6 +121,30 @@ curl -X POST http://localhost:5000/update_metric \
116
121
 
117
122
  ```
118
123
 
124
+ ### Using flex metrics in secure mode
125
+
126
+ ```bash
127
+ flexmetric --port 5000 --host 0.0.0.0 --enable-https --ssl-cert=cert.pem --ssl-key=key.pem
128
+ ```
129
+ Prometheus metrics exposed at:
130
+ https://localhost:5000/metrics
131
+
132
+ Flask API exposed at:
133
+ https://localhost:5000/update_metric
134
+
135
+ ### Submitting a Metric to the Flask API
136
+ ```bash
137
+ curl -k -X POST https://localhost:5000/update_metric \
138
+ -H "Content-Type: application/json" \
139
+ -d '{
140
+ "result": [
141
+ { "label": "cpu_usage", "value": 42.5 }
142
+ ],
143
+ "labels": ["cpu"]
144
+ }'
145
+
146
+ ```
147
+
119
148
  ### commands.yaml
120
149
 
121
150
  ```yaml
@@ -181,11 +210,13 @@ The following command-line options are available when running FlexMetric:
181
210
  | `--queries-config` | Path to queries YAML file | `queries.yaml` |
182
211
  | `--functions` | Enable Python functions mode | |
183
212
  | `--functions-file` | Path to functions file | `executable_functions.txt` |
184
- | `--scripts` | Enable shell scripts mode | |
185
- | `--scripts-config` | Path to scripts YAML file | `scripts.yaml` |
186
213
  | `--expose-api` | Enable Flask API mode to receive external metrics | |
187
214
  | `--flask-port` | Port for the Flask API (`/update_metric`) | `5000` |
188
215
  | `--flask-host` | Hostname for the Flask API | `0.0.0.0` |
216
+ | `--enable-https` | Enable HTTPS for the Flask API | |
217
+ | `--ssl-cert` | Path to SSL certificate file (`cert.pem`) | |
218
+ | `--ssl-key` | Path to SSL private key file (`key.pem`) | |
219
+
189
220
  ### Example Command:
190
221
 
191
222
  ```bash
@@ -2,9 +2,9 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="flexmetric",
5
- version="0.2.0",
5
+ version="0.3.0",
6
6
  author="Nikhil Lingadhal",
7
- description="A flexible Prometheus exporter for commands, databases, functions, and scripts.",
7
+ description="A secure flexible Prometheus exporter for commands, databases, functions, and scripts.",
8
8
  long_description=open("README.md").read(),
9
9
  long_description_content_type="text/markdown",
10
10
  url="https://github.com/nikhillingadhal1999/custom_prometheus_agent",
@@ -1,29 +0,0 @@
1
- from flask import Flask, request, jsonify
2
- from flexmetric.metric_process.expiring_queue import metric_queue
3
- import argparse
4
-
5
- app = Flask(__name__)
6
-
7
-
8
- @app.route("/update_metric", methods=["POST"])
9
- def update_metric():
10
- try:
11
- data = request.get_json()
12
-
13
- if not data or "result" not in data or not isinstance(data["result"], list):
14
- return jsonify({"status": "no"}), 400
15
-
16
- for item in data["result"]:
17
- if "label" not in item or "value" not in item:
18
- return jsonify({"status": "no"}), 400
19
-
20
- metric_queue.put(data)
21
- print(metric_queue)
22
- return jsonify({"status": "success"}), 200
23
-
24
- except Exception:
25
- return jsonify({"status": "no"}), 500
26
-
27
-
28
- def run_flask(host, port):
29
- app.run(host=host, port=port)
File without changes