{"id":8975,"date":"2025-05-24T13:23:38","date_gmt":"2025-05-24T07:53:38","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=8975"},"modified":"2025-05-24T16:28:36","modified_gmt":"2025-05-24T10:58:36","slug":"using-php-and-cron-to-automate-kannel-status-monitoring","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/","title":{"rendered":"Using PHP and Cron to Automate Kannel Status Monitoring"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>Kannel, a robust open-source SMS and WAP gateway, to control SMS traffic. Performance monitoring is essential to guarantee dependable message delivery and spot bottlenecks. This blog post will show you how to create a PHP script (kannel_monitor.php) that retrieves Kannel status information from a public endpoint (such as https:\/\/example.com\/?kannel), saves it in a MySQL database, and uses a cron job to run every five minutes. We&#8217;ll also handle common production issues, such as the dreaded &#8220;Invalid response: Kannel status not found&#8221; error, and set up logging to \/var\/log\/kannel_monitor.log for debugging.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Monitor Kannel?<\/h2>\n\n\n\n<p>Kannel\u2019s status page provides real-time metrics, such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>SMSC Connections<\/strong>: Details about each SMS center (SMSC), including protocol, IP, ports, and status.<\/li>\n\n\n\n<li><strong>SMS Metrics<\/strong>: Received, sent, queued, and failed messages, with rates (messages per second).<\/li>\n\n\n\n<li><strong>DLR Metrics<\/strong>: Delivery report (DLR) statistics for tracking message delivery.<\/li>\n<\/ul>\n\n\n\n<p>Our script will fetch this data, parse it, store it in a database, and log operations for troubleshooting.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Designing the Script<\/h2>\n\n\n\n<p>The kannel_monitor.php script will:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Fetch Kannel status data using file_get_contents.<\/li>\n\n\n\n<li>Parse metrics (SMSC connections, SMS, and DLR) using regular expressions.<\/li>\n\n\n\n<li>Store the data in a MySQL database.<\/li>\n\n\n\n<li>Log operations to \/var\/log\/kannel_monitor.log.<\/li>\n\n\n\n<li>Run every 5 minutes via a cron job.<br><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\n\/\/ Fetch status text\n$context = stream_context_create(&#091;\n    'ssl' =&gt; &#091;\n        'verify_peer' =&gt; true,\n        'verify_peer_name' =&gt; true\n    ]\n]);\n$statusText = @file_get_contents($kannelUrl, false, $context);\nif ($statusText === false) {\n    $error = error_get_last();\n    error_log(\"Failed to fetch status from $kannelUrl: \" . ($error&#091;'message'] ?? 'Unknown error'), 3, $logFile);\n    exit(1);\n}\n\n\/\/ Debug: Save response to file\nfile_put_contents(__DIR__ . '\/debug_kannel_status.html', $statusText);\n\n\/\/ Validate response\nif (strpos($statusText, 'Kannel bearerbox version') === false &amp;&amp; strpos($statusText, 'SMSC:') === false) {\n    error_log(\"Invalid response: Kannel status not found. Check URL or response format.\", 3, $logFile);\n    exit(1);\n}\n\n\/\/ Initialize metrics\n$smsReceivedTotal = 0;\n$smsSentTotal = 0;\n$smsQueuedReceived = 0;\n$smsQueuedSent = 0;\n$smsInboundRateAvg = 0.0;\n$smsOutboundRateAvg = 0.0;\n$dlrReceivedTotal = 0;\n$dlrSentTotal = 0;\n$dlrQueued = 0;\n$dlrInboundRateAvg = 0.0;\n$smscRecords = &#091;];\n\n\/\/ Parse SMSC connections\npreg_match_all(\n    '\/(\\w+\\&#091;\\w+\\])\\s+(SMPP|HTTP|FAKE):(&#091;^:]+):(\\d+)\\\/(\\d+):(&#091;^:]*):?(SMPP|XCV)?\\s+\\((\\w+)&#091;^,]+,\\s*rcvd: sms (\\d+).*?\\((&#091;\\d.]+),(&#091;\\d.]+),(&#091;\\d.]+)\\).*?sent: sms (\\d+).*?\\((&#091;\\d.]+),(&#091;\\d.]+),(&#091;\\d.]+)\\).*?dlr (\\d+).*?\\((&#091;\\d.]+),(&#091;\\d.]+),(&#091;\\d.]+)\\).*?failed (\\d+), queued (\\d+)\/',\n    $statusText, $smscMatches, PREG_SET_ORDER\n);\nforeach ($smscMatches as $match) {\n    $smscRecords&#091;] = &#091;\n        'provider_name' =&gt; $match&#091;1],\n        'protocol' =&gt; $match&#091;2],\n        'ip_address' =&gt; $match&#091;3] == 'generic' ? null : $match&#091;3],'\n        'smsc_status' =&gt; $match&#091;8],\n        'provider_sms_received' =&gt; (int) $match&#091;9],\n        'provider_dlr_received_rate_avg' =&gt; (float) $match&#091;19],\n        'provider_sms_failed' =&gt; (int) $match&#091;21],\n        'provider_sms_queued' =&gt; (int) $match&#091;22]\n    ];\n}\n\n\/\/ Parse aggregate metrics\nif (preg_match('\/SMS: received (\\d+) \\((\\d+) queued\\), sent (\\d+) \\((\\d+) queued\\)\/', $statusText, $matches)) {\n    $smsReceivedTotal = (int) $matches&#091;1];\n    $smsQueuedReceived = (int) $matches&#091;2];\n    $smsSentTotal = (int) $matches&#091;3];\n    $smsQueuedSent = (int) $matches&#091;4];\n}\nif (preg_match('\/SMS: inbound \\((&#091;\\d.]+),(&#091;\\d.]+),(&#091;\\d.]+)\\) msg\\\/sec, outbound \\((&#091;\\d.]+),(&#091;\\d.]+),(&#091;\\d.]+)\\) msg\\\/sec\/', $statusText, $matches)) {\n    $smsInboundRateAvg = (float) $matches&#091;2];\n    $smsOutboundRateAvg = (float) $matches&#091;5];\n}\nif (preg_match('\/DLR: received (\\d+), sent (\\d+)\/', $statusText, $matches)) {\n    $dlrReceivedTotal = (int) $matches&#091;1];\n    $dlrSentTotal = (int) $matches&#091;2];\n}\nif (preg_match('\/DLR: (\\d+) queued\/', $statusText, $matches)) {\n    $dlrQueued = (int) $matches&#091;1];\n}\nif (preg_match('\/DLR: inbound \\((&#091;\\d.]+),(&#091;\\d.]+),(&#091;\\d.]+)\\) msg\\\/sec\/', $statusText, $matches)) {\n    $dlrInboundRateAvg = (float) $matches&#091;2];\n}\n\n\/\/ Connect to database\n$db = new mysqli($dbHost, $dbUser, $dbPass, $dbName);\nif ($db-&gt;connect_error) {\n    error_log(\"DB connection failed: \" . $db-&gt;connect_error, 3, $logFile);\n    exit(1);\n}\n\n\/\/ Insert records\n$stmt = $db-&gt;prepare(\"\n    INSERT INTO kannel_monitor (\n        timestamp, provider_name, smsc_status, protocol, ip_address, port_transmit, port_receive, system_id,\n        provider_sms_received, provider_sms_sent, provider_dlr_received, provider_sms_failed, provider_sms_queued,\n        provider_sms_received_rate_avg, provider_sms_sent_rate_avg, provider_dlr_received_rate_avg,\n        sms_received_total, sms_sent_total, sms_queued_received, sms_queued_sent,\n        sms_inbound_rate_avg, sms_outbound_rate_avg, dlr_received_total, dlr_sent_total, dlr_queued,\n        dlr_inbound_rate_avg\n    )\n    VALUES (NOW(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n\");\nif (!$stmt) {\n    error_log(\"Prepare failed: \" . $db-&gt;error, 3, $logFile);\n    $db-&gt;close();\n    exit(1);\n}\n\nforeach ($smscRecords as $record) {\n    $stmt-&gt;bind_param(\n        'ssssiiisiiiidddiiiiddiiid',\n        $record&#091;'provider_name'],\n        $record&#091;'smsc_status'],\n        $record&#091;'protocol'],\n        $record&#091;'ip_address'],\n        $record&#091;'port_transmit'],\n        $smsQueuedSent,\n        $smsInboundRateAvg,\n        $smsOutboundRateAvg,\n        $dlrReceivedTotal,\n        $dlrSentTotal,\n        $dlrQueued,\n        $dlrInboundRateAvg\n    );\n    if (!$stmt-&gt;execute()) {\n        error_log(\"Insert failed for {$record&#091;'provider_name']}: \" . $db-&gt;error, 3, $logFile);\n        break;\n    } else {\n        error_log(\"Inserted record for {$record&#091;'provider_name']}\", 3, $logFile);\n    }\n}\n\/\/ Insert aggregate metrics if no SMSC records\nif (empty($smscRecords)) {\n    $nullStr = null;\n    $nullInt = null;\n    $nullFloat = null;\n    $stmt-&gt;bind_param(\n        'ssssiiisiiiidddiiiiddiiid',\n        $nullStr,\n        $nullStr,\n        $nullStr,\n        $nullInt,\n        $nullFloat,\n        $nullFloat,\n        $nullFloat,\n        $smsReceivedTotal,\n        $smsSentTotal,\n        $smsQueuedReceived,\n        $smsQueuedSent,\n        $smsInboundRateAvg,\n        $smsOutboundRateAvg,\n        $dlrReceivedTotal,\n        $dlrSentTotal,\n        $dlrQueued,\n        $dlrInboundRateAvg\n    );\n    if (!$stmt-&gt;execute()) {\n        error_log(\"Insert failed for aggregate metrics: \" . $db-&gt;error, 3, $logFile);\n    } else {\n        error_log(\"Inserted aggregate metrics\", 3, $logFile);\n    }\n}\n\n$stmt-&gt;close();\n$db-&gt;close();\n\nerror_log(\"Data stored successfully\", 3, $logFile)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: The Script<\/h2>\n\n\n\n<p> Complete kannel_monitor.php script, which I developed to monitor a Kannel instance at <a href=\"https:\/\/app.magneri.com\/?kannel\">https:\/\/example.com\/?kannel<\/a>. It includes error handling, logging, and validation to avoid issues like the &#8220;Invalid response&#8221; error I encountered in production.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Setting Up the Environment<\/h2>\n\n\n\n<p>To run this script in production, follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Save the Script<\/strong>: Save the script to <code>\/var\/www\/html\/scripts\/kannel_monitor.php<\/code>:<br>Paste the script above and set permissions: <code>chmod 644 \/var\/www\/html\/scripts\/kannel_monitor.php chown www-data:www-data \/var\/www\/html\/scripts\/kannel_monitor.php<\/code><\/li>\n\n\n\n<li><strong>Create .env File<\/strong>: <code>KANNEL_URL=https:\/\/example.com\/?<\/code><br><code>kannel DB_HOST=localhost <\/code><br><code>DB_USER=your_db_user <\/code><br><code>DB_PASS=your_db_password <\/code><br><code>DB_NAME=your_db_name<\/code><\/li>\n\n\n\n<li><strong>Create the Log File<\/strong>: Set up <code>\/var\/log\/kannel_monitor.log<\/code>: <code>sudo touch \/var\/log\/kannel_monitor.log sudo chmod 664 \/var\/log\/kannel_monitor.log sudo chown www-data:www-data \/var\/log\/kannel_monitor.log<\/code><\/li>\n\n\n\n<li><strong>Set Up the Cron Job<\/strong>: Schedule the script to run every 5 minutes: <code>crontab -e<\/code> Add: <code>*\/5 * * * * \/usr\/bin\/php \/var\/www\/html\/scripts\/kannel_monitor.php &gt;&gt; \/var\/log\/kannel_monitor.log 2&gt;&amp;1<\/code> Verify: <code>crontab -l<\/code><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Testing the Script<\/h2>\n\n\n\n<p><strong>Test the script manually:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/usr\/bin\/php \/var\/www\/html\/scripts\/kannel_monitor.php<\/code><\/pre>\n\n\n\n<p><strong>Check the log file:<\/strong><br>cat \/var\/log\/kannel_monitor.log<\/p>\n\n\n\n<p><strong>Expected output:<\/strong><br>Inserted record for provider1[smsc1]<br>Inserted aggregate metrics<br>Data stored successfully<\/p>\n\n\n\n<p>It should contain Kannel status data (e.g., SMSC:, SMS: received).<\/p>\n\n\n\n<p><strong>Verify database records:<\/strong><br>SELECT * FROM kannel_monitor;<\/p>\n\n\n\n<p>Wait 5 minutes to confirm the cron job runs, or temporarily set it to run every minute:<br>* * * * \/usr\/bin\/php \/var\/www\/html\/scripts\/kannel_monitor.php &gt;&gt; \/var\/log\/kannel_monitor.log 2&gt;&amp;1<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-24-at-4.16.01\u202fPM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"410\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-24-at-4.16.01\u202fPM-1024x410.png\" alt=\"\" class=\"wp-image-8983\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-24-at-4.16.01\u202fPM-1024x410.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-24-at-4.16.01\u202fPM-300x120.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-24-at-4.16.01\u202fPM-768x307.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-24-at-4.16.01\u202fPM-1536x615.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-24-at-4.16.01\u202fPM-750x300.png 750w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/05\/Screenshot-2025-05-24-at-4.16.01\u202fPM.png 1544w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><br>Conclusion<\/h2>\n\n\n\n<p>Using kannel_monitor.php with a cron job is an easy way to keep track of your SMS gateway. The script grabs, processes, and saves data reliably, with logs to help fix problems.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Kannel, a robust open-source SMS and WAP gateway, to control SMS traffic. Performance monitoring is essential to guarantee dependable message delivery and spot bottlenecks. This blog post will show you how to create a PHP script (kannel_monitor.php) that retrieves Kannel status information from a public endpoint (such as https:\/\/example.com\/?kannel),&hellip; <a href=\"https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/\" class=\"more-link read-more\" rel=\"bookmark\">Continue Reading <span class=\"screen-reader-text\">Using PHP and Cron to Automate Kannel Status Monitoring<\/span><i class=\"fa fa-arrow-right\"><\/i><\/a><\/p>\n","protected":false},"author":514,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":{"0":"post-8975","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-uncategorized","7":"h-entry","9":"h-as-article"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Pheonix Solutions - We Empower Your Business Growth<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pheonix Solutions - We Empower Your Business Growth\" \/>\n<meta property=\"og:description\" content=\"Introduction Kannel, a robust open-source SMS and WAP gateway, to control SMS traffic. Performance monitoring is essential to guarantee dependable message delivery and spot bottlenecks. This blog post will show you how to create a PHP script (kannel_monitor.php) that retrieves Kannel status information from a public endpoint (such as https:\/\/example.com\/?kannel),&hellip; Continue Reading Using PHP and Cron to Automate Kannel Status Monitoring\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/\" \/>\n<meta property=\"og:site_name\" content=\"PHEONIXSOLUTIONS\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-24T07:53:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-24T10:58:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/09\/PX2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"3837\" \/>\n\t<meta property=\"og:image:height\" content=\"2540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"sujith k\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:site\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"sujith k\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/using-php-and-cron-to-automate-kannel-status-monitoring\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/using-php-and-cron-to-automate-kannel-status-monitoring\\\/\"},\"author\":{\"name\":\"sujith k\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/9dae21345bec4359dc69cdb1706b96ea\"},\"headline\":\"Using PHP and Cron to Automate Kannel Status Monitoring\",\"datePublished\":\"2025-05-24T07:53:38+00:00\",\"dateModified\":\"2025-05-24T10:58:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/using-php-and-cron-to-automate-kannel-status-monitoring\\\/\"},\"wordCount\":434,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/using-php-and-cron-to-automate-kannel-status-monitoring\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/using-php-and-cron-to-automate-kannel-status-monitoring\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/using-php-and-cron-to-automate-kannel-status-monitoring\\\/\",\"name\":\"Pheonix Solutions - We Empower Your Business Growth\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\"},\"datePublished\":\"2025-05-24T07:53:38+00:00\",\"dateModified\":\"2025-05-24T10:58:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/using-php-and-cron-to-automate-kannel-status-monitoring\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/using-php-and-cron-to-automate-kannel-status-monitoring\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/using-php-and-cron-to-automate-kannel-status-monitoring\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using PHP and Cron to Automate Kannel Status Monitoring\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"name\":\"Pheonix Solutions\",\"description\":\"We Empower Your Business Growth\",\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\",\"name\":\"PheonixSolutions\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"width\":454,\"height\":300,\"caption\":\"PheonixSolutions\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/PheonixSolutions-209942982759387\\\/\",\"https:\\\/\\\/x.com\\\/pheonixsolution\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/9dae21345bec4359dc69cdb1706b96ea\",\"name\":\"sujith k\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/41c5d1c0dfe05033e1ef6be41e96d1e926b8a6065292fb95c1862a0ffca3ad20?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/41c5d1c0dfe05033e1ef6be41e96d1e926b8a6065292fb95c1862a0ffca3ad20?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/41c5d1c0dfe05033e1ef6be41e96d1e926b8a6065292fb95c1862a0ffca3ad20?s=96&r=g\",\"caption\":\"sujith k\"},\"sameAs\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-admin\"],\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/author\\\/sujith\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pheonix Solutions - We Empower Your Business Growth","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/","og_locale":"en_US","og_type":"article","og_title":"Pheonix Solutions - We Empower Your Business Growth","og_description":"Introduction Kannel, a robust open-source SMS and WAP gateway, to control SMS traffic. Performance monitoring is essential to guarantee dependable message delivery and spot bottlenecks. This blog post will show you how to create a PHP script (kannel_monitor.php) that retrieves Kannel status information from a public endpoint (such as https:\/\/example.com\/?kannel),&hellip; Continue Reading Using PHP and Cron to Automate Kannel Status Monitoring","og_url":"https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/","og_site_name":"PHEONIXSOLUTIONS","article_publisher":"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","article_published_time":"2025-05-24T07:53:38+00:00","article_modified_time":"2025-05-24T10:58:36+00:00","og_image":[{"width":3837,"height":2540,"url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/09\/PX2.png","type":"image\/png"}],"author":"sujith k","twitter_card":"summary_large_image","twitter_creator":"@pheonixsolution","twitter_site":"@pheonixsolution","twitter_misc":{"Written by":"sujith k","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/#article","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/"},"author":{"name":"sujith k","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/9dae21345bec4359dc69cdb1706b96ea"},"headline":"Using PHP and Cron to Automate Kannel Status Monitoring","datePublished":"2025-05-24T07:53:38+00:00","dateModified":"2025-05-24T10:58:36+00:00","mainEntityOfPage":{"@id":"https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/"},"wordCount":434,"commentCount":0,"publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/","url":"https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/","name":"Pheonix Solutions - We Empower Your Business Growth","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#website"},"datePublished":"2025-05-24T07:53:38+00:00","dateModified":"2025-05-24T10:58:36+00:00","breadcrumb":{"@id":"https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/pheonixsolutions.com\/blog\/using-php-and-cron-to-automate-kannel-status-monitoring\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pheonixsolutions.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Using PHP and Cron to Automate Kannel Status Monitoring"}]},{"@type":"WebSite","@id":"https:\/\/pheonixsolutions.com\/blog\/#website","url":"https:\/\/pheonixsolutions.com\/blog\/","name":"Pheonix Solutions","description":"We Empower Your Business Growth","publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pheonixsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/pheonixsolutions.com\/blog\/#organization","name":"PheonixSolutions","url":"https:\/\/pheonixsolutions.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","contentUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","width":454,"height":300,"caption":"PheonixSolutions"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","https:\/\/x.com\/pheonixsolution"]},{"@type":"Person","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/9dae21345bec4359dc69cdb1706b96ea","name":"sujith k","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/41c5d1c0dfe05033e1ef6be41e96d1e926b8a6065292fb95c1862a0ffca3ad20?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/41c5d1c0dfe05033e1ef6be41e96d1e926b8a6065292fb95c1862a0ffca3ad20?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/41c5d1c0dfe05033e1ef6be41e96d1e926b8a6065292fb95c1862a0ffca3ad20?s=96&r=g","caption":"sujith k"},"sameAs":["https:\/\/pheonixsolutions.com\/blog\/wp-admin"],"url":"https:\/\/pheonixsolutions.com\/blog\/author\/sujith\/"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7F4uM-2kL","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/514"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=8975"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8975\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=8975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=8975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=8975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}