smf2db 0.1.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.
- smf2db-0.1.0/LICENSE.txt +19 -0
- smf2db-0.1.0/PKG-INFO +176 -0
- smf2db-0.1.0/README.md +146 -0
- smf2db-0.1.0/pyproject.toml +48 -0
- smf2db-0.1.0/setup.cfg +4 -0
- smf2db-0.1.0/src/smf2db/__init__.py +30 -0
- smf2db-0.1.0/src/smf2db/__main__.py +583 -0
- smf2db-0.1.0/src/smf2db/api/__init__.py +0 -0
- smf2db-0.1.0/src/smf2db/api/api_1101.py +209 -0
- smf2db-0.1.0/src/smf2db/api/api_1101db.py +81 -0
- smf2db-0.1.0/src/smf2db/api/api_1101db_sum.py +121 -0
- smf2db-0.1.0/src/smf2db/api/api_1102.py +602 -0
- smf2db-0.1.0/src/smf2db/api/api_1102db.py +89 -0
- smf2db-0.1.0/src/smf2db/api/api_1102db_sum.py +133 -0
- smf2db-0.1.0/src/smf2db/api/api_123.py +168 -0
- smf2db-0.1.0/src/smf2db/api/api_123db.py +187 -0
- smf2db-0.1.0/src/smf2db/api/api_123db_sum.py +241 -0
- smf2db-0.1.0/src/smf2db/api/api_30.py +1012 -0
- smf2db-0.1.0/src/smf2db/api/api_30db.py +423 -0
- smf2db-0.1.0/src/smf2db/api/api_30db_sum.py +577 -0
- smf2db-0.1.0/src/smf2db/api/api_70.py +1392 -0
- smf2db-0.1.0/src/smf2db/api/api_70db.py +165 -0
- smf2db-0.1.0/src/smf2db/api/api_70db_sum.py +776 -0
- smf2db-0.1.0/src/smf2db/api/api_71.py +202 -0
- smf2db-0.1.0/src/smf2db/api/api_71db.py +99 -0
- smf2db-0.1.0/src/smf2db/api/api_71db_sum.py +211 -0
- smf2db-0.1.0/src/smf2db/api/api_72.py +2045 -0
- smf2db-0.1.0/src/smf2db/api/api_72db.py +414 -0
- smf2db-0.1.0/src/smf2db/api/api_72db_sum.py +763 -0
- smf2db-0.1.0/src/smf2db/api/api_73.py +402 -0
- smf2db-0.1.0/src/smf2db/api/api_73db.py +113 -0
- smf2db-0.1.0/src/smf2db/api/api_73db_sum.py +275 -0
- smf2db-0.1.0/src/smf2db/api/api_74.py +3699 -0
- smf2db-0.1.0/src/smf2db/api/api_74db.py +429 -0
- smf2db-0.1.0/src/smf2db/api/api_74db_sum.py +903 -0
- smf2db-0.1.0/src/smf2db/api/api_75.py +183 -0
- smf2db-0.1.0/src/smf2db/api/api_75db.py +103 -0
- smf2db-0.1.0/src/smf2db/api/api_75db_sum.py +168 -0
- smf2db-0.1.0/src/smf2db/api/api_77.py +211 -0
- smf2db-0.1.0/src/smf2db/api/api_77db.py +104 -0
- smf2db-0.1.0/src/smf2db/api/api_77db_sum.py +149 -0
- smf2db-0.1.0/src/smf2db/api/api_78.py +1154 -0
- smf2db-0.1.0/src/smf2db/api/api_78db.py +118 -0
- smf2db-0.1.0/src/smf2db/api/api_78db_sum.py +854 -0
- smf2db-0.1.0/src/smf2db/api/report_util.py +7995 -0
- smf2db-0.1.0/src/smf2db/api/util.py +851 -0
- smf2db-0.1.0/src/smf2db/config.py +60 -0
- smf2db-0.1.0/src/smf2db/db_models/__init__.py +0 -0
- smf2db-0.1.0/src/smf2db/db_models/smf1101_15m_model.py +36 -0
- smf2db-0.1.0/src/smf2db/db_models/smf1101_agg_dict.py +102 -0
- smf2db-0.1.0/src/smf2db/db_models/smf1101_base.py +965 -0
- smf2db-0.1.0/src/smf2db/db_models/smf1101_da_model.py +35 -0
- smf2db-0.1.0/src/smf2db/db_models/smf1101_hr_model.py +36 -0
- smf2db-0.1.0/src/smf2db/db_models/smf1101_model.py +42 -0
- smf2db-0.1.0/src/smf2db/db_models/smf1101_rename.py +412 -0
- smf2db-0.1.0/src/smf2db/db_models/smf1102_agg_dict.py +673 -0
- smf2db-0.1.0/src/smf2db/db_models/smf1102_base.py +2782 -0
- smf2db-0.1.0/src/smf2db/db_models/smf1102_da_model.py +1613 -0
- smf2db-0.1.0/src/smf2db/db_models/smf1102_hr_model.py +1694 -0
- smf2db-0.1.0/src/smf2db/db_models/smf1102_model.py +1517 -0
- smf2db-0.1.0/src/smf2db/db_models/smf123_15m_model.py +92 -0
- smf2db-0.1.0/src/smf2db/db_models/smf123_base.py +1122 -0
- smf2db-0.1.0/src/smf2db/db_models/smf123_da_model.py +89 -0
- smf2db-0.1.0/src/smf2db/db_models/smf123_hr_model.py +92 -0
- smf2db-0.1.0/src/smf2db/db_models/smf123_model.py +109 -0
- smf2db-0.1.0/src/smf2db/db_models/smf30_base.py +596 -0
- smf2db-0.1.0/src/smf2db/db_models/smf30_da_model.py +380 -0
- smf2db-0.1.0/src/smf2db/db_models/smf30_hr_model.py +382 -0
- smf2db-0.1.0/src/smf2db/db_models/smf30_model.py +784 -0
- smf2db-0.1.0/src/smf2db/db_models/smf70_base.py +1351 -0
- smf2db-0.1.0/src/smf2db/db_models/smf70_da_model.py +372 -0
- smf2db-0.1.0/src/smf2db/db_models/smf70_hr_model.py +373 -0
- smf2db-0.1.0/src/smf2db/db_models/smf70_model.py +394 -0
- smf2db-0.1.0/src/smf2db/db_models/smf71_base.py +808 -0
- smf2db-0.1.0/src/smf2db/db_models/smf71_da_model.py +54 -0
- smf2db-0.1.0/src/smf2db/db_models/smf71_hr_model.py +55 -0
- smf2db-0.1.0/src/smf2db/db_models/smf71_model.py +54 -0
- smf2db-0.1.0/src/smf2db/db_models/smf72_base.py +1018 -0
- smf2db-0.1.0/src/smf2db/db_models/smf72_da_model.py +886 -0
- smf2db-0.1.0/src/smf2db/db_models/smf72_hr_model.py +890 -0
- smf2db-0.1.0/src/smf2db/db_models/smf72_model.py +976 -0
- smf2db-0.1.0/src/smf2db/db_models/smf73_base.py +363 -0
- smf2db-0.1.0/src/smf2db/db_models/smf73_da_model.py +278 -0
- smf2db-0.1.0/src/smf2db/db_models/smf73_hr_model.py +279 -0
- smf2db-0.1.0/src/smf2db/db_models/smf73_model.py +287 -0
- smf2db-0.1.0/src/smf2db/db_models/smf74_base.py +2498 -0
- smf2db-0.1.0/src/smf2db/db_models/smf74_da_model.py +1279 -0
- smf2db-0.1.0/src/smf2db/db_models/smf74_hr_model.py +1285 -0
- smf2db-0.1.0/src/smf2db/db_models/smf74_model.py +1387 -0
- smf2db-0.1.0/src/smf2db/db_models/smf75_base.py +150 -0
- smf2db-0.1.0/src/smf2db/db_models/smf75_da_model.py +57 -0
- smf2db-0.1.0/src/smf2db/db_models/smf75_hr_model.py +58 -0
- smf2db-0.1.0/src/smf2db/db_models/smf75_model.py +61 -0
- smf2db-0.1.0/src/smf2db/db_models/smf77_base.py +145 -0
- smf2db-0.1.0/src/smf2db/db_models/smf77_da_model.py +80 -0
- smf2db-0.1.0/src/smf2db/db_models/smf77_hr_model.py +81 -0
- smf2db-0.1.0/src/smf2db/db_models/smf77_model.py +118 -0
- smf2db-0.1.0/src/smf2db/db_models/smf78_base.py +1616 -0
- smf2db-0.1.0/src/smf2db/db_models/smf78_da_model.py +316 -0
- smf2db-0.1.0/src/smf2db/db_models/smf78_hr_model.py +318 -0
- smf2db-0.1.0/src/smf2db/db_models/smf78_model.py +340 -0
- smf2db-0.1.0/src/smf2db/db_models/smf7x_model.py +113 -0
- smf2db-0.1.0/src/smf2db/print/__init__.py +0 -0
- smf2db-0.1.0/src/smf2db/print/commands.py +382 -0
- smf2db-0.1.0/src/smf2db/schemas/schema.py +113 -0
- smf2db-0.1.0/src/smf2db/sumup/__init__.py +0 -0
- smf2db-0.1.0/src/smf2db/sumup/commands.py +930 -0
- smf2db-0.1.0/src/smf2db/upload/__init__.py +0 -0
- smf2db-0.1.0/src/smf2db/upload/commands.py +1079 -0
- smf2db-0.1.0/src/smf2db.egg-info/PKG-INFO +176 -0
- smf2db-0.1.0/src/smf2db.egg-info/SOURCES.txt +113 -0
- smf2db-0.1.0/src/smf2db.egg-info/dependency_links.txt +1 -0
- smf2db-0.1.0/src/smf2db.egg-info/entry_points.txt +2 -0
- smf2db-0.1.0/src/smf2db.egg-info/requires.txt +16 -0
- smf2db-0.1.0/src/smf2db.egg-info/top_level.txt +1 -0
smf2db-0.1.0/LICENSE.txt
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2026 franfcwong
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
smf2db-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: smf2db
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A CLI application that does upload SMF JSON files to database, summarization and printing reports on the fly without any DBMS.
|
|
5
|
+
Author-email: Fran Wong <franfcwong@hotmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/franfcwong/smf2db
|
|
8
|
+
Project-URL: Documentation, https://smf2db.readthedocs.io
|
|
9
|
+
Keywords: SMF,z/OS
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.11
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE.txt
|
|
15
|
+
Requires-Dist: click>=8.1.3
|
|
16
|
+
Requires-Dist: numpy>=1.23.4
|
|
17
|
+
Requires-Dist: pandas>=1.5.1
|
|
18
|
+
Requires-Dist: SQLAlchemy>=2.0.12
|
|
19
|
+
Requires-Dist: rich>=14.3.2
|
|
20
|
+
Requires-Dist: tabulate==0.9.0
|
|
21
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
22
|
+
Requires-Dist: jsonschema>=4.17.3
|
|
23
|
+
Requires-Dist: packaging>=25.0
|
|
24
|
+
Provides-Extra: ssh
|
|
25
|
+
Requires-Dist: sshtunnel>=0.4.0; extra == "ssh"
|
|
26
|
+
Requires-Dist: paramiko==3.5.0; extra == "ssh"
|
|
27
|
+
Provides-Extra: psycopg2
|
|
28
|
+
Requires-Dist: psycopg2>=2.9; extra == "psycopg2"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# smf2db
|
|
32
|
+
|
|
33
|
+

