Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.26 KB | None | 0 0
  1. $script:Debug=$true
  2.  
  3. $script:sql_primary = "194.58.37.45"
  4.  
  5. $script:sql_pass = "***
  6. $script:sql_user = "***"
  7. $script:sql_bd = "zakupki360"
  8.  
  9. #$script:zabbix_server="11111.compute-1.amazonaws.com"
  10. $script:zabbix_server="192.168.1.100"
  11.  
  12. function delimmsg
  13. {
  14. logmsg " "
  15. logmsg " "
  16. logmsg "==============================================================================================="
  17. sleep 2
  18. }
  19.  
  20. function logmsg
  21. {
  22. Param([string]$msg)
  23. $date=get-date
  24. $msg_text=""
  25. $msg_text=$date.tostring("yyyy-MM-dd hh:mm:ss")
  26. $msg_text+="`t"
  27. $msg_text+=$msg
  28.  
  29. if ($script:debug) {write-host $msg_text }
  30.  
  31. }
  32.  
  33.  
  34.  
  35. function zabbix_send{
  36. Param([string]$zsrv, [string]$key,[string]$QueryText)
  37.  
  38. logmsg "key : $key"
  39. $flag=sql_exec $QueryText
  40. if ( $flag -ne "FALSE" )
  41. {
  42. logmsg "value: $flag"
  43. pushd
  44. cd "C:\Program Files\zabbix\bin\win64\"
  45. .\zabbix_sender.exe -v -s $zsrv -z $script:zabbix_server -k $key --value $flag
  46. popd
  47. }
  48. else
  49. {
  50. logmsg "FAIL"
  51. }
  52. delimmsg
  53. }
  54.  
  55. function sql_exec{
  56. param([string]$QueryText)
  57.  
  58. $constr = "Password=" + $script:sql_pass + ";User ID=" + $script:sql_user + ";Initial Catalog=" + $script:sql_bd + ";Data Source=" + $script:sql_primary
  59.  
  60. $SqlConnection = new-object System.Data.SqlClient.SqlConnection
  61. $SqlConnection.ConnectionString = $constr
  62. $SqlCommand = $SqlConnection.CreateCommand()
  63. $SqlCommand.CommandText = $QueryText
  64. $SqlCommand.CommandTimeout = 300
  65.  
  66.  
  67. try{
  68. #logmsg "connect to $constr"
  69. $DataAdapter = new-object System.Data.SqlClient.SqlDataAdapter $SqlCommand
  70. $dataset = new-object System.Data.Dataset
  71. $SqlConnection.Close()
  72. $tst=$DataAdapter.Fill($dataset)
  73. $SqlConnection.Close()
  74. $flag = $dataset.Tables[0].Rows[0][0]
  75. }catch{
  76. logmsg "sql connection FAIL"
  77. return "FALSE"
  78. }
  79. logmsg "SQL : $flag"
  80. return $flag
  81. }
  82.  
  83. function sphinx_check{
  84. Param([string]$zsrv, [string]$key, [string]$srv, [string]$port, [string]$uppubdate, [string]$period, [string]$stage)
  85.  
  86. logmsg "key : $key"
  87. try{
  88. $flagv=C:\applications\SphinxWatcher\SphinxWatcher.exe -h $srv -p $port --date $uppubdate --period $period --stage $stage
  89. }catch{
  90. write-host "ail to execute"
  91. }
  92. logmsg "value: $flagv"
  93.  
  94. pushd
  95. cd "C:\Program Files\zabbix\bin\win64\"
  96. .\zabbix_sender.exe -vv -s $zsrv -z $script:zabbix_server -k $key --value $flagv
  97. popd
  98. delimmsg
  99.  
  100. }
  101.  
  102.  
  103.  
  104. function sphinx_check_2{
  105. Param([string]$zsrv, [string]$key, [string]$srv, [string]$port, [string]$uppubdate, [string]$period, [string]$stage)
  106.  
  107. logmsg "key : $key"
  108. try{
  109. $flagv=C:\applications\SphinxWatcher\SphinxWatcher.exe -h $srv -p $port --date $uppubdate --period $period --law $stage
  110. }catch{
  111. write-host "Fail to execute"
  112. }
  113. logmsg "value: $flagv"
  114.  
  115. pushd
  116. cd "C:\Program Files\zabbix\bin\win64\"
  117. .\zabbix_sender.exe -vv -s $zsrv -z $script:zabbix_server -k $key --value $flagv
  118. #.\zabbix_sender.exe -vv -s "orders" -z $script:zabbix_server -k $key --value $flagv
  119. popd
  120. delimmsg
  121.  
  122. }
  123.  
  124. function pacts_check{
  125. Param([string]$zsrv, [string]$key, [string]$datefilter, [string]$period)
  126.  
  127. logmsg "key : $key"
  128. pushd
  129. cd "C:\applications\ZakupkiPactWatcher\"
  130. $flagv=.\ZakupkiPactWatcher.exe --date $datefilter --period $period
  131. popd
  132. logmsg "value: $flagv"
  133.  
  134. pushd
  135. cd "C:\Program Files\zabbix\bin\win64\"
  136. .\zabbix_sender.exe -vv -s $zsrv -z $script:zabbix_server -k $key --value $flagv
  137. popd
  138. delimmsg
  139.  
  140. }
  141.  
  142.  
  143. function fabrikant_check_double{
  144. Param([string]$zsrv, [string]$key1, [string]$key2)
  145.  
  146. logmsg "key : $key1"
  147. logmsg "key : $key2"
  148. pushd
  149. cd "C:\applications\FabrikantWatcher\"
  150. $flagv=.\FabrikantWatcher.exe
  151. $flagv = $flagv -split "_"
  152.  
  153. popd
  154. logmsg "value: $flagv"
  155.  
  156. pushd
  157. cd "C:\Program Files\zabbix\bin\win64\"
  158. .\zabbix_sender.exe -vv -s $zsrv -z $script:zabbix_server -k $key1 --value $flagv[0]
  159. .\zabbix_sender.exe -vv -s $zsrv -z $script:zabbix_server -k $key2 --value $flagv[1]
  160. popd
  161. delimmsg
  162.  
  163. }
  164.  
  165. function etpgpb_check{
  166. Param([string]$zsrv, [string]$key)
  167.  
  168. logmsg "key : $key"
  169.  
  170. pushd
  171. cd "C:\applications\ETPGPB_Watcher\"
  172. $flagv=.\Integration.Etpgpb.Watcher.exe
  173.  
  174. popd
  175. logmsg "value: $flagv"
  176.  
  177. pushd
  178. cd "C:\Program Files\zabbix\bin\win64\"
  179. .\zabbix_sender.exe -vv -s $zsrv -z $script:zabbix_server -k $key --value $flagv
  180. .\zabbix_sender.exe -vv -s "orders_staging" -z $script:zabbix_server -k $key --value $flagv
  181. popd
  182. delimmsg
  183. }
  184.  
  185. function etprf_check_double{
  186. Param([string]$zsrv, [string]$key)
  187.  
  188. logmsg "key : $key"
  189.  
  190. pushd
  191. cd "C:\applications\EtprfWatcher\"
  192. $flagv=.\EtprfWatcher.exe
  193.  
  194. popd
  195. logmsg "value: $flagv"
  196.  
  197. pushd
  198. cd "C:\Program Files\zabbix\bin\win64\"
  199. .\zabbix_sender.exe -vv -s $zsrv -z $script:zabbix_server -k $key --value $flagv
  200. .\zabbix_sender.exe -vv -s "orders_staging" -z $script:zabbix_server -k $key --value $flagv
  201. popd
  202. delimmsg
  203. }
  204.  
  205.  
  206.  
  207. function b2b_check_double{
  208. Param([string]$zsrv, [string]$key)
  209.  
  210. logmsg "key : $key"
  211.  
  212. pushd
  213. cd "C:\applications\B2BWatcher\"
  214. $flagv=.\B2BWatcher.exe
  215.  
  216. popd
  217. logmsg "value: $flagv"
  218.  
  219. pushd
  220. cd "C:\Program Files\zabbix\bin\win64\"
  221. .\zabbix_sender.exe -vv -s $zsrv -z $script:zabbix_server -k $key --value $flagv
  222. .\zabbix_sender.exe -vv -s "orders_staging" -z $script:zabbix_server -k $key --value $flagv
  223. popd
  224. delimmsg
  225. }
  226.  
  227.  
  228.  
  229. function estp_check_double{
  230. Param([string]$zsrv, [string]$key1, [string]$key2)
  231.  
  232. logmsg "key : $key1"
  233. logmsg "key : $key2"
  234. pushd
  235. cd "C:\applications\estpWatcher\"
  236. $flagv=.\estpWatcher.exe
  237. $flagv = $flagv -split "_"
  238.  
  239. popd
  240. logmsg "value: $flagv"
  241.  
  242. pushd
  243. cd "C:\Program Files\zabbix\bin\win64\"
  244. .\zabbix_sender.exe -vv -s $zsrv -z $script:zabbix_server -k $key1 --value $flagv[0]
  245. .\zabbix_sender.exe -vv -s "orders" -z $script:zabbix_server -k $key1 --value $flagv[0]
  246. .\zabbix_sender.exe -vv -s $zsrv -z $script:zabbix_server -k $key2 --value $flagv[1]
  247. .\zabbix_sender.exe -vv -s "orders" -z $script:zabbix_server -k $key2 --value $flagv[1]
  248. popd
  249. delimmsg
  250.  
  251. }
  252.  
  253.  
  254. function akd_check_double{ # Somebody created wrong name for utility and make missunerstanding. It's bad.
  255. Param([string]$zsrv, [string]$key)
  256.  
  257. logmsg "key : $key"
  258.  
  259. pushd
  260. cd "C:\applications\AkdWatcher\"
  261. $flagv=.\Integration.Akd.Watcher.exe
  262.  
  263. popd
  264. logmsg "value: $flagv"
  265.  
  266. pushd
  267. cd "C:\Program Files\zabbix\bin\win64\"
  268. .\zabbix_sender.exe -vv -s $zsrv -z $script:zabbix_server -k $key --value $flagv
  269. .\zabbix_sender.exe -vv -s "orders_staging" -z $script:zabbix_server -k $key --value $flagv
  270. popd
  271. delimmsg
  272. }
  273.  
  274.  
  275. function otc_check_double{
  276. Param([string]$zsrv, [string]$key1, [string]$key2)
  277.  
  278. logmsg "key : $key1"
  279. logmsg "key : $key2"
  280. pushd
  281. cd "C:\applications\OTCWatcher\"
  282. $flagv=.\Integration.OTC.Watcher.exe
  283.  
  284. $flagv = $flagv -split "_"
  285.  
  286. popd
  287. logmsg "value: $flagv"
  288.  
  289. pushd
  290. cd "C:\Program Files\zabbix\bin\win64\"
  291. .\zabbix_sender.exe -vv -s $zsrv -z $script:zabbix_server -k $key1 --value $flagv[0]
  292. .\zabbix_sender.exe -vv -s "orders" -z $script:zabbix_server -k $key1 --value $flagv[0]
  293. .\zabbix_sender.exe -vv -s $zsrv -z $script:zabbix_server -k $key2 --value $flagv[1]
  294. .\zabbix_sender.exe -vv -s "orders" -z $script:zabbix_server -k $key2 --value $flagv[1]
  295. popd
  296. delimmsg
  297.  
  298. }
  299.  
  300.  
  301.  
  302. while($true)
  303. {
  304. #zabbix_send "orders_staging" "Plans.Published.Staging.MsSQL.Day" "select count(*) from [dbo].[PlanSchedules] ps with(nolock) left join [dbo].[PlanPositions] pp with(nolock) on ps.Id = pp.[PlanScheduleId] where ps.PublishDate >= convert (date, getutcdate())"
  305. #zabbix_send "orders_staging" "Plans.Published.Staging.MsSQL.Month" "select count(*) from [dbo].[PlanSchedules] ps with(nolock) left join [dbo].[PlanPositions] pp with(nolock) on ps.Id = pp.[PlanScheduleId] where ps.PublishDate >= dateadd(dd, -29, convert(date, getutcdate()))"
  306.  
  307.  
  308.  
  309. #zabbix_send "orders_staging" "Documents.Procesing.Staging.Delay" "SELECT avg(DATEDIFF(hour, OrderTimestamp, DocumentTimStamp)) FROM (SELECT top 100 od.Timestamp as DocumentTimStamp, o.Timestamp as OrderTimestamp FROM OrderDocuments od with (nolock) inner join Orders o with (nolock) on o.Id = od.OrderId WHERE IsProccessed = 1 and IsCurrentEdition = 1 and od.TimeStamp > o.Timestamp ORDER BY od.Id DESC) core "
  310.  
  311. #Sphinx_staging
  312. sphinx_check "orders_staging" "Orders.Published.Sphinx.active" "194.58.37.40" "19316" "publishDate" "CurrentDay" "Active"
  313. sphinx_check "orders_staging" "Orders.Published.Sphinx.working" "194.58.37.40" "19316" "publishDate" "CurrentDay" "Working"
  314. sphinx_check "orders_staging" "Orders.Published.Sphinx.finished" "194.58.37.40" "19316" "publishDate" "CurrentDay" "Finished"
  315. sphinx_check "orders_staging" "Orders.Published.Sphinx.cancelled" "194.58.37.40" "19316" "publishDate" "CurrentDay" "Cancelled"
  316. sphinx_check "orders_staging" "Orders.Published.Sphinx.total.currentday" "194.58.37.40" "19316" "publishDate" "CurrentDay" "All"
  317. sphinx_check "orders_staging" "Orders.Published.Sphinx.total.month" "194.58.37.40" "19316" "publishDate" "Last30Days" "All"
  318. sphinx_check "orders_staging" "Orders.Updated.Sphinx.active" "194.58.37.40" "19316" "lastEvent" "CurrentDay" "Active"
  319. sphinx_check "orders_staging" "Orders.Updated.Sphinx.working" "194.58.37.40" "19316" "lastEvent" "CurrentDay" "Working"
  320. sphinx_check "orders_staging" "Orders.Updated.Sphinx.finished" "194.58.37.40" "19316" "lastEvent" "CurrentDay" "Finished"
  321. sphinx_check "orders_staging" "Orders.Updated.Sphinx.cancelled" "194.58.37.40" "19316" "lastEvent" "CurrentDay" "Cancelled"
  322. sphinx_check "orders_staging" "Orders.Updated.Sphinx.total.currentday" "194.58.37.40" "19316" "lastEvent" "CurrentDay" "All"
  323. sphinx_check "orders_staging" "Orders.Updated.Sphinx.total.month" "194.58.37.40" "19316" "lastEvent" "Last30Days" "All"
  324.  
  325. #mssql_check "MsSQL.Status"
  326.  
  327. zabbix_send "orders_staging" "Orders.Published.MsSQL.active" "select count(*) from Orders with(nolock) where TenderStageId = 1 and PublishDate >= convert (date, getutcdate()) and LawId<4"
  328. zabbix_send "orders_staging" "Orders.Published.MsSQL.working" "select count(*) from Orders with(nolock) where TenderStageId = 11 and PublishDate >= convert (date, getutcdate()) and LawId<4"
  329. zabbix_send "orders_staging" "Orders.Published.MsSQL.finished" "select count(*) from Orders with(nolock) where TenderStageId = 21 and PublishDate >= convert (date, getutcdate()) and LawId<4"
  330. zabbix_send "orders_staging" "Orders.Published.MsSQL.cancelled" "select count(*) from Orders with(nolock) where TenderStageId = 31 and PublishDate >= convert (date, getutcdate()) and LawId<4"
  331. zabbix_send "orders_staging" "Orders.Published.MsSQL.total.currentday" "select count(*) from Orders with(index(IX_Orders_Stage_PublishDate), nolock) where PublishDate >= convert (date, getutcdate()) and LawId<4"
  332. zabbix_send "orders_staging" "Orders.Published.MsSQL.total.month" "select count(*) from Orders with(index(IX_Orders_Stage_PublishDate), nolock) where PublishDate >= dateadd(dd, -29, convert(date, getutcdate())) and LawId<4"
  333. zabbix_send "orders_staging" "Orders.Updated.MsSQL.active" "select count(*) from Orders with(nolock) where TenderStageId = 1 and MaxEventDate >= convert (date, getutcdate()) and LawId<4"
  334. zabbix_send "orders_staging" "Orders.Updated.MsSQL.working" "select count(*) from Orders with(nolock) where TenderStageId = 11 and MaxEventDate >= convert (date, getutcdate()) and LawId<4"
  335. zabbix_send "orders_staging" "Orders.Updated.MsSQL.finished" "select count(*) from Orders with(nolock) where TenderStageId = 21 and MaxEventDate >= convert (date, getutcdate()) and LawId<4"
  336. zabbix_send "orders_staging" "Orders.Updated.MsSQL.cancelled" "select count(*) from Orders with(nolock) where TenderStageId = 31 and MaxEventDate >= convert (date, getutcdate()) and LawId<4"
  337. zabbix_send "orders_staging" "Orders.Updated.MsSQL.total.currentday" "select count(*) from Orders with(nolock) where MaxEventDate >= convert (date, getutcdate()) and LawId<4"
  338. zabbix_send "orders_staging" "Orders.Updated.MsSQL.total.month" "select count(*) from Orders with(nolock) where MaxEventDate >= dateadd(dd, -29, convert(date, getutcdate())) and LawId<4"
  339.  
  340. zabbix_send "orders_staging" "Contracts.Updated.MsSQL.month" "select count(*) from Contracts with(nolock) where [MaxEventDate] >= dateadd(dd, -29, convert(date, getutcdate()))"
  341. zabbix_send "orders_staging" "Contracts.Updated.MsSQL.currentday" "select count(*) from Contracts with(nolock) where [MaxEventDate] >= convert (date, getutcdate())"
  342. zabbix_send "orders_staging" "Contracts.Published.MsSQL.month" "select count(*) from Contracts with(nolock) where [CreateDate] >= dateadd(dd, -29, convert(date, getutcdate()))"
  343. zabbix_send "orders_staging" "Contracts.Published.MsSQL.currentday" "select count(*) from Contracts with(nolock) where [CreateDate] >= convert (date, getutcdate())"
  344. #MsSQL.Status
  345.  
  346.  
  347.  
  348. #zabbix_send "orders_staging" "Orders.Published.MsSQL.Staging.total.currentday" "select count(*) from Orders with(nolock) where PublishDate >= convert (date, getutcdate()) and LawId<4"
  349. #MSSQL Staging
  350. zabbix_send "orders" "Orders.Published.MsSQL.Staging.total.month" "select count(*) from Orders with(nolock) where PublishDate >= dateadd(dd, -29, convert(date, getutcdate())) and LawId<4"
  351. zabbix_send "orders" "Orders.Updated.MsSQL.Staging.total.currentday" "select count(*) from Orders with(nolock) where MaxEventDate >= convert (date, getutcdate()) and LawId<4"
  352. #zabbix_send "orders_staging" "Orders.Updated.MsSQL.Staging.total.month" "select count(*) from Orders with(nolock) where MaxEventDate >= dateadd(dd, -29, convert(date, getutcdate())) and LawId<4"
  353.  
  354. ################ SREZ STAGING
  355. zabbix_send "orders_staging" "Orders44.Staging.protocols.percent" "select 100.0 * sum(iif(s.Parcipiants = 0, 0, 1)) / count(s.Id) [ProtocolsPercent]
  356. from (
  357. select o.Id
  358. ,o.LawId
  359. ,(
  360. (select count(*) from TenderParticipants tp1 with(nolock) where tp1.OrderId = o.Id) +
  361. (select count(*) from TenderParticipants tp2 with(nolock) where tp2.LotId in (select Id from Lots where OrderId = o.Id))
  362. ) [Parcipiants]
  363. from Orders o with(nolock)
  364. inner join TenderTypes tt with(nolock) on tt.Id = o.TenderTypeId
  365. where o.PublishDate >= dateadd(dd, -30, convert(date, getutcdate()))
  366. and o.TenderStageId = 21
  367. and o.LawId = 3
  368. and tt.Name not like '%единствен%'
  369. ) s"
  370. zabbix_send "orders_staging" "Orders223.Staging.protocols.percent" "select 100.0 * sum(iif(s.Parcipiants = 0, 0, 1)) / count(s.Id) [ProtocolsPercent]
  371. from (
  372. select o.Id
  373. ,o.LawId
  374. ,(
  375. (select count(*) from TenderParticipants tp1 with(nolock) where tp1.OrderId = o.Id) +
  376. (select count(*) from TenderParticipants tp2 with(nolock) where tp2.LotId in (select Id from Lots where OrderId = o.Id))
  377. ) [Parcipiants]
  378. from Orders o with(nolock)
  379. inner join TenderTypes tt with(nolock) on tt.Id = o.TenderTypeId
  380. where o.PublishDate >= dateadd(dd, -30, convert(date, getutcdate()))
  381. and o.TenderStageId = 21
  382. and o.LawId = 2
  383. and tt.Name not like '%единствен%'
  384. ) s"
  385.  
  386.  
  387.  
  388. ##############
  389. #zabbix_send "orders_staging" "Contracts.Updated.MsSQL.Staging.month" "select count(*) from Contracts with(nolock) where [MaxEventDate] >= dateadd(dd, -29, convert(date, getutcdate()))"
  390. #zabbix_send "orders_staging" "Contracts.Updated.MsSQL.Staging.currentday" "select count(*) from Contracts with(nolock) where [MaxEventDate] >= convert (date, getutcdate())"
  391. #zabbix_send "orders_staging" "Contracts.Published.MsSQL.Staging.month" "select count(*) from Contracts with(nolock) where [CreateDate] >= dateadd(dd, -29, convert(date, getutcdate()))"
  392. #zabbix_send "orders_staging" "Contracts.Published.MsSQL.Staging.currentday" "select count(*) from Contracts with(nolock) where [CreateDate] >= convert (date, getutcdate())"
  393.  
  394.  
  395. #zabbix_send "orders_staging" "Orders.Updated.MsSQL.Staging.active" "select count(*) from Orders with(nolock) where TenderStageId = 1 and MaxEventDate >= convert (date, getutcdate()) and LawId<4"
  396. #zabbix_send "orders_staging" "Orders.Updated.MsSQL.Staging.working" "select count(*) from Orders with(nolock) where TenderStageId = 11 and MaxEventDate >= convert (date, getutcdate()) and LawId<4"
  397. #zabbix_send "orders_staging" "Orders.Updated.MsSQL.Staging.finished" "select count(*) from Orders with(nolock) where TenderStageId = 21 and MaxEventDate >= convert (date, getutcdate()) and LawId<4"
  398. #zabbix_send "orders_staging" "Orders.Updated.MsSQL.Staging.cancelled" "select count(*) from Orders with(nolock) where TenderStageId = 31 and MaxEventDate >= convert (date, getutcdate()) and LawId<4"
  399.  
  400. #Pacts
  401. zabbix_send "orders_staging" "Orders.Pacts.Publish.Staging.CurrentDay" "SELECT COUNT(*) FROM Pacts p WITH(NOLOCK) WHERE p.IsNewVersion = 1 AND p.PublishDate >= convert (date, getutcdate())"
  402. zabbix_send "orders_staging" "Orders.Pacts.Sign.Staging.CurrentDay" "SELECT COUNT(*) FROM Pacts p WITH(NOLOCK) WHERE p.IsNewVersion = 1 AND p.SignDate >= convert (date, getutcdate())"
  403. pacts_check "orders_staging" "Orders.Pacts.Sign.Staging.Portal.CurrentDay" "sign" "CurrentDay"
  404. pacts_check "orders_staging" "Orders.Pacts.Publish.Staging.Portal.CurrentDay" "publish" "CurrentDay"
  405.  
  406. # Fabrikant
  407. # moved to fabrikant_checker.ps fabrikant_check_double "orders_staging" "Staging.Fabrikant.Orders.ALL.Currentday" "Staging.Fabrikant.Orders.Commerce.Currentday"
  408.  
  409.  
  410.  
  411.  
  412. #ETPGPB
  413. etpgpb_check "orders" "ETPGPB.Orders.All.Currentday"
  414. zabbix_send "orders_staging" "ETPGPB.Orders.Processed.Currentday" "select count(*) from Orders with(nolock) where [EtpProcessingDate] >= convert (date, getutcdate()) and EtpId=11 AND ExternalNumber IS NOT NULL"
  415. zabbix_send "orders_staging" "ETPGPB.Processed.MsSQL.total.currentday" "SELECT count(*) FROM [Orders] with(nolock) WHERE LawId = 11 AND (PublishDate >= convert(date, getutcdate()) OR MaxEventDate >= convert(date, getutcdate()))"
  416. zabbix_send "orders_staging" "ETPGPB.Processed.MsSQL.total.month" "SELECT count(*) FROM [Orders] with(nolock) WHERE LawId = 11 AND (PublishDate >= dateadd(dd, -29, convert(date, getutcdate())) OR MaxEventDate >= dateadd(dd, -29, convert(date, getutcdate())))"
  417. sphinx_check_2 "orders_staging" "ETPGPB.Processed.Spinx.total.month" "194.58.37.40" "19316" "All" "Last30Days" "11"
  418. sphinx_check_2 "orders_staging" "ETPGPB.Processed.Spinx.total.currentday" "194.58.37.40" "19316" "All" "CurrentDay" "11"
  419.  
  420. #sphinx_check_2 "orders_staging" "ETPGPB.Processed.Spinx.total.month" SphinxWatcher.exe -h "194.58.37.40" -p "19316" --date "All" --period "Last30Days" --law 11
  421. #sphinx_check_2 "orders_staging" "ETPGPB.Processed.Spinx.total.currentday" SphinxWatcher.exe -h "194.58.37.40" -p "19316" --date "All" --period "CurrentDay" --law 11
  422.  
  423.  
  424. #ETPRF
  425. etprf_check_double "orders" "ETPRF.Orders.All.Currentday"
  426. zabbix_send "orders_staging" "Staging.ETPRF.Orders.Processed.Currentday" "select count(*) from Orders with(nolock) where [EtpProcessingDate] >= convert (date, getutcdate()) and EtpId=6 AND ExternalNumber IS NOT NULL"
  427. #zk360-7128
  428. zabbix_send "orders_staging" "ETPRF.Processed.MsSQL.total.currentday" "SELECT count(*) FROM [Orders] with(nolock) WHERE LawId = 6 AND (PublishDate >= convert(date, getutcdate()) OR MaxEventDate >= convert(date, getutcdate()))"
  429. sphinx_check_2 "orders_staging" "ETPRF.Processed.Sphinx.total.currentday" "194.58.37.40" "19316" "All" "CurrentDay" "6"
  430. zabbix_send "orders_staging" "ETPRF.Processed.MsSQL.total.month" "SELECT count(*) FROM [Orders] with(nolock) WHERE LawId = 6 AND (PublishDate >= dateadd(dd, -29, convert(date, getutcdate())) OR MaxEventDate >= dateadd(dd, -29, convert(date, getutcdate())))"
  431. sphinx_check_2 "orders_staging" "ETPRF.Processed.Sphinx.total.month" "194.58.37.40" "19316" "All" "Last30Days" "6"
  432.  
  433. #fabrikant
  434. zabbix_send "orders_staging" "Staging.Fabrikant.Orders.Processed.Currentday" "select count(*) from Orders with(nolock) where [EtpProcessingDate] >= convert (date, getutcdate()) and EtpId=4 AND ExternalNumber IS NOT NULL"
  435.  
  436. zabbix_send "orders_staging" "fabrikant.Processed.MsSQL.total.currentday" "SELECT count(*) FROM [Orders] with(nolock) WHERE LawId = 4 AND (PublishDate >= convert(date, getutcdate()) OR MaxEventDate >= convert(date, getutcdate()))"
  437. sphinx_check_2 "orders_staging" "fabrikant.Processed.Sphinx.total.currentday" "194.58.37.40" "19316" "All" "CurrentDay" "4"
  438. zabbix_send "orders_staging" "fabrikant.Processed.MsSQL.total.month" "SELECT count(*) FROM [Orders] with(nolock) WHERE LawId = 4 AND (PublishDate >= dateadd(dd, -29, convert(date, getutcdate())) OR MaxEventDate >= dateadd(dd, -29, convert(date, getutcdate())))"
  439. sphinx_check_2 "orders_staging" "fabrikant.Processed.Sphinx.total.month" "194.58.37.40" "19316" "All" "Last30Days" "4"
  440.  
  441. #tender.pro
  442. zabbix_send "orders_staging" "TenderPro.Orders.Processed.Currentday" "select count(*) from Orders with(nolock) where [EtpProcessingDate] >= convert (date, getutcdate()) and EtpId=5 AND ExternalNumber IS NOT NULL"
  443. # zabbix_send "orders_staging" "TenderPro.Orders.Duplicates.Currentday" "select count(*) from Orders with(nolock) where [Timestamp] >= convert(date, getutcdate()) AND LawId = 2 AND (ExternalNumber IS NOT NULL) AND ((EtpName like '%tender.pr%') OR (EtpAddress like '%tender.pr%'))"
  444.  
  445. zabbix_send "orders_staging" "tenderpro.Processed.MsSQL.total.currentday" "SELECT count(*) FROM [Orders] with(nolock) WHERE LawId = 5 AND (PublishDate >= convert(date, getutcdate()) OR MaxEventDate >= convert(date, getutcdate()))"
  446. sphinx_check_2 "orders_staging" "tenderpro.Processed.Sphinx.total.currentday" "194.58.37.40" "19316" "All" "CurrentDay" "5"
  447. zabbix_send "orders_staging" "tenderpro.Processed.MsSQL.total.month" "SELECT count(*) FROM [Orders] with(nolock) WHERE LawId = 5 AND (PublishDate >= dateadd(dd, -29, convert(date, getutcdate())) OR MaxEventDate >= dateadd(dd, -29, convert(date, getutcdate())))"
  448. sphinx_check_2 "orders_staging" "tenderpro.Processed.Sphinx.total.month" "194.58.37.40" "19316" "All" "Last30Days" "5"
  449.  
  450. #B2B
  451. b2b_check_double "orders" "B2B.Orders.All.Currentday" (moved to B2BWatcher.ps1)#bilo zakommentirovano
  452. zabbix_send "orders_staging" "B2B.Orders.Processed.Currentday" "select count(*) from Orders with(nolock) where [EtpProcessingDate] >= convert (date, getutcdate()) and EtpId=7 AND ExternalNumber IS NOT NULL"
  453.  
  454. zabbix_send "orders_staging" "b2b.Processed.MsSQL.total.currentday" "SELECT count(*) FROM [Orders] with(nolock) WHERE LawId = 7 AND (PublishDate >= convert(date, getutcdate()) OR MaxEventDate >= convert(date, getutcdate()))"
  455. sphinx_check_2 "orders_staging" "b2b.Processed.Sphinx.total.currentday" "194.58.37.40" "19316" "All" "CurrentDay" "7"
  456. zabbix_send "orders_staging" "b2b.Processed.MsSQL.total.month" "SELECT count(*) FROM [Orders] with(nolock) WHERE LawId = 7 AND (PublishDate >= dateadd(dd, -29, convert(date, getutcdate())) OR MaxEventDate >= dateadd(dd, -29, convert(date, getutcdate())))"
  457. sphinx_check_2 "orders_staging" "b2b.Processed.Sphinx.total.month" "194.58.37.40" "19316" "All" "Last30Days" "7"
  458.  
  459. #AKD
  460. akd_check_double "orders" "AKD.Orders.All.Currentday"
  461. #zabbix_send "orders_staging" "AKD.Orders.Processed.Currentday" "select count(*) from orders with (nolock) where Lawid = 8 and [EtpProcessingDate] >= convert (date, getutcdate())"
  462. #zabbix_send "orders_staging" "AKD.Orders.Processed.Currentday" "declare @dt date = convert (date, getutcdate() - 1); select count(*) from orders with (nolock) where etpid = 8 and convert (date, [EtpProcessingDate]) >= @dt"
  463. zabbix_send "orders_staging" "AKD.Orders.Processed.Currentday" "select count(*) from orders with (nolock) where etpid = 8 and convert (date, [EtpProcessingDate]) = convert (date, getutcdate() - 1)"
  464.  
  465. zabbix_send "orders_staging" "AKD.Processed.MsSQL.total.currentday" "SELECT count(*) FROM [Orders] WHERE LawId = 8 AND (EtpProcessingDate >= convert(date, getutcdate()))"
  466. sphinx_check_2 "orders_staging" "AKD.Processed.Sphinx.total.currentday" "194.58.37.40" "19316" "All" "CurrentDay" "8"
  467. zabbix_send "orders_staging" "AKD.Processed.MsSQL.total.month" "SELECT count(*) FROM [Orders] WHERE LawId = 8 AND (EtpProcessingDate >= dateadd(dd, -29, convert(date, getutcdate())))"
  468. sphinx_check_2 "orders_staging" "AKD.Processed.Sphinx.total.month" "194.58.37.40" "19316" "All" "Last30Days" "8"
  469.  
  470. #OTC
  471. otc_check_double "orders_staging" "OTC.Orders.All.Currentday" "OTC.Orders.Commerce.Currentday"
  472. #zabbix_send "orders_staging" "OTC.Orders.Processed.Currentday" "select count(*) from orders with (nolock) where Lawid = 10 and [EtpProcessingDate] >= convert (date, getutcdate())"
  473. zabbix_send "orders_staging" "OTC.Orders.Processed.Currentday" "select count(*) from Orders with(nolock) where [EtpProcessingDate] >= convert (date, getutcdate()) and EtpId=10 AND ExternalNumber IS NOT NULL"
  474. zabbix_send "orders_staging" "OTC.Processed.MsSQL.total.currentday" "SELECT count(*) FROM [Orders] with(nolock) WHERE LawId = 10 AND (PublishDate >= convert(date, getutcdate()) OR MaxEventDate >= convert(date, getutcdate()))"
  475. sphinx_check_2 "orders_staging" "OTC.Processed.Sphinx.total.currentday" "194.58.37.40" "19316" "All" "CurrentDay" "10"
  476. zabbix_send "orders_staging" "OTC.Processed.MsSQL.total.month" "SELECT count(*) FROM [Orders] with(nolock) WHERE LawId = 10 AND (PublishDate >= dateadd(dd, -29, convert(date, getutcdate())) OR MaxEventDate >= dateadd(dd, -29, convert(date, getutcdate())))"
  477. sphinx_check_2 "orders_staging" "OTC.Processed.Sphinx.total.month" "194.58.37.40" "19316" "All" "Last30Days" "10"
  478.  
  479.  
  480.  
  481.  
  482. #ESTP
  483. #Estp.Currentday
  484. #Estp.Orders.All.Currentday 1 число из EstpWatcher
  485. #Estp.Orders.Commerce.Currentday 2 число из EstpWatcher
  486. #Estp.Orders.Processed.Currentday select count(*) from Orders with(nolock) where [Timestamp] >= convert (date, getutcdate()) and EtpId=9 AND ExternalNumber IS NOT NULL
  487. Estp_check_double "orders_staging" "Estp.Orders.All.Currentday" "Estp.Orders.Commerce.Currentday"
  488. zabbix_send "orders_staging" "Estp.Orders.Processed.Currentday" "select count(*) from Orders with(nolock) where [Timestamp] >= convert (date, getutcdate()) and EtpId=9 AND ExternalNumber IS NOT NULL"
  489. #
  490. #Estp.Processed.currentday
  491. #Estp.Processed.MsSQL.total.currentday SELECT count(*) FROM [Orders] WHERE LawId = 9 AND (PublishDate >= convert(date, getutcdate()) OR MaxEventDate >= convert(date, getutcdate()))
  492. zabbix_send "orders_staging" "Estp.Processed.MsSQL.total.currentday" "SELECT count(*) FROM [Orders] WHERE LawId = 9 AND (PublishDate >= convert(date, getutcdate()) OR MaxEventDate >= convert(date, getutcdate()))"
  493. #Estp.Processed.Sphinx.total.currentday SphinxWatcher.exe -h "%SERVER%" -p "%PORT%" –date "All" –period "CurrentDay" –law 9
  494. sphinx_check_2 "orders_staging" "Estp.Processed.Sphinx.total.currentday" "194.58.37.40" "19316" "All" "CurrentDay" "9"
  495. #
  496. #Estp.Processed.month
  497. #Estp.Processed.MsSQL.total.month SELECT count(*) FROM [Orders] WHERE LawId = 9 AND (PublishDate >= dateadd(dd, -29, convert(date, getutcdate())) OR MaxEventDate >= dateadd(dd, -29, convert(date, getutcdate())))
  498. zabbix_send "orders_staging" "Estp.Processed.MsSQL.total.month" "SELECT count(*) FROM [Orders] WHERE LawId = 9 AND (PublishDate >= dateadd(dd, -29, convert(date, getutcdate())) OR MaxEventDate >= dateadd(dd, -29, convert(date, getutcdate())))"
  499. #Estp.Processed.Sphinx.total.month SphinxWatcher.exe -h "%SERVER%" -p "%PORT%" –date "All" –period "Last30Days" –law 9
  500. sphinx_check_2 "orders_staging" "Estp.Processed.Sphinx.total.month" "194.58.37.40" "19316" "Last30Days" "CurrentDay" "9"
  501.  
  502. delimmsg
  503. sleep 60
  504. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement