-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script does not register servers #2
Comments
Hi Roberto. Thanks so much for this. It's very interesting and useful! I have a couple of questions you might be able to clarify:
I wonder if it would be possible to build an if / then into the script? It might be difficult, becahse my conf file still has "# Hostname". Hm something to think about... |
I am using the agent version 5.2.5, frontend 5.2.5 as well and the script is version v5.x. After removing the parentheses, it started to work on the Windows Server 2019 version. On the other tested systems, they worked with the parentheses. Regarding variables, I am not a PowerShell expert. What I did was search Google for commands that would do what I needed. Then I wondered if a question could not be added:
Or something similar. You better than anyone else can evaluate and see if it is possible. With this addition to the code, there will be no problem with your configuration file. In my configuration file I use the following syntax:
In Zabbix, I created an action to import and add to the Workstations group. |
|
I changed the location from where to download the .PS1 file, because when it comes from Github, it has different encoding and doesn't run. I tried to change the command line but to no avail.
|
I'd have to test this. The problem is, the default config file actually has the hostname parameter, but it is hashed out. I'm not familiar enough with PS to know witout testing if your modification would still pick up hostname on the congif file... |
I'm reall ynot sure why it is not working for you... Mine all download the file from github and it runs fine. I'm a little stumped. |
I tested the script on several operating systems and some worked, others didn't.
Systems tested:
Windows Server 2008 R2 Standard = OK
Windows Server 2008 R2 Enterprise = OK
Windows Server 2012 Standard = OK
Windows Server 2012 R2 Standard = OK
Windows Server 2016 Standard = OK
Windows Server 2016 Datacenter = OK
Windows Server 2019 Standard = Not OK
Some are redundant: Standard, Enterprise, Datacenter. It is a way of showing that they were run on several servers with different operating systems.
On some servers it ran perfect. In others, I had to change the script.
On all Windows Server 2019 Standard, you presented the following error message:
After removing the parentheses on lines 216 and 240, the script ran perfectly:
Response from "server-zabbix.com:10051": "processed: 1; failed: 0; total: 1; seconds spent: 0.000064"
I provide IT services to several companies in different locations and there are machines with the same name (Example: SVR-APP) but which are configured in the zabbix_agentd.conf file as Hostname = SVR-APP-01, Hostname = SVR-APP-02 .
They do not work, because the hostname is not found on Zabbix hosts.
So, I added just after the variable $ Senderarg8 = '1' the following code snippet:
I changed the $env:computername variables to $hostname.
It worked!
The text was updated successfully, but these errors were encountered: