Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
install_zabbix_agent_win
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rinat K. Nugaev
install_zabbix_agent_win
Commits
a764d03d
Commit
a764d03d
authored
Jun 08, 2018
by
Rinat K. Nugaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some checks
parent
5e028b3f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
9 deletions
+29
-9
zabbix_install.ps1
+29
-9
No files found.
zabbix_install.ps1
View file @
a764d03d
Import-Module BitsTransfer
#Importing module BitsTransfer
Try
{
Import-Module BitsTransfer -ErrorAction stop
}
Catch
{
$ErrorMessage
=
$_
.Exception.Message
write-host
"I cannot import the Bits module ((("
write-host
$ErrorMessage
Break
}
#Getting and defining some vars
$PathZabbix
=
${
env
:ProgramFiles
}
+
'\Zabbix'
$osarch
=
wmic os get OSArchitecture /value
$ZabbixConf
=
$PathZabbix
+
'\conf\zabbix_agentd.conf'
#Getting monitoring server ip for Firewall Rule
$monserverip
=
(
Test-Connection
-ComputerName monitoring.nugaev.net -count 1
)
.IPV4Address.ipaddressTOstring
#Downloading and unzip zabbix agent
Try
{
$url
=
"https://support.nugaev.net/files/distrib/zabbix_agent.zip"
$output
=
$env
:TEMP
Start-BitsTransfer
-Source
$url
-Destination
$output
Start-BitsTransfer
-Source
$url
-Destination
$output
-ErrorAction stop
}
Catch
{
$ErrorMessage
=
$_
.Exception.Message
$FailedItem
=
$_
.Exception.ItemName
write-host
"I cannot download the archive ((("
write-host
$ErrorMessage
Break
}
#unzip it
Add-Type
-AssemblyName System.IO.Compression.FileSystem
function
Unzip
...
...
@@ -20,10 +40,9 @@ function Unzip
[
System.IO.Compression.ZipFile]::ExtractToDirectory
(
$zipfile
,
$outpath
)
}
Unzip
$output
\zabbix_agent.zip
$PathZabbix
#Defining platform for version of zabbix agent
if
(
$osarch
-eq
"OSArchitecture=64-bit"
)
{
$osarch
=
"win64"
...
...
@@ -33,10 +52,11 @@ else
$osarch
=
"win32"
}
#Getting computer hostname for config file
$HostnameFull
=
"
$env
:computername.
$env
:userdnsdomain"
#Removing dot from end of the hostname (this behavior possible if computer is not domain joined)
$HostnameFull
=
$HostnameFull
-replace
"\.(?<=\z)"
,
""
#Creating config
#Preparing content for config gile
$confcont
=
"#This is a Nugaev NET Monitoring Server config file
LogFile=
${
env
:ProgramFiles
}
\Zabbix\log\zabbix_agentd.log
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment