On Zabbix server, connect to MariaDB by running:
mysqlAnd go to the correct database, e.g.:
| # Example usage: | |
| # . C:\temp\Test-EnduranceSqlConnection.ps1 | |
| # Test-EnduranceSqlConnection '192.168.253.127\Corflow' -Interval ([timespan]::FromSeconds(1)) | |
| function Test-Key { | |
| [CmdletBinding()] | |
| param ( | |
| [System.ConsoleKey]$Key | |
| ) |
| function Match([string]$x, [string]$y) { | |
| if ($x.Length -ne $y.Length) { return '' } | |
| $result = '' | |
| @(0..($x.Length - 1)) | %{ | |
| if ($x[$_] -eq $y[$_]) { | |
| $result += '*' | |
| } elseif ($y.Contains($x[$_])) { | |
| $result += '?' | |
| } else { | |
| $result += '.' |
| dir -Recurse -Filter *.cs | gc | %{ if ($_ -match '^.*(http(?:s)?\://[^/]*/).*$') { $Matches[1] } } | select -Unique |
On Zabbix server, connect to MariaDB by running:
mysqlAnd go to the correct database, e.g.:
| $folder = 'C:\Temp\', $env:TEMP, '~/Downloads' | |
| $threshold = (Get-Date).AddMonths(-1.0) | |
| $ConfirmPreference = 'Low' | |
| $oldFiles = $folder | Get-ChildItem -File -Recurse | ?{ $_.LastAccessTime -lt $threshold } | |
| $oldFiles | Sort-Object -Property Length -Descending | Select -First 25 Length, FullName | |
| $oldFiles | Measure-Object -Property Length -Sum -Maximum -Minimum -Average | |
| $oldFiles | Remove-Item -Force -Confirm | |
| $emptyFolders = $folder | Get-ChildItem -Directory -Recurse ` |
| function ConvertTo-Dictionary { | |
| [CmdletBinding()] | |
| param ( | |
| [Parameter(Mandatory=$true, ValueFromPipeline=$true)] | |
| $Collection, | |
| [Parameter(Mandatory=$true)] | |
| [string]$Key |
| function Get-WithProgress { | |
| param( | |
| [string] $Activity = 'Processing', | |
| [int] $Loop = 0 | |
| ) | |
| # v1.0 Initial version | |
| # v1.1 Only increase progress AFTER processing an item | |
| # Collect the pipeline input ($Input) up front in an array, | |
| # using @(...) to force enumeration. |
| -- To check if database files are nearing the SQL Server (Express Edition) limits | |
| DECLARE @version varchar(32) = CONVERT(varchar(32), SERVERPROPERTY ('ProductVersion')); | |
| SELECT @version, @@VERSION; | |
| DECLARE @limit_GB float; | |
| IF SERVERPROPERTY('EngineEdition') = 4 -- Express Edition | |
| BEGIN | |
| -- SQL Server Express Edition: | |
| -- Up till SQL Server 2008, limit is 4 GB / file |
| WITH BackupsPerDatabase AS | |
| ( | |
| SELECT | |
| --CONVERT(CHAR(100), SERVERPROPERTY('Servername')) AS Server, | |
| db.database_id, | |
| bs.type, | |
| MAX(bs.backup_finish_date) AS last_db_backup_date | |
| FROM sys.databases db | |
| LEFT OUTER JOIN msdb.dbo.backupset bs ON db.name = bs.database_name | |
| INNER JOIN msdb.dbo.backupmediafamily bmf ON bmf.media_set_id = bs.media_set_id |
| <html> | |
| <head> | |
| <title>Autotask Login Proxy Page</title> | |
| <script> | |
| function loginForm() { | |
| document.myform.submit(); | |
| } | |
| </script> | |
| </head> | |