Skip to main content
Glama
cloudwatch-aug4-week.cjsโ€ข4.76 kB
#!/usr/bin/env node const { spawn } = require('child_process'); async function getCloudWatchAug4Week() { console.log('๐Ÿ’ฐ AMAZONCLOUDWATCH AROUND AUG 4TH (7 days)'); console.log('๐Ÿ“… Period: Aug 1-7, 2025 (around known cost day)'); const server = spawn('node', ['dist/index.js'], { stdio: ['pipe', 'pipe', 'pipe'], env: { ...process.env, UMBRELLA_API_BASE_URL: 'https://api-front.umbrellacost.io/api/v1' } }); const responses = []; server.stdout.on('data', (data) => { const lines = data.toString().split('\n').filter(line => line.trim()); for (const line of lines) { try { responses.push(JSON.parse(line)); } catch (e) {} } }); await new Promise(resolve => setTimeout(resolve, 2000)); server.stdin.write(JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/call", params: { name: 'authenticate_user', arguments: { username: 'david+saola@umbrellacost.com', password: 'Dsamsung1!' } } }) + '\n'); await new Promise(resolve => setTimeout(resolve, 6000)); // Test shorter range around Aug 4th server.stdin.write(JSON.stringify({ jsonrpc: "2.0", id: 2, method: "tools/call", params: { name: 'api___invoices_caui', arguments: { startDate: "2025-08-01", endDate: "2025-08-07", groupBy: "none", periodGranLevel: "day", costType: ["cost"], isAmortized: true, cloud_context: "aws", accountId: "932213950603", filters: { service: "AmazonCloudWatch" } } } }) + '\n'); console.log('๐Ÿ” Testing Aug 1-7 for AmazonCloudWatch...'); await new Promise(resolve => setTimeout(resolve, 10000)); const response = responses.find(r => r.id === 2); if (response?.result?.content?.[0]?.text) { const text = response.result.content[0].text; if (text.includes('0 items')) { console.log('โŒ Still 0 items for Aug 1-7'); console.log('๐Ÿค” This suggests AmazonCloudWatch might be the wrong format for cost queries'); // Try with original "Amazon CloudWatch" for multi-day console.log('\n๐Ÿงช Testing with "Amazon CloudWatch" for multi-day...'); server.stdin.write(JSON.stringify({ jsonrpc: "2.0", id: 3, method: "tools/call", params: { name: 'api___invoices_caui', arguments: { startDate: "2025-08-01", endDate: "2025-08-07", groupBy: "none", periodGranLevel: "day", costType: ["cost"], isAmortized: true, cloud_context: "aws", accountId: "932213950603", filters: { service: "Amazon CloudWatch" } } } }) + '\n'); await new Promise(resolve => setTimeout(resolve, 8000)); const response2 = responses.find(r => r.id === 3); if (response2?.result?.content?.[0]?.text) { const text2 = response2.result.content[0].text; if (text2.includes('0 items')) { console.log('โŒ "Amazon CloudWatch" also gives 0 items'); } else { console.log('โœ… "Amazon CloudWatch" works for multi-day!'); } } } else { console.log('โœ… Got results for Aug 1-7!'); const jsonMatch = text.match(/```json\n([\s\S]*?)\n```/); if (jsonMatch) { try { const data = JSON.parse(jsonMatch[1]); if (Array.isArray(data) && data.length > 0) { let totalCost = 0; console.log('\n๐Ÿ’ฐ AmazonCloudWatch Aug 1-7 Daily Costs:'); data.forEach((day, i) => { if (day && day.total_cost !== undefined) { const cost = parseFloat(day.total_cost || 0); const date = day.usage_date || `Day ${i+1}`; totalCost += cost; if (cost > 0) { console.log(`๐Ÿ“… ${date}: $${cost.toFixed(8)}`); } } }); console.log(`\n๐Ÿ† Week Total: $${totalCost.toFixed(8)}`); console.log(`๐Ÿ“ˆ Daily Average: $${(totalCost/7).toFixed(8)}`); if (totalCost > 0) { console.log('โœ… Found CloudWatch costs - can extrapolate to 30 days'); const estimated30Day = (totalCost / 7) * 30; console.log(`๐Ÿ“Š Estimated 30-day cost: $${estimated30Day.toFixed(8)}`); } } } catch (e) { console.log('โŒ Parse error:', e.message); } } } } else { console.log('โŒ No response'); } server.kill(); } getCloudWatchAug4Week().catch(console.error);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/daviddraiumbrella/invoice-monitoring'

If you have feedback or need assistance with the MCP directory API, please join our Discord server