Live streams

Collector: MTConnect

Read CNC machines through their MTConnect agent: probe, current and sample, with agent restarts and buffer gaps handled.

MTConnect

CNC machines and other MTConnect devices (Mazak, Haas, DMG Mori, Okuma and anything behind a cppagent) publish their data through an agent over HTTP and XML. The collector is a plain HTTP client of that agent: nothing to install on the machine, read-only by design.

What it collects

  • Probe lists every DataItem (id, name, type, units, component path). Each becomes a channel named Device/Component/Name.
  • SAMPLE items (positions, loads, speeds, temperatures) are numeric channels with their units.
  • EVENT items that are numbers (PART_COUNT, LINE) are numeric channels. The ones with a standard vocabulary (EXECUTION, CONTROLLER_MODE, AVAILABILITY, EMERGENCY_STOP, DOOR_STATE, POWER_STATE, ROTARY_MODE) are channels with enum labels (ACTIVE, FEED_HOLD...). Any other text (program names, messages) is dropped and counted in strings_dropped.
  • CONDITION items become a level channel: 0 NORMAL, 1 WARNING, 2 FAULT.
  • UNAVAILABLE becomes a bad value (a gap in the chart; status BadNoCommunication), not a number. Time series, data set and table items are skipped.

The collector reads /current for the initial values and then polls /sample?from=…&count=… from the agent's own sequence numbers, with the agent's UTC timestamps. The next sequence is saved, so a restart of the collector continues where it stopped (while the agent still holds those values).

Configuration

collector.yaml
sources:
  - name: Mazak lathe
    type: mtconnect
    url: https://agent.customer.local:5000   # the MTConnect agent (cppagent)
    device: Mazak                         # optional: one device of the agent
    poll_ms: 1000

  - name: Shop floor (plain HTTP agent on the LAN)
    type: mtconnect
    url: http://10.0.0.20:5000
    allow_http: true                      # most agents have no TLS: accepting that is explicit
NameTypeDescription
urlrequiredstringThe agent's base address. https:// by default; http:// needs allow_http.
devicestringOnly this device (name or uuid). Omit it for every device of the agent.
tagslistDataItem ids to collect. Omit it for all scalar items.
poll_msnumber
Default: 1000
Polling interval.
countnumber
Default: 1000
Observations requested per sample call (the agent may cap it).
authnone | bearer | basic
Default: none
bearer needs token; basic needs user and password. Stock agents have no authentication: this is for a reverse proxy in front of one.
ca, insecure, allow_http, timeout_smixedAs in the REST source: a private CA file, skip certificate checks (not recommended), accept plain http://, request timeout (15 s).
history_countnumber
Default: 5000
Observations per request when reading history.

History and restarts

The agent keeps only a bounded buffer (often 100 000 to 1 million observations, hours of data). backfill and gap filling read what is still in that buffer and nothing older: for CNC data that must survive, keep the collector running. If the collector falls behind the buffer, the lost sequence range is counted (sequence_gaps,sequences_lost) and it continues from the current values. If the agent restarts (new instanceId) the collector re-reads the device model and resyncs (agent_restarts). Health also reports connected (1 after a successful request, 0 after a failed poll), polls,poll_errors and values_per_s.

Install with pip install "kymoscope-collector[mtconnect]". The agent needs to be reachable on its HTTP port from the collector host and nothing else.