{"id":305,"date":"2008-11-29T22:31:18","date_gmt":"2008-11-29T20:31:18","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=305"},"modified":"2010-09-01T12:27:31","modified_gmt":"2010-09-01T10:27:31","slug":"timed-script-two-state-monitor","status":"publish","type":"post","link":"http:\/\/contoso.se\/blog\/?p=305","title":{"rendered":"Timed Script Two State Monitor"},"content":{"rendered":"<p>This is an example how to use a timed script two state monitor to monitor a file exists. If the file exists the monitor is healthy.<\/p>\n<ol>\n<li>Create a Timed Script Two State Monitor, input suitable name, scheudle, target and description.<\/li>\n<li>Input this script below<\/li>\n<li>As unhealthy expression input &#8220;Property[@Name=&#8217;Status&#8217;] equals Error&#8221;<\/li>\n<li>As healthy expression input &#8220;Property[@Name=&#8217;Status&#8217;] equals Ok&#8221;<\/li>\n<li>Configure alerts and then your done.<\/li>\n<\/ol>\n<p><code><span lang=\"EN-US\">Dim oAPI, oBag<br \/>\n<\/span><span lang=\"EN-US\">Set oAPI = CreateObject(\u00e2\u20ac\u0153MOM.ScriptAPI\u00e2\u20ac\u009d)<br \/>\n<\/span><span lang=\"EN-US\">Set oBag = oAPI.CreatePropertyBag()<br \/>\n<\/span><span lang=\"EN-US\">Set objFSO = CreateObject(\u00e2\u20ac\u0153Scripting.FileSystemObject\u00e2\u20ac\u009d)<br \/>\n<\/span><span lang=\"EN-US\">strFile = \u00e2\u20ac\u0153C:\\myfile.log\u00e2\u20ac\u009d<br \/>\n<\/span><span lang=\"EN-US\">If objFSO.FileExists(strFile) Then<br \/>\n<\/span><span lang=\"EN-US\">Call oBag.AddValue(\u00e2\u20ac\u0153Status\u00e2\u20ac\u009d,\u00e2\u20ac\u009dOk\u00e2\u20ac\u009d)<br \/>\n<\/span><span lang=\"EN-US\">Call oAPI.Return(oBag)<br \/>\n<\/span><span lang=\"EN-US\">Else<br \/>\n<\/span><span lang=\"EN-US\">Call oBag.AddValue(\u00e2\u20ac\u0153Status\u00e2\u20ac\u009d,\u00e2\u20ac\u009dError\u00e2\u20ac\u009d)<br \/>\n<\/span><span lang=\"EN-US\">Call oAPI.Return(oBag)<br \/>\n<\/span><span lang=\"EN-US\">End If<\/span><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is an example how to use a timed script two state monitor to monitor a file exists. If the file exists the monitor is healthy. Create a Timed Script Two State Monitor, input suitable name, scheudle, target and description. Input this script below As unhealthy expression input &#8220;Property[@Name=&#8217;Status&#8217;] equals Error&#8221; As healthy expression input &hellip; <a href=\"http:\/\/contoso.se\/blog\/?p=305\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[13,19],"tags":[],"_links":{"self":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/305"}],"collection":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=305"}],"version-history":[{"count":1,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/305\/revisions"}],"predecessor-version":[{"id":1769,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/305\/revisions\/1769"}],"wp:attachment":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}