15 Feb 2021 08:56 AM
Hi there,
I'm trying to build a simulator_snapshot.json out of the process list of a host:
Given by the plugin:
ProcessSnapshotEntry(
group_id=5845565441870040532,
node_id=0,
group_instance_id=14866227715756740309,
process_type=2,
group_name='Oracle Database',
processes=[ProcessInfo(
pid=61354,
process_name='ora_s000_gccon',
properties={'ExePath': '/oracle/product/19/gccon/bin/oracle',
'ParentPid': '1',
'WorkDir': '/oracle/product/19/gccon/dbs'}),
ProcessInfo(
pid=115577,
process_name='oracle_115577_g',
properties={'CmdLine': '(LOCAL=NO)',
'ExePath': '/oracle/product/19/gccon/bin/oracle',
'ParentPid': '1',
'WorkDir': '/oracle/product/19/gccon/dbs'}),
ProcessInfo(
pid=75379,
process_name='ora_w00a_gccon',
properties={'ExePath': '/oracle/product/19/gccon/bin/oracle',
'ParentPid': '1',
'WorkDir': '/oracle/product/19/gccon/dbs'}),
The created simulator_snapshot.json
{
"entries": [
{
"group_name": "Oracle Listeners",
"processes":[
{
"process_name":"tnslsnr",
"properties": {
"CmdLine": "listener -inherit",
"ExePath": "/oracle/product/19/gccon/bin/tnslsnr",
"ListeningPorts": "1522",
"ParentPid": "1",
"PortBindings": "127.0.0.1_1522",
"WorkDir": "/"
}
}
],
"properties": {"Technologies": "ORACLE_DB"}
},
{
"group_name": "Oracle Database",
"processes":[
{
"process_name":"ora_s000_gccon",
"properties": {
"ExePath": "/oracle/product/19/gccon/bin/oracle",
"ParentPid": "1",
"WorkDir": "/oracle/product/19/gccon/dbs"}
},
{
"process_name":"oracle_115577_g",
"properties:": {
"CmdLine": "(LOCAL=NO)",
"ExePath": "/oracle/product/19/gccon/bin/oracle",
"ParentPid": "1",
"WorkDir": "/oracle/product/19/gccon/dbs"
}
},
{
"process_name":"ora_w00a_gccon",
"properties": {
"ExePath": "/oracle/product/19/gccon/bin/oracle",
"ParentPid": "1",
"WorkDir": "/oracle/product/19/gccon/dbs"
}
}
],
"properties": {"Technologies": "ORACLE_DB"}
}
]
}
The issue I have here is that I get an exception due to the "properties"
Validating plugin.json against schema, it seems it has an issue with the multiple-processes in the same group ... but that's what I get out of the plugin snapshot.
Traceback (most recent call last):
File "c:\users\ngrgeo\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\ngrgeo\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\users\ngrgeo\appdata\local\programs\python\python36\lib\site-packages\plugin_sdk\plugin_simulator.py", line 538, in <module>
main()
File "c:\users\ngrgeo\appdata\local\programs\python\python36\lib\site-packages\plugin_sdk\plugin_simulator.py", line 154, in main
_main(args)
File "c:\users\ngrgeo\appdata\local\programs\python\python36\lib\site-packages\plugin_sdk\plugin_simulator.py", line 170, in _main
args.verbose,
File "c:\users\ngrgeo\appdata\local\programs\python\python36\lib\site-packages\plugin_sdk\plugin_simulator.py", line 240, in run_simulator
snapshot = get_snapshot(snapshot_path)
File "c:\users\ngrgeo\appdata\local\programs\python\python36\lib\site-packages\plugin_sdk\plugin_simulator.py", line 433, in get_snapshot
return _ProcessSnapshot.from_json(**json.load(f))
File "c:\users\ngrgeo\appdata\local\programs\python\python36\lib\site-packages\plugin_sdk\plugin_simulator.py", line 65, in from_json
for entry_json in kwargs.pop("entries", [])
File "c:\users\ngrgeo\appdata\local\programs\python\python36\lib\site-packages\plugin_sdk\plugin_simulator.py", line 65, in <listcomp>
for entry_json in kwargs.pop("entries", [])
File "c:\users\ngrgeo\appdata\local\programs\python\python36\lib\site-packages\plugin_sdk\plugin_simulator.py", line 99, in from_json
for pinfo_json in kwargs.pop("processes", [])
File "c:\users\ngrgeo\appdata\local\programs\python\python36\lib\site-packages\plugin_sdk\plugin_simulator.py", line 99, in <listcomp>
for pinfo_json in kwargs.pop("processes", [])
File "c:\users\ngrgeo\appdata\local\programs\python\python36\lib\site-packages\plugin_sdk\plugin_simulator.py", line 118, in from_json
return cls.__new__(cls, **kwargs)
File "c:\users\ngrgeo\appdata\local\programs\python\python36\lib\site-packages\plugin_sdk\plugin_simulator.py", line 114, in __new__
return super().__new__(cls, **kwargs)
TypeError: __new__() got an unexpected keyword argument 'properties:'
How to create a simulator_snapshot.json properly if a group has more process instances?
Solved! Go to Solution.
15 Feb 2021 09:49 AM
Hi, you were so close! Instead of:
"properties:"
make it:
"properties"
and it'll work (I've tested it locally).
Mike
15 Feb 2021 09:53 AM
Oh damn, blind to the own stuff ... thanks for looking at this, sometimes it needs fresh eyes to see the obvious!
15 Feb 2021 10:00 AM
No worries, I spotted it thanks to the json highlighting of notepad++.
Mike