Skip to content
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

Implement Remove-ZabbixHost #2

Open
lep1986 opened this issue Jun 18, 2018 · 2 comments
Open

Implement Remove-ZabbixHost #2

lep1986 opened this issue Jun 18, 2018 · 2 comments
Assignees
Milestone

Comments

@lep1986
Copy link

lep1986 commented Jun 18, 2018

Hi, I'm trying to delete the one host but I'm not doing well. What i'm doing wrong?

Import-module D:\power-zabbix-master\power-zabbix.psm1
 Auth-Zabbix -URL 'http://192.168.137.242/zabbix/' 
 $r = (Get-ZabbixHost -name  server1)
 Remove-ZabbixHostMass -ZabbixHost $r
@rrg92
Copy link
Owner

rrg92 commented Jun 19, 2018

You must pipe result of Get-ZabbixHost to Remove-ZabbixHostMass:

(Get-ZabbixHost -name  server1) | Remove-ZabbixHostMass

But this action don't remove the host. It is used to remove objects from multiple hosts.

We not implemented yet the method "Remove-ZabbixHost". I will add this soon. For a workaround, you can manually build the request:

import-module power-zabbix
Auth-Zabbix -Url 'http://192.168.137.242/zabbix/'

#Get your host!
$MyHost = Get-ZabbixHost -Name server1 -output @('hostid');

#Build the params object to the host.delete
$request = ZabbixAPI_NewParams "host.delete";

#Here, you can include many host host as a arry. Just separare each id, using a comma
$request.params = @($MyHost.hostid);

#Now call the zabbix!
$result =  Invoke-ZabbixURL $request -Translate;

#If not exception throws, then this result will contains the id of hostids deleted.
$result.RawTranslate

@rrg92 rrg92 changed the title delete one host Implement Remove-ZabbixHost Jun 19, 2018
@rrg92 rrg92 self-assigned this Jun 19, 2018
@rrg92 rrg92 added this to the NextRelease milestone Jun 19, 2018
@rrg92
Copy link
Owner

rrg92 commented Sep 25, 2024

Hey @SCH48 E @lep1986 , thanks a lot for the feedback. I was on hold for a few years due to career and personal changes. Recently, I saw that this module was officially listed on the Zabbix page, and I believe that because of this, it's worth continuing to evolve it and updating it to support the current versions. I'm making some new commits and will soon give better attention to these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants