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
9f847963
Commit
9f847963
authored
Jun 11, 2018
by
Rinat K. Nugaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added creating log dir and download from any url
parent
384d427c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
zabbix_install.ps1
+13
-7
No files found.
zabbix_install.ps1
View file @
9f847963
...
@@ -56,9 +56,11 @@ Break
...
@@ -56,9 +56,11 @@ Break
}
}
#Getting and defining some vars
#Getting and defining some vars
#$urldistzabbix where your zabbix_agent archive
#$urldistzabbix where your zabbix_agent archive
$urldistzabbix
=
"https://support.nugaev.net/files/distrib/zabbix_agent.zip"
#$urldistzabbix = "https://support.nugaev.net/files/distrib/zabbix_agent.zip"
$urldistzabbix
=
"https://www.zabbix.com/downloads/3.4.6/zabbix_agents_3.4.6.win.zip"
#$temparchivedir where you'll download zabbix_agent archive
#$temparchivedir where you'll download zabbix_agent archive
$temparchive
dir
=
$env
:TEMP
$temparchive
=
"
$env
:TEMP\zabbix_agent.zip"
#$PathZabbix folder where you'll install zabbix agent
#$PathZabbix folder where you'll install zabbix agent
$PathZabbix
=
${
env
:ProgramFiles
}
+
'\Zabbix'
$PathZabbix
=
${
env
:ProgramFiles
}
+
'\Zabbix'
#$ZabbixConf zabbix agent config
#$ZabbixConf zabbix agent config
...
@@ -70,7 +72,7 @@ $monserverip = (Test-Connection -ComputerName monitoring.nugaev.net -count 1).IP
...
@@ -70,7 +72,7 @@ $monserverip = (Test-Connection -ComputerName monitoring.nugaev.net -count 1).IP
#Downloading and unzip zabbix agent
#Downloading and unzip zabbix agent
Try
Try
{
{
Start-BitsTransfer
-Source
$urldistzabbix
-Destination
$temparchive
dir
-ErrorAction stop
Start-BitsTransfer
-Source
$urldistzabbix
-Destination
$temparchive
-ErrorAction stop
}
}
Catch
Catch
{
{
...
@@ -89,8 +91,10 @@ function Unzip
...
@@ -89,8 +91,10 @@ function Unzip
[
System.IO.Compression.ZipFile]::ExtractToDirectory
(
$zipfile
,
$outpath
)
[
System.IO.Compression.ZipFile]::ExtractToDirectory
(
$zipfile
,
$outpath
)
}
}
Unzip
$temparchive
\zabbix_agent.zip
$PathZabbix
Unzip
$temparchive
$PathZabbix
Remove-Item
-Force
$temparchive
\zabbix_agent.zip
Remove-Item
-Force
$temparchive
#Creating zabbix agent log folder
New-Item
-ItemType directory -Path
$PathZabbix
\log
#Getting computer hostname for config file
#Getting computer hostname for config file
$HostnameFull
=
"
$env
:computername.
$env
:userdnsdomain"
$HostnameFull
=
"
$env
:computername.
$env
:userdnsdomain"
#Removing dot from end of the hostname (this behavior possible if computer is not domain joined)
#Removing dot from end of the hostname (this behavior possible if computer is not domain joined)
...
@@ -120,12 +124,14 @@ else
...
@@ -120,12 +124,14 @@ else
#Defining zabbix install command. It depends on $OsArch variable
#Defining zabbix install command. It depends on $OsArch variable
$ZabbixInstallCommand
=
"
`"
C:\Program Files\Zabbix\bin\
$OsArch
\zabbix_agentd.exe
`"
--config
`"
C:\Program Files\Zabbix\conf\zabbix_agentd.conf
`"
"
$ZabbixInstallCommand
=
`
"
`"
C:\Program Files\Zabbix\bin\
$OsArch
\zabbix_agentd.exe
`"
--config
`"
C:\Program Files\Zabbix\conf\zabbix_agentd.conf
`"
"
#Installing Zabbix Service
#Installing Zabbix Service
Try
Try
{
{
New-Service
-Name
"Zabbix Agent"
-BinaryPathName
$ZabbixInstallCommand
-DisplayName
"Zabbix Agent"
-Description
"Provides Monitoring"
-StartupType
"Automatic"
New-Service
-Name
"Zabbix Agent"
-BinaryPathName
$ZabbixInstallCommand
`
-DisplayName
"Zabbix Agent"
-Description
"Provides Monitoring"
-StartupType
"Automatic"
}
}
Catch
Catch
{
{
...
...
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