|
|
34
|
+

|
|
35
|
+
[](https://smf2db.readthedocs.io)
|
|
36
|
+
[](https://choosealicense.com/licenses/mit/)
|
|
37
|
+
|
|
38
|
+
This is a CLI application that does upload SMF JSON files to database, summarization and printing reports on the fly without any DBMS.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
![]()
|
|
42
|
+
|
|
43
|
+
**Table of Contents**
|
|
44
|
+
|
|
45
|
+
- [Prerequisites](#prerequisites)
|
|
46
|
+
- [Installation](#installation)
|
|
47
|
+
- [Usage](#usage)
|
|
48
|
+
- [Technologies](#technologies)
|
|
49
|
+
- [Features](#features)
|
|
50
|
+
- [Contact](#contact)
|
|
51
|
+
- [Change log](#change-log)
|
|
52
|
+
- [License](#license)
|
|
53
|
+
|
|
54
|
+
## Prerequisites
|
|
55
|
+
|
|
56
|
+
Before you begin, ensure you have met the following requirements:
|
|
57
|
+
* Python 3.11 or later installed on your platform
|
|
58
|
+
* Ensure you have created a virtual environment
|
|
59
|
+
* Get ready of SMF JSON files (you can follow the instructions of my another project in [CBTTape](https://cbttape.org/ftp/cbt/CBT1064.zip))
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
**smf2db** is officially distributed for installation through [PyPI](https://pypi.org/project/smf2db) for installation with pip.
|
|
64
|
+
To install **smf2db**, follow these steps:
|
|
65
|
+
|
|
66
|
+
### On z/OS:
|
|
67
|
+
|
|
68
|
+
Ensure you download the wheel file and upload to USS before beginning. The requirements for intalling`smf2db`are as follows:
|
|
69
|
+
- Python installed
|
|
70
|
+
- Can access [Python AI Tookit for IBM z/OS](https://ibm-z-oss-oda.github.io/python_ai_toolkit_zos/) to get pre-built Python packages for z/OS.
|
|
71
|
+
- Can access [PyPI](https://pypi.org) to get other dependent packages. It is optional as the required wheel files will be included in the pax file when expanding it.
|
|
72
|
+
|
|
73
|
+
If installing from wheel file, you can run this:
|
|
74
|
+
```
|
|
75
|
+
python -m pip install smf2db-0.1.0-py3-none-any.whl
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
For more detail instructions, please refer to the project's official [documentation](https://smf2db.readthedocs.io).
|
|
79
|
+
|
|
80
|
+
### On macOS, Linux and Windows:
|
|
81
|
+
**smf2db** can be installed with [pip](htps://pip.pypa.io/len/stable/) like this:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
python -m pip install smf2db
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Usage
|
|
88
|
+
|
|
89
|
+
### On z/OS:
|
|
90
|
+
There are two methods to run smf2db:
|
|
91
|
+
- Using batch job
|
|
92
|
+
- firing up a telnet terminal window and run the following command:
|
|
93
|
+
```
|
|
94
|
+
$ smf2db --version
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### On macOS, Linux and Windows:
|
|
98
|
+
You can just run the following command on the terminal:
|
|
99
|
+
```
|
|
100
|
+
$ smf2db --version
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Here are flowchart of how to use the smf2db:
|
|
104
|
+
|
|
105
|
+
```mermaid
|
|
106
|
+
graph TD;
|
|
107
|
+
smf2db-->report;
|
|
108
|
+
smf2db-->db;
|
|
109
|
+
db-->initcfg;
|
|
110
|
+
initcfg-->initdb;
|
|
111
|
+
initdb-->initsum;
|
|
112
|
+
initdb-->upload;
|
|
113
|
+
initsum-->sumup;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Usage Examples
|
|
117
|
+
|
|
118
|
+
If you have some smf70 JSON data on hand for the LPAR, e.g. ``S0W1``, in ``json_data`` directory, you can just print the report on the fly
|
|
119
|
+
by running the following command without any DBMS involvement:
|
|
120
|
+
```
|
|
121
|
+
smf2db report 70 json_data/smf70.json -r 'CPU Activity report' -l S0W1
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
If you would like to upload data to DBMS, say, SQLite, you are required to run ``db initcfg`` to create a yaml
|
|
125
|
+
configuration file first. Here we will create a ``config.yaml`` in ``configs`` directory with the SQLite db path
|
|
126
|
+
in ``data`` directory which has already created. The ``partition scheme`` is a single database without any partition and
|
|
127
|
+
without any prefix for the database names. The command is shown below:
|
|
128
|
+
```
|
|
129
|
+
smf2db db initcfg --config_file configs/config.yaml --db_driver sqlite --sqlite_path data --partitions 'no partition' -x ''
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
After creation of the configuration file, you can now initialize the database in SQLite by creating the tables in
|
|
133
|
+
the database. Let's initialzie smf type 70:
|
|
134
|
+
```
|
|
135
|
+
smf2db db initdb 70 --config_file configs/config.yaml
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
To upload smf70 JSON data in ``json_data/smf70.json`` to SQLite, you can simply run:
|
|
139
|
+
```
|
|
140
|
+
smf2db db upload 70 json_data/smf70.json --config_file configs/config.yaml
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
For more detail how to use it, please refer to the project's official [documentation page](https://smf2db.readthedocs.io).
|
|
144
|
+
|
|
145
|
+
## Technologies
|
|
146
|
+
|
|
147
|
+
**smf2db** uses the following technologies and tools:
|
|
148
|
+
|
|
149
|
+
- [Python](https://www.python.org/): 
|
|
150
|
+
- [SQLAlchemy](https://www.sqlalchemy.org/): 
|
|
151
|
+
- [PostgreSQL](https://www.postgresql.org/): 
|
|
152
|
+
|
|
153
|
+
## Features
|
|
154
|
+
|
|
155
|
+
**smf2db** currently supports SMF types 30, 70-75, 77, 78, 110 and 123 and has the following
|
|
156
|
+
set of features:
|
|
157
|
+
|
|
158
|
+
- Printing reports on the fly using the JSON files as input without loading to DBMS. It is
|
|
159
|
+
recommended to output the report to a file for easier browsing.
|
|
160
|
+
- Uploading JSON files to Database (SQLite or Postgresql). You can use SSH to connect to
|
|
161
|
+
Postgresql if SSH is supported on your platform.
|
|
162
|
+
- Suming up data to hourly or daily database. 15-minutes sum-up is available for some
|
|
163
|
+
SMF types.
|
|
164
|
+
|
|
165
|
+
## Contact
|
|
166
|
+
|
|
167
|
+
If you want to contact me you can reach me at <franfwong@hotmail.com>.
|
|
168
|
+
|
|
169
|
+
## Change log
|
|
170
|
+
|
|
171
|
+
- 0.1.0
|
|
172
|
+
- The first proper release
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
This project uses the following license: [`LICENSE`](LICENSE.md).
|
smf2db-0.1.0/README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# smf2db
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+
[](https://smf2db.readthedocs.io)
|
|
6
|
+
[](https://choosealicense.com/licenses/mit/)
|
|
7
|
+
|
|
8
|
+
This is a CLI application that does upload SMF JSON files to database, summarization and printing reports on the fly without any DBMS.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
![]()
|
|
12
|
+
|
|
13
|
+
**Table of Contents**
|
|
14
|
+
|
|
15
|
+
- [Prerequisites](#prerequisites)
|
|
16
|
+
- [Installation](#installation)
|
|
17
|
+
- [Usage](#usage)
|
|
18
|
+
- [Technologies](#technologies)
|
|
19
|
+
- [Features](#features)
|
|
20
|
+
- [Contact](#contact)
|
|
21
|
+
- [Change log](#change-log)
|
|
22
|
+
- [License](#license)
|
|
23
|
+
|
|
24
|
+
## Prerequisites
|
|
25
|
+
|
|
26
|
+
Before you begin, ensure you have met the following requirements:
|
|
27
|
+
* Python 3.11 or later installed on your platform
|
|
28
|
+
* Ensure you have created a virtual environment
|
|
29
|
+
* Get ready of SMF JSON files (you can follow the instructions of my another project in [CBTTape](https://cbttape.org/ftp/cbt/CBT1064.zip))
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
**smf2db** is officially distributed for installation through [PyPI](https://pypi.org/project/smf2db) for installation with pip.
|
|
34
|
+
To install **smf2db**, follow these steps:
|
|
35
|
+
|
|
36
|
+
### On z/OS:
|
|
37
|
+
|
|
38
|
+
Ensure you download the wheel file and upload to USS before beginning. The requirements for intalling`smf2db`are as follows:
|
|
39
|
+
- Python installed
|
|
40
|
+
- Can access [Python AI Tookit for IBM z/OS](https://ibm-z-oss-oda.github.io/python_ai_toolkit_zos/) to get pre-built Python packages for z/OS.
|
|
41
|
+
- Can access [PyPI](https://pypi.org) to get other dependent packages. It is optional as the required wheel files will be included in the pax file when expanding it.
|
|
42
|
+
|
|
43
|
+
If installing from wheel file, you can run this:
|
|
44
|
+
```
|
|
45
|
+
python -m pip install smf2db-0.1.0-py3-none-any.whl
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
For more detail instructions, please refer to the project's official [documentation](https://smf2db.readthedocs.io).
|
|
49
|
+
|
|
50
|
+
### On macOS, Linux and Windows:
|
|
51
|
+
**smf2db** can be installed with [pip](htps://pip.pypa.io/len/stable/) like this:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
python -m pip install smf2db
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
### On z/OS:
|
|
60
|
+
There are two methods to run smf2db:
|
|
61
|
+
- Using batch job
|
|
62
|
+
- firing up a telnet terminal window and run the following command:
|
|
63
|
+
```
|
|
64
|
+
$ smf2db --version
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### On macOS, Linux and Windows:
|
|
68
|
+
You can just run the following command on the terminal:
|
|
69
|
+
```
|
|
70
|
+
$ smf2db --version
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Here are flowchart of how to use the smf2db:
|
|
74
|
+
|
|
75
|
+
```mermaid
|
|
76
|
+
graph TD;
|
|
77
|
+
smf2db-->report;
|
|
78
|
+
smf2db-->db;
|
|
79
|
+
db-->initcfg;
|
|
80
|
+
initcfg-->initdb;
|
|
81
|
+
initdb-->initsum;
|
|
82
|
+
initdb-->upload;
|
|
83
|
+
initsum-->sumup;
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Usage Examples
|
|
87
|
+
|
|
88
|
+
If you have some smf70 JSON data on hand for the LPAR, e.g. ``S0W1``, in ``json_data`` directory, you can just print the report on the fly
|
|
89
|
+
by running the following command without any DBMS involvement:
|
|
90
|
+
```
|
|
91
|
+
smf2db report 70 json_data/smf70.json -r 'CPU Activity report' -l S0W1
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
If you would like to upload data to DBMS, say, SQLite, you are required to run ``db initcfg`` to create a yaml
|
|
95
|
+
configuration file first. Here we will create a ``config.yaml`` in ``configs`` directory with the SQLite db path
|
|
96
|
+
in ``data`` directory which has already created. The ``partition scheme`` is a single database without any partition and
|
|
97
|
+
without any prefix for the database names. The command is shown below:
|
|
98
|
+
```
|
|
99
|
+
smf2db db initcfg --config_file configs/config.yaml --db_driver sqlite --sqlite_path data --partitions 'no partition' -x ''
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
After creation of the configuration file, you can now initialize the database in SQLite by creating the tables in
|
|
103
|
+
the database. Let's initialzie smf type 70:
|
|
104
|
+
```
|
|
105
|
+
smf2db db initdb 70 --config_file configs/config.yaml
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
To upload smf70 JSON data in ``json_data/smf70.json`` to SQLite, you can simply run:
|
|
109
|
+
```
|
|
110
|
+
smf2db db upload 70 json_data/smf70.json --config_file configs/config.yaml
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
For more detail how to use it, please refer to the project's official [documentation page](https://smf2db.readthedocs.io).
|
|
114
|
+
|
|
115
|
+
## Technologies
|
|
116
|
+
|
|
117
|
+
**smf2db** uses the following technologies and tools:
|
|
118
|
+
|
|
119
|
+
- [Python](https://www.python.org/): 
|
|
120
|
+
- [SQLAlchemy](https://www.sqlalchemy.org/): 
|
|
121
|
+
- [PostgreSQL](https://www.postgresql.org/): 
|
|
122
|
+
|
|
123
|
+
## Features
|
|
124
|
+
|
|
125
|
+
**smf2db** currently supports SMF types 30, 70-75, 77, 78, 110 and 123 and has the following
|
|
126
|
+
set of features:
|
|
127
|
+
|
|
128
|
+
- Printing reports on the fly using the JSON files as input without loading to DBMS. It is
|
|
129
|
+
recommended to output the report to a file for easier browsing.
|
|
130
|
+
- Uploading JSON files to Database (SQLite or Postgresql). You can use SSH to connect to
|
|
131
|
+
Postgresql if SSH is supported on your platform.
|
|
132
|
+
- Suming up data to hourly or daily database. 15-minutes sum-up is available for some
|
|
133
|
+
SMF types.
|
|
134
|
+
|
|
135
|
+
## Contact
|
|
136
|
+
|
|
137
|
+
If you want to contact me you can reach me at <franfwong@hotmail.com>.
|
|
138
|
+
|
|
139
|
+
## Change log
|
|
140
|
+
|
|
141
|
+
- 0.1.0
|
|
142
|
+
- The first proper release
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
This project uses the following license: [`LICENSE`](LICENSE.md).
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# pyproject.toml
|
|
2
|
+
|
|
3
|
+
[build-system]
|
|
4
|
+
requires = ["setuptools>=73.0.1", "wheel"]
|
|
5
|
+
build-backend = "setuptools.build_meta"
|
|
6
|
+
|
|
7
|
+
[project]
|
|
8
|
+
name = "smf2db"
|
|
9
|
+
version = "0.1.0"
|
|
10
|
+
requires-python = ">= 3.11"
|
|
11
|
+
keywords = ["SMF", "z/OS"]
|
|
12
|
+
description = "A CLI application that does upload SMF JSON files to database, summarization and printing reports on the fly without any DBMS."
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
authors = [{name = "Fran Wong", email = "franfcwong@hotmail.com"}]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
]
|
|
19
|
+
license = "MIT"
|
|
20
|
+
license-files = ["LICEN[CS]E*"]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"click >= 8.1.3",
|
|
23
|
+
"numpy>=1.23.4",
|
|
24
|
+
"pandas>=1.5.1",
|
|
25
|
+
"SQLAlchemy>=2.0.12",
|
|
26
|
+
"rich>=14.3.2",
|
|
27
|
+
"tabulate==0.9.0",
|
|
28
|
+
"pyyaml>=6.0.3",
|
|
29
|
+
"jsonschema>=4.17.3",
|
|
30
|
+
"packaging>=25.0"
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
ssh = [
|
|
35
|
+
"sshtunnel>=0.4.0",
|
|
36
|
+
"paramiko==3.5.0"
|
|
37
|
+
]
|
|
38
|
+
psycopg2 = ["psycopg2>=2.9"]
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://github.com/franfcwong/smf2db"
|
|
42
|
+
Documentation = 'https://smf2db.readthedocs.io'
|
|
43
|
+
|
|
44
|
+
[project.scripts]
|
|
45
|
+
smf2db = "smf2db.__main__:cli"
|
|
46
|
+
|
|
47
|
+
[tool.setuptools.packages.find]
|
|
48
|
+
where = ['src']
|
smf2db-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Top-level package for Smf2db."""
|
|
2
|
+
# smf2db/__init__.py
|
|
3
|
+
|
|
4
|
+
__app_name__ = "smf2db"
|
|
5
|
+
__version__ = "0.1.0"
|
|
6
|
+
|
|
7
|
+
(
|
|
8
|
+
SUCCESS,
|
|
9
|
+
DIR_ERROR,
|
|
10
|
+
FILE_ERROR,
|
|
11
|
+
DB_READ_ERROR,
|
|
12
|
+
DB_WRITE_ERROR,
|
|
13
|
+
JSON_ERROR,
|
|
14
|
+
UPLOAD_ERROR,
|
|
15
|
+
DB_CONNECTION_ERROR,
|
|
16
|
+
) = range(8)
|
|
17
|
+
|
|
18
|
+
ERRORS = {
|
|
19
|
+
DIR_ERROR: "config directory error",
|
|
20
|
+
FILE_ERROR: "config file error",
|
|
21
|
+
DB_READ_ERROR: "database read error",
|
|
22
|
+
DB_WRITE_ERROR: "database write error",
|
|
23
|
+
JSON_ERROR: "Invalid JSON format error",
|
|
24
|
+
UPLOAD_ERROR: "uploading error",
|
|
25
|
+
DB_CONNECTION_ERROR: "database connection error",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
DEFAULT_DB_HOST = 'localhost'
|
|
29
|
+
DEFAULT_DB_PORT = 5432
|
|
30
|
+
DEFAULT_DB_USER = 'postgres'
|