{"id":1085,"date":"2009-09-01T15:35:17","date_gmt":"2009-09-01T20:35:17","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=1085"},"modified":"2009-10-11T20:04:31","modified_gmt":"2009-10-12T01:04:31","slug":"use-webinject-for-web-monitoring","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=1085","title":{"rendered":"Use WebInject\/Cygwin For Web Monitoring"},"content":{"rendered":"<span id=\"Install_Cygwin\"><h2>Install Cygwin<\/h2><\/span>\n<p>See <a href=\"?p=623\">this post<\/a> for details.<br \/>\nIn addition<br \/>\n* Install all Perl packages.<br \/>\n* Install &#8220;devel\/make&#8221; and all its dependencies.<br \/>\n* Install &#8220;devel\/gcc-core&#8221; and &#8220;devel\/gcc-g++&#8221; packages.<br \/>\n* Install &#8220;openssl&#8221; and &#8220;openssl-devel&#8221; packages.<br \/>\n* Install &#8220;mail\/ssmtp&#8221; package.<\/p>\n<pre lang=\"bash\">\r\nssmtp-config\r\n<\/pre>\n<span id=\"Install_from_CPAN\"><h2>Install from CPAN<\/h2><\/span>\n<p>* Install &#8220;XML::Simple&#8221;<\/p>\n<pre lang=\"bash\">\r\nshell> perl -MCPAN -e shell\r\ncpan> install XML::Simple\r\n\r\nOR\r\ncd .cpan\/build\/XML-Simple-2.18-ICtnsp\r\nmake test\r\nmake install\r\n<\/pre>\n<p>* Install &#8220;Crypt::SSLeay&#8221;<\/p>\n<pre lang=\"bash\">\r\nshell> perl -MCPAN -e shell\r\ncpan> install Crypt::SSLeay\r\n\r\nOR\r\ncd .cpan\/build\/Crypt-SSLeay-0.57-MJnTGM\r\nperl Makefile.PL\r\nmake test\r\nmake install\r\n<\/pre>\n<p>* Install &#8220;Error&#8221; pacakge<\/p>\n<pre lang=\"bash\">\r\nshell> perl -MCPAN -e shell\r\ncpan> install Error\r\n\r\n* Create a new ParserDetails.ini file in the \/usr\/lib\/perl5\/vendor_perl\/5.10\/XML\/SAX directory\r\n<pre>\r\n[XML::SAX::PurePerl]\r\nhttp:\/\/xml.org\/sax\/features\/namespaces = 1\r\n\r\n[XML::LibXML::SAX::Parser]\r\nhttp:\/\/xml.org\/sax\/features\/namespaces = 1\r\n\r\n[XML::LibXML::SAX]\r\nhttp:\/\/xml.org\/sax\/features\/namespaces = 1\r\n<\/pre>\n<span id=\"Install_WebInject\"><h2>Install WebInject<\/h2><\/span>\n<p>* Download WebInject from its <a href=\"http:\/\/www.webinject.org\/download.html\">download page<\/a>. I downloaded the source version <a href=\"http:\/\/downloads.sourceforge.net\/webinject\/webinject-1.41.src.tar.gz\">webinject-1.41.src.tar.gz<\/a>.<br \/>\n* Unzip webinject-1.41.src.tar.gz into a local directory.<\/p>\n<span id=\"Run_WebInject\"><h2>Run WebInject<\/h2><\/span>\n<pre lang=\"bash\">\r\n.\/webinject.pl\r\n<\/pre>\n<span id=\"Configure_External_Email_Module\"><h2>Configure External Email Module<\/h2><\/span>\n<p>* Create an external email module named \"Plugin.pm\":<\/p>\n<pre lang=\"bash\">\r\n\r\nif ($casefailedcount > 0) {\r\nopen(MAIL, '| \/usr\/sbin\/ssmtp.exe me\\@my.com') or \"die\";\r\nprint MAIL <<EOF;\r\nTo:me\\@my.com\r\nFrom:me\\@my.com\r\nSubject:Passed: $casepassedcount,  Failed: $casefailedcount\r\n\r\nStart Time: $currentdatetime \\n\r\nTotal Run Time: $totalruntime seconds \\n\r\n\\n\r\nTest Cases Run: $totalruncount \\n\r\nTest Cases Passed: $casepassedcount \\n\r\nTest Cases Failed: $casefailedcount \\n\r\nVerifications Passed: $passedcount \\n\r\nVerifications Failed: $failedcount \\n\r\n\\n\r\nAverage Response Time: $avgresponse seconds \\n\r\nMax Response Time: $maxresponse seconds \\n\r\nMin Response Time: $minresponse seconds \\n\r\nEOF\r\n}\r\n\r\n1;\r\n<\/pre>\n<p>* Add to config.xml:<\/p>\n<pre lang=\"bash\">\r\n<reporttype>external:\/path\/to\/Plugin.pm<\/reporttype>\r\n<\/pre>\n<span id=\"Setup_as_cron_job\"><h2>Setup as cron job<\/h2><\/span>\n<p>* Setup Cygwin cron service as described in <a href=\"?p=1095\">this post<\/a><br \/>\n* Setup crontab for webinject to run every 30 min:<\/p>\n<pre lang=\"bash\">\r\ncrontab -e\r\n*\/30 * * * * \/cygdrive\/c\/webinject\/webinject.pl\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Install Cygwin See this post for details. In addition * Install all Perl packages. * Install &#8220;devel\/make&#8221; and all its dependencies. * Install &#8220;devel\/gcc-core&#8221; and &#8220;devel\/gcc-g++&#8221; packages. * Install &#8220;openssl&#8221; and &#8220;openssl-devel&#8221; packages. * Install &#8220;mail\/ssmtp&#8221; package. ssmtp-config Install from &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=1085\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"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":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[60,59],"tags":[],"class_list":["post-1085","post","type-post","status-publish","format-standard","hentry","category-cygwin","category-perl"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-hv","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1085","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1085"}],"version-history":[{"count":12,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1085\/revisions"}],"predecessor-version":[{"id":1285,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1085\/revisions\/1285"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}