Monitor your file exchanges and data flows
Data imports and exports are the arteries of many businesses. EDI flows with suppliers, accounting exports to the accountant, catalog exchanges with marketplaces, automatic reports for management - these daily processes must work flawlessly.
Yet file flows are notoriously fragile. A partner who changes their format without warning, an unavailable FTP server, an erroneously generated empty file - causes of failure are numerous. And when a flow fails silently, consequences can be severe: unprocessed orders, missed invoices, desynchronized inventory.
Heartbeat monitoring provides the necessary visibility into these critical flows. Each import and export signals its execution, metrics, and result. If a flow fails or shows an anomaly, the alert is immediate.
Import/export monitoring applies to many business scenarios:
Every day, your suppliers send catalog updates: new products, price changes, stock levels. Monitor that the file arrives on time, format is correct, and import executes without errors. A missed import can mean incorrect prices or unavailable products.
Accounting entries must be exported to the accountant's software. Monitor that the export generates, file contains the right number of entries, and it's successfully deposited on the remote server. A missed export delays monthly closing.
EDI (Electronic Data Interchange) with large retailers or logistics providers is critical. Orders arrive via EDI, shipping notices and invoices go out via EDI. An unprocessed EDI message can block a shipment or create disputes.
Daily sales reports, weekly dashboards, monthly financial statements - these exports must arrive on time for management meetings. Monitor their generation and delivery.
A reliable import should be verified at multiple levels:
A reliable export should also be verified:
Here's an example of monitoring integration in an import script:
#!/bin/bash
# import_catalog.sh - Supplier catalog import with monitoring
HEARTBEAT_URL="https://monitao.com/ping/YOUR_TOKEN"
IMPORT_DIR="/data/imports"
EXPECTED_FILE="catalog_$(date +%Y%m%d).csv"
# Check file reception
if [ ! -f "$IMPORT_DIR/$EXPECTED_FILE" ]; then
curl -s "$HEARTBEAT_URL/fail?error=file_not_received" > /dev/null
exit 1
fi
# Check format (at least 2 columns, header)
LINES=$(wc -l < "$IMPORT_DIR/$EXPECTED_FILE")
if [ "$LINES" -lt 2 ]; then
curl -s "$HEARTBEAT_URL/fail?error=file_empty&lines=$LINES" > /dev/null
exit 1
fi
# Run import
RESULT=$(php /app/import_catalog.php "$IMPORT_DIR/$EXPECTED_FILE" 2>&1)
EXIT_CODE=$?
# Extract metrics
IMPORTED=$(echo "$RESULT" | grep "imported:" | cut -d: -f2)
ERRORS=$(echo "$RESULT" | grep "errors:" | cut -d: -f2)
if [ $EXIT_CODE -eq 0 ] && [ "$ERRORS" -eq 0 ]; then
curl -s "$HEARTBEAT_URL?imported=$IMPORTED&lines=$LINES" > /dev/null
else
curl -s "$HEARTBEAT_URL/fail?imported=$IMPORTED&errors=$ERRORS&lines=$LINES" > /dev/null
fi
This script verifies each step: file reception, valid format, processing. Metrics enable trend analysis.
Configure alerts tailored to each problem type:
Configure the heartbeat with a grace period matching acceptable tolerance (e.g., 2h after theoretical time). If file isn't processed within this delay, alert triggers. Adjust delay based on lateness history.
Check the return code of the ftp/sftp/scp command. Code 0 = success. Some servers return success even when upload fails - verify by listing the remote file after upload to confirm presence and size.
Document agreed SLAs, configure monitoring with history, and generate monthly incident reports (missing files, late, invalid). Share this report with partner during quality reviews.
Add validations before considering import successful: minimum row count, required column presence, checksum if provided by partner. Send fail ping if validation fails.
Two options: 1) A heartbeat with wide window (e.g., "must arrive between midnight and 6am"). 2) A script that watches the directory and pings as soon as a new file arrives. No ping after a certain delay triggers alert.
Create one heartbeat per file type if their schedules or criticality differ. Otherwise, a single heartbeat can monitor all by counting files processed and alerting if count is below expected.
Data imports and exports are often the weak link in automated processes. A file that doesn't arrive, an export that silently fails - these problems can go unnoticed for days with significant operational consequences.
With MoniTao, you have complete visibility into your file flows: reception, processing, deposit. You're alerted immediately when problems occur, and you have the history to analyze trends and discuss with your partners.
Start free, no credit card required.