Skip to main content

Monitoring and Database

Both the monitoring and the database are configured in config/config.json.

Monitor Configuration​

Controls runtime monitoring and visualization during simulations.

"monitor": {
"enabled": true, // Whether to enable the monitoring system
"update_interval": 30, // Interval (in seconds) to update visualization
"visualization_defaults": {
"line": {
"max_points": 100 // Maximum number of data points for line charts
},
"bar": {
"sort": true // Whether to sort bars by value
},
"pie": {
"sort": true, // Whether to sort pie slices
"merge_threshold": 0.05 // Merge small slices into "Others" if below this ratio
}
}
}

Field Definitions​

FieldTypeDefaultDescription
enabledboolfalseEnable or disable the monitoring component
update_intervalint | nullnullInterval (in seconds) between metric updates
metrics_pathstring | nullnullFile path to the directory containing metric definitions
visualization_defaultsdict{ "line": {"max_points": 100}, "bar": {"sort": true}, "pie": {"sort": true, "merge_threshold": 0.05} }Default chart visualization settings (line, bar, pie)

Simple Example​

Find monitor in config/config.json

"monitor": {
"enabled": true,
"update_interval": 15,
"visualization_defaults": {
"line": {
"max_points": 50
},
"bar": {
"sort": false
},
"pie": {
"sort": true,
"merge_threshold": 0.05
}
}
}
  • Enables real-time monitoring with updates every 15 seconds.
  • Line charts will display up to 50 points before dropping older data.
  • Bar charts will not auto-sort values.
  • Pie charts will sort slices and merge any slice under 5% into β€œOthers.”

Database Configuration​

Manages persistent storage for simulation data, agent states, decisions, and events.

Find database in config/config.json

"database": {
"enabled": false, // Whether to enable PostgreSQL database support
"host": "localhost", // Database host
"port": 5432, // Database port (default PostgreSQL port)
"dbname": "onesim", // Name of the PostgreSQL database
"user": "postgres", // Database username
"password": "123456" // Password for authentication
}

Field Definitions​

FieldTypeDefaultDescription
enabledboolfalseToggle to enable database support
hoststring"localhost"Database server hostname or IP
portint5432Port number for the database
dbnamestring"onesim"Name of the database
userstring"postgres"Username for authentication
passwordstring"postgres"Password for authentication

Simple Example​

"database": {
"enabled": true,
"host": "db.example.com",
"port": 5432,
"dbname": "onesim_prod",
"user": "onesim_user",
"password": "secure_pass"
}
  • Enables PostgreSQL support to persist simulation scenarios, trails, agent states, events, and decisions.
  • Connects to database at db.example.com:5432, using the onesim_prod database and onesim_user credentials.
  • Make sure you have PostgreSQL installed and running before enabling this configuration.