יצירת נתונים לדוגמה
במדריך הזה מוסבר איך אפשר ליצור נתוני דוגמה באמצעות סקריפט bash שמופיע בחבילת ההפצה.
לפני שמתחילים
חשוב להחיל את חבילת ההגדרות שמוגדרת כברירת מחדל או ליצור מחלקות, סוגים ומנתחים רלוונטיים של הודעות.
הפעלת התסריט כדי ליצור נתונים לדוגמה
מחפשים את סקריפט ה-Bash בחבילת הפריסה בקובץ /testing/send-data-to-mde.sh. הסקריפט הזה דורש שני ארגומנטים:
- מזהה הפרויקט.
- סוג הנתונים שרוצים לשלוח. הערך יכול להיות
numericאוdiscrete.
כששולחים נתונים, חותמת הזמן מוזנת באופן אוטומטי ושאר הערכים זהים. אם רוצים לשלוח מטען ייעודי (payload) אחר, צריך לערוך את סקריפט ה-Bash.
לדוגמה, כדי לשלוח נתונים של numeric, משתמשים בפקודה הבאה:
./send-data-to-mde.sh PROJECT_ID numeric
תקבלו תגובה דומה:
send-data-to-mde.sh: ***** Welcome to the MDE Data Generator *****
This script will send numeric data to MDE so that you can
validate that the entire pipeline is working
PROJECT_ID set to PROJECT_ID
You're authenticated as USER_EMAIL
Do you want to start sending data [Y/n]? Y
Sending messages every 5 seconds
Press [CTRL+C] to stop..
Sent:
{
"tagName": "mde-test-numeric",
"timestamp": "1695643807000",
"value": 10
}
messageIds:
- '8840355690320815'
כדי לשלוח נתוני discrete, משתמשים בפקודה הבאה:
./send-data-to-mde.sh PROJECT_ID discrete
תקבלו תגובה דומה:
send-data-to-mde.sh: ***** Welcome to the MDE Data Generator *****
This script will send discrete data to MDE so that you can
validate that the entire pipeline is working
PROJECT_ID set to PROJECT_ID
You're authenticated as USER_EMAIL
Do you want to start sending data [Y/n]? Y
Sending messages every 5 seconds
Press [CTRL+C] to stop..
Sent:
{
"tagName": "mde-test-discrete",
"timestamp": "1695643827000",
"value": {
"test1": true,
"test2": "someValue"
}
}
messageIds:
- '9223124765272389'