{"id":77,"date":"2020-09-01T16:54:56","date_gmt":"2020-09-01T14:54:56","guid":{"rendered":"http:\/\/alittlecrumbs.com\/?p=73"},"modified":"2020-09-01T16:54:56","modified_gmt":"2020-09-01T14:54:56","slug":"veeam-backup-jobs-failed-vbscript-nagios-check","status":"publish","type":"post","link":"https:\/\/notbotnotes.com\/?p=77","title":{"rendered":"Veeam Backup Jobs Failed \u2013 VBScript Nagios Check"},"content":{"rendered":"\n<pre class=\"wp-block-syntaxhighlighter-code\">' Nagios Plugn for reading Veeam Backup and Replication's log\n' It is intended to use with NSClient++\n\n\nDim rad,txt,dag,alert,status\n\nSet cnn = CreateObject(\"ADODB.Connection\")\nSet Rs = CreateObject(\"ADODB.Recordset\")\n\ncnn.ConnectionString = \"driver={SQL Server};server=localhost\\VEEAMSQL2012;Trusted_Connection=Yes;database=VeeamBackup\"\ncnn.Open\nrs.ActiveConnection = cnn\nexitcode = 0\ntxt=\"\"\nallert()\nrs.close\nIf txt &gt; \"\" Then\n  txt = \"BACKUP VIRTUAL MACHINE IN ERRORE: \\n\" &amp; txt &amp; \" | \"\nelse\n  txt = \"OK\"\n  exitcode=0\nEnd If\n\nwscript.echo(txt)\nwscript.quit exitcode\n\nFunction allert()\n  Const ForReading = 1, ForWriting = 2, ForAppending = 8\n  Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0\n  'strsql = \"SELECT name, repo_name,progress,result,target_host_name   FROM [VeeamBackup].[dbo].[ReportJobsView]   where latest_result=2\"\n  strsql = \"SELECT b.object_name as object_name, a.job_name as job_name, a.creation_time as creation_time, a.end_time as end_time, a.total_size as total_size, a.stored_size as stored_size FROM dbo.ReportSessionView a inner join dbo.ReportSessionInfoView b on a.id = session_id where a.result = '2' and a.id is not null and cast(a.creation_time as date) &gt; dateadd(day,-1, cast(getdate() as date)) order by 2 desc\"\n  rs.Open strsql , cnn,3,3\n  Do While Not rs.EOF \n  \n                rad = rs(\"object_name\") &amp; \" Job: \" &amp; rs(\"job_name\") &amp; \" Data Inizio: \" &amp; rs(\"creation_time\") &amp; \" Data Fine: \" &amp; rs(\"end_time\") &amp; \" Dimensioni Totali: \" &amp; rs(\"total_size\") &amp; \" Dimensioni Compresse: \" &amp; rs(\"stored_size\") &amp; \"\\n \"\n        \n            Set fso = CreateObject(\"Scripting.FileSystemObject\")\n            txt = txt + rad \n        \n        rs.MoveNext\n    Loop\n    exitcode = 2\n    Exit Function\nEnd Function<\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_seo_schema_type":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_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},"jetpack_post_was_ever_published":false},"categories":[15],"tags":[16,17,18],"class_list":["post-77","post","type-post","status-publish","format-standard","hentry","category-notes","tag-nagios","tag-vbscript","tag-veeam"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/notbotnotes.com\/index.php?rest_route=\/wp\/v2\/posts\/77","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/notbotnotes.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notbotnotes.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notbotnotes.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/notbotnotes.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=77"}],"version-history":[{"count":0,"href":"https:\/\/notbotnotes.com\/index.php?rest_route=\/wp\/v2\/posts\/77\/revisions"}],"wp:attachment":[{"href":"https:\/\/notbotnotes.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=77"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notbotnotes.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=77"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notbotnotes.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}