Skip to content

Commit

Permalink
Merge before release 0.99h - Highway 17 (#289)
Browse files Browse the repository at this point in the history
* Update VIM25VsanmgmtRuntime.pm

#255

* Update VIM25VsanmgmtStub.pm

#255

* Delete VMware-vSphere-Perl-SDK-7.0.0-16815913.x86_64.tar.gz

#255

* Create VMware-vSphere-Perl-SDK-7.0.0-17698549.x86_64.tar.gz

#255

* Update VsanPullStatistics.ps1

#254

* Update ViConnect.ps1

#254

* #237

* #237

* Revert "#237"

This reverts commit 5179624.

* Revert "#237"

This reverts commit a95d642.

* Revert "Revert "#237""

This reverts commit 57122fb.

* Update exportSexiGrafBundle.sh

#254

* Update exportSexiGrafBundle.sh

* Update exportSexiGrafBundle.sh

#254

* Update importSexiGrafBundle.sh

#254

* Update export-import.php

#257

* Update VMware_All_Version.json

* Update VsanPullStatistics.ps1

* Update ViPullStatistics.pl

#259

* Update graphite.conf

* Update importSexiGrafBundle.sh

* Update ports.conf

* Update credstore.php

* Update export-import.php

* Update importSexiGrafBundle.sh

#254

* Create powershell.config.json

#261

* Update VsanPullStatistics.ps1

* Update importSexiGrafBundle.sh

* Update VsanPullStatistics.ps1

* Update VsanPullStatistics.ps1

* Update VsanPullStatistics.ps1

#249

* Update VsanPullStatistics.ps1

#174

* Update VsanPullStatistics.ps1

#174

* Update VsanPullStatistics.ps1

#174

* Update VsanPullStatistics.ps1

#143

* Update VMware_vSAN_Monitor_TCP.json

#250

* Derivative to nonNegativeDerivative

#265

* Update FreeNAS.json

* Update VMware_All_Datastore_Usage_Distribution.json

* Update VMware_All_Version.json

* Update VMware_vCenter_Bad_Events.json

* Update powershell.config.json

* Update VsanPullStatistics.ps1

* Update importSexiGrafBundle.sh

* Update addVsanCrontab.sh

* Update credstore.php

* Update ViConnect.ps1

* Update VMware_Cluster_FullStats.json

http://obfuscurity.com/2013/05/Graphite-Tip-Counting-Number-of-Metrics-Reported

* Update VMware_All_Cluster_FullStats.json

http://obfuscurity.com/2013/05/Graphite-Tip-Counting-Number-of-Metrics-Reported

* Create ViPullStatistics.ps1

* Update ViPullStatistics.ps1

* Update ViConnect.ps1

* Update ViPullStatistics.ps1

#182

* Update ViPullStatistics.ps1

#254

* Update ViPullStatistics.ps1

#143

* Update VMware_All_Version.json

* Update ViPullStatistics.ps1

* Update ViPullStatistics.ps1

#272

* Update ViPullStatistics.ps1

#272

* Update VsanPullStatistics.ps1

* Update VsanPullStatistics.ps1

#143

* Update ViPullStatistics.ps1

* Update ViPullStatistics.ps1

#143

* Update ViPullStatistics.ps1

#143

* Update ViPullStatistics.ps1

#254 #143

* Update VMware_VSAN_Resync.json

* Update VMware_All_Version.json

* Update VMware_Multi_Cluster_Capacity_Planning.json

* Update VMware_Multi_Cluster_QuickStats.json

* Update ViOfflineInventory

* Create VmNetInfos.csv

#269

* #269

* Update ViPullStatistics.ps1

#254

* Update VMware_Multi_Cluster_QuickStats.json

* Update VMware_Cluster_Multi_ESX_LiteStats.json

* Update VMware_All_Cluster_SuperStats.json

* Update VMware_All_Cluster_FullStats.json

* Update ViPullStatistics.ps1

#254

* Update ViPullStatistics.ps1

#254

* Update ViPullStatistics.ps1

#254

* Update ViPullStatistics.ps1

#254

* #192

CpuWait to CpuIoWait

* Update ViPullStatistics.ps1

* #203

numXVMotion

* #269

* Update ViVmInventory.ps1

#269

* Update ViVmInventory.ps1

#269

* Update ViVmInventory.ps1

* Update ViVmInventory.ps1

* #269

* #269

* Update ViPullStatistics.ps1

* Update VsanPullStatistics.ps1

* #269

* #254

* Update ViOfflineInventory.ps1

* Update addVsanCrontab.sh

* Update ViPullStatistics.ps1

#254

* Update ViPullStatistics.ps1

#254

* #254

* Update ViPullStatistics.ps1

* Update ViPullStatistics.ps1

* Update SexiGraf_Pull_Exec_Time.json

* Update updateInventory.sh

* Update refresh-inventory.php

* Delete PullGuestInfo.sh

* Update ViPullStatistics.ps1

* Update ViOfflineInventory.ps1

* Create PullGuestInfo.sh

* #269

* Update credstore.php

* Update VMware_All_Version.json

* Update ViOfflineInventory.ps1

* Update collectd.conf

* Update ViOfflineInventory.ps1

* Update refresh-inventory.php

* Update ViPullStatistics.ps1

* Update ViOfflineInventory.ps1

#269

* Update PullGuestInfo.sh

* Update ViOfflineInventory.ps1

* Update ViPullStatistics.ps1

* Update ViPullStatistics.ps1

* Update VsanPullStatistics.ps1

* Update ViOfflineInventory.ps1

* Update ViPullStatistics.ps1

* Update storage-schemas.conf

* Update importSexiGrafBundle.sh

* Update ViPullStatistics.ps1

fix snapshot count for vsan

* #254

* Update WhisperAutoPurge.ps1

* #254

* Update refresh-inventory.php

* Update importSexiGrafBundle.sh

#254

* Update ViOfflineInventory

* #239

* #229

* #269

* Update VsanPullStatistics.ps1

* Update ViOfflineInventory.ps1

* #276

* #276

* #277

* Update PullGuestInfo.sh

* Update VsanPullStatistics.ps1

* Update VMware_BroStats.json

* #221

* Update ViPullStatistics.ps1

* Update VsanPullStatistics.ps1

* Update VMware_BroStats.json

* Update VMware_VM_Inventory.json

* Update VMware_ESX_Inventory.json

* Update export-import.php

* Update VMware_BroStats.json

* Update VMware_VM_Inventory.json

* Update VMware_ESX_Inventory.json

* Update SexiGraf_Pull_Exec_Time.json

* Update storage-schemas.conf

* Update ViPullStatistics.ps1

* Update VMware_Cluster_FullStats.json

* Update VMware_Cluster_Multi_ESX_LiteStats.json

* Update VsanPullStatistics.ps1

* #203

* Update ViPullStatistics.ps1

#264

* Update importSexiGrafBundle.sh

* Update VsanPullStatistics.ps1

#264

* #264

* Update sexigraf

* Update VsanPullStatistics.ps1

#264

* Update VMware_All_Cluster_Top_N_VM_Stats.json

* Update VMware_vSAN_Monitor_TCP.json

* #264

* Update ViPullStatistics.ps1

#264

* Update addVsanCrontab.sh

* Update ViPullStatistics.ps1

#264

* Update VMware_vSAN_SMART_Stats.json

* Update ViPullStatistics.ps1

* Update ViPullStatistics.ps1

* Update ViPullStatistics.ps1

* Update sexigraf

* Update carbon.conf

* Update sexigraf

* Update ViPullStatistics.ps1

* Update ViPullStatistics.ps1

* Update ViPullStatistics.ps1

* Update ViPullStatistics.ps1

* Update ViPullStatistics.ps1

* Update ViPullStatistics.ps1

* Update storage-schemas.conf

* Update ViPullStatistics.ps1

#264

* Update addVsanCrontab.sh

#264

* Update ViPullStatistics.ps1

#250

* Update ViPullStatistics.ps1

* Update importSexiGrafBundle.sh

* #264

* #264

* Delete log4perl.conf

* Update LICENSE.md

* Update storage-schemas.conf

* Update importSexiGrafBundle.sh

* Update importSexiGrafBundle.sh

* Update README.md

* Update graphite.conf

grafana/grafana#45117 (comment)

* Update graphite.conf

* Create netdata.conf

* Update ViPullStatistics.ps1

* Update importSexiGrafBundle.sh

* Update VMware_All_Cluster_SuperStats.json

* Update ViPullStatistics.ps1

* Update ViPullStatistics.ps1

* Update export-import.php

* Update ViPullStatistics.ps1

* Update VMware_Multi_VSAN_Monitor.json

* Update VMware_VSAN_Monitor.json

* Update VMware_Multi_Cluster_Top_N_VM_QuickStats.json

* Update VMware_Multi_Cluster_Top_N_VM_Overcommit.json

* Update VMware_All_Standalone_ESX_VM_Stats.json

* Update VMware_All_Standalone_ESX_Top_N_VM_Stats.json

* Update VMware_All_Cluster_VM_Stats.json

* Update VMware_All_Cluster_Top_N_VM_Stats.json

* Update ViPullStatistics.ps1

* Update Netdata.json

* Update VMware_Multi_Cluster_Top_N_VM_Latency.json

* Update ViPullStatistics.ps1

#287

* Update ViPullStatistics.ps1

* Update ViPullStatistics.ps1

* Update index.php

* Update ViOfflineInventory.ps1

* Update ViPullStatistics.ps1

#268

* Update ViOfflineInventory.ps1

* #268

* Update ViPullStatistics.ps1

#159

* Update VMware_VSAN_Resync.json

* Update VMware_Multi_VSAN_Monitor.json

* #250

* Update README.md

* Update ViOfflineInventory.ps1

* Update VMware_BroStats.json

* Update ViOfflineInventory.ps1

* Update SexiGraf_Web_Admin.json

* Update PullGuestInfo.sh

#211

* Update VMware_VSAN_Resync.json

* Update ViPullStatistics.ps1

* Update ViPullStatistics.ps1

* Update ViOfflineInventory.ps1

* Update VMware_All_Cluster_SuperStats.json

* Update VMware_Cluster_FullStats.json

* Update VMware_All_Cluster_SuperStats.json

* Update VMware_All_Cluster_SuperStats.json

* Update VMware_Multi_vSAN_Monitor_TCP.json

Co-authored-by: Raphaël SCHITZ <[email protected]>
  • Loading branch information
vmdude and rschitz authored Mar 28, 2022
1 parent de0bcf1 commit 368ea62
Show file tree
Hide file tree
Showing 88 changed files with 9,911 additions and 131,585 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 sexibytes
Copyright (c) 2022 sexibytes

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[![SexiBanner](http://www.sexigraf.fr/wp-content/uploads/2017/07/SexiGrafBanner.png)](http://www.sexigraf.fr)

SexiGraf is a fully open-source vSphere centric Graphite VMware appliance with a Grafana frontend. It pulls VI and VSAN metrics from VMware vCenter APIs, push them to Graphite and let Grafana produces the gorgeous dashboards we love so much!
SexiGraf is a fully open-source vSphere centric Graphite VMware appliance with a Grafana frontend. It pulls VI and vSAN metrics from VMware vCenter APIs, push them to Graphite and let Grafana produces the gorgeous dashboards we love so much!

*Full changelog is available here: [CHANGELOG.md](CHANGELOG.md)*

*Official website for this awesome appliance is available at http://www.sexigraf.fr*

## VMware VSAN
## VMware vSAN

The metrics used in the various VSAN dashboards are collected every minutes using to the `QueryVsanStatistics` API method of `HostVsanInternalSystem`. With some json ticks, it is possible to access any metrics from the VSAN cluster. And guess what! We’re already working on other cool SexiPanels for VSAN: http://www.sexigraf.fr/vsan-sexipanels/
The metrics used in the various VSAN dashboards are now collected every 5 minutes using to the `VsanPerfQueryPerf` API method of `VsanPerformanceManager` from the famous `vSAN performance service`. With some educated guesses, it is possible to access almost any metrics from the vSAN cluster. And guess what! We’re already working on more cool SexiPanels for vSAN: http://www.sexigraf.fr/vsan-sexipanels/

## VMware vSphere

Expand Down
2 changes: 1 addition & 1 deletion etc/apache2/ports.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# /etc/apache2/sites-enabled/000-default.conf

Listen 80
Listen 8080
Listen 127.0.0.1:8080

<IfModule ssl_module>
Listen 443
Expand Down
11 changes: 10 additions & 1 deletion etc/apache2/sites-available/graphite.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ExtendedStatus On
</Location>

<Location "/server-status">
SetHandler server-status
SetHandler server-status
</Location>

# XXX To serve static files, either:
Expand Down Expand Up @@ -91,9 +91,17 @@ ExtendedStatus On

SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
ProxyPreserveHost On

ProxyPass /netdata/ http://127.0.0.1:19999/
ProxyPass / http://127.0.0.1:3000/


## HTTPS REDIRECT
# RewriteEngine On
# RewriteCond %{HTTPS} off
# RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Expand All @@ -119,6 +127,7 @@ ExtendedStatus On

SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
ProxyPreserveHost On

ProxyPass /netdata/ http://127.0.0.1:19999/
ProxyPass / http://127.0.0.1:3000/
Expand Down
8 changes: 4 additions & 4 deletions etc/collectd/collectd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ LoadPlugin write_graphite
#</Plugin>

<Plugin interface>
Interface "ens192"
Interface "eth0"
IgnoreSelected false
</Plugin>

Expand Down Expand Up @@ -1115,6 +1115,6 @@ LoadPlugin write_graphite
# Tag "foobar"
#</Plugin>

<Include "/etc/collectd/collectd.conf.d">
Filter "*.conf"
</Include>
# <Include "/etc/collectd/collectd.conf.d">
# Filter "*.conf"
# </Include>
2 changes: 1 addition & 1 deletion etc/cron.d/ViOfflineInventory
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3 * * * * root /usr/bin/perl /root/getInventory.pl
3 */1 * * * root /usr/bin/pwsh -NonInteractive -NoProfile -f /opt/sexigraf/ViOfflineInventory.ps1 -credstore /mnt/wfs/inventory/vipscredentials.xml >/dev/null 2>&1
25 changes: 25 additions & 0 deletions etc/grafana/provisioning/dashboards/VMware_Inventory.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: 1

providers:
# <string> an unique provider name
- name: 'VMware_Inventory'
# <int> org id. will default to orgId 1 if not specified
orgId: 1
# <string, required> name of the dashboard folder. Required
folder: 'VMware Inventory'
# <string> folder UID. will be automatically generated if not specified
# CRC32 of name
folderUid: '21622e96'
# <string, required> provider type. Required
type: file
# <bool> disable dashboard deletion
disableDeletion: false
# <bool> enable dashboard editing
editable: true
# <int> how often Grafana will scan for changed dashboards
updateIntervalSeconds: 10
# <bool> allow updating provisioned dashboards from the UI
allowUiUpdates: false
options:
# <string, required> path to dashboard files on disk. Required
path: /var/lib/grafana/dashboards/VMware_Inventory
23 changes: 0 additions & 23 deletions etc/log4perl.conf

This file was deleted.

10 changes: 9 additions & 1 deletion etc/logrotate.d/sexigraf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@
notifempty
create 600 www-data www-data
}
/var/log/sexigraf/carbon-cache-a/*.log {
/var/log/sexigraf/carbon/carbon-cache-*/*.log {
hourly
missingok
rotate 24
compress
delaycompress
notifempty
}
/var/log/sexigraf/carbon/carbon-relay-*/*.log {
hourly
missingok
rotate 24
Expand Down
34 changes: 34 additions & 0 deletions etc/netdata/netdata.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# netdata configuration
#
# You can download the latest version of this file, using:
#
# wget -O /etc/netdata/netdata.conf http://localhost:19999/netdata.conf
# or
# curl -o /etc/netdata/netdata.conf http://localhost:19999/netdata.conf
#
# You can uncomment and change any of the options below.
# The value shown in the commented settings, is the default value.
#

[global]
run as user = netdata

# the default database size - 1 hour
history = 3600

# some defaults to run netdata with least priority
process scheduling policy = idle
OOM score = 1000

bind socket to IP = 127.0.0.1

[web]
web files owner = root
web files group = netdata

# by default do not expose the netdata port
bind to = localhost
x-frame-options response header = sameorigin

[backend]
bind socket to IP = 127.0.0.1
2 changes: 1 addition & 1 deletion etc/sexigraf_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.99g "Ravenholm"
0.99h "Highway 17"
1 change: 1 addition & 0 deletions opt/graphite/conf/carbon.conf
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ PICKLE_RECEIVER_PORT = 2004
PICKLE_RECEIVER_MAX_LENGTH = 1048576

LOG_DIR = /var/log/sexigraf/carbon/
ENABLE_LOGROTATION = False

# Carbon-relay has several options for metric routing controlled by RELAY_METHOD
#
Expand Down
32 changes: 31 additions & 1 deletion opt/graphite/conf/storage-aggregation.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,34 @@ aggregationMethod = last
[SVMotion]
pattern = .\.numSVMotions.
xFilesFactor = 0.0
aggregationMethod = last
aggregationMethod = last

[XVMotion]
pattern = .\.numXVMotions.
xFilesFactor = 0.0
aggregationMethod = last

[ProductVersion]
pattern = ^vi.*\.vi\.version\.*
xFilesFactor = 0.0
aggregationMethod = last

[droppedRx]
pattern = .\.droppedRx.
xFilesFactor = 0.0
aggregationMethod = sum

[droppedTx]
pattern = .\.droppedTx.
xFilesFactor = 0.0
aggregationMethod = sum

[errorsRx]
pattern = .\.errorsRx.
xFilesFactor = 0.0
aggregationMethod = sum

[errorsTx]
pattern = .\.errorsTx.
xFilesFactor = 0.0
aggregationMethod = sum
25 changes: 22 additions & 3 deletions opt/graphite/conf/storage-schemas.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,34 @@ retentions = 60:90d
pattern = ^collectd\.sexigraf\.
retentions = 1m:1h,2m:2h,4m:3h,12m:12h,24m:2d,96m:7d,192m:30d,3840m:1y

[smart]
pattern = ^smart\.
retentions = 60m:7d,240m:30d,720m:90d,2880m:1y,5760m:2y,17280m:5y

[pfsense]
pattern = ^pfsense\.
retentions = 1m:1h,2m:2h,4m:3h,12m:12h,24m:2d,96m:7d,192m:30d,3840m:1y

[vsan_health]
pattern = .*\.vsan\.ObjectHealthDetail\.
retentions = 5m:24h,10m:48h,60m:7d,240m:30d,720m:90d,2880m:1y

[vsan_sync]
pattern = .*\.vsan\.SyncingVsanObjects\.
retentions = 5m:24h,10m:48h,60m:7d,240m:30d,720m:90d

[vsan_smart]
pattern = .*\.vsan\.disk\.smart\.
retentions = 5m:24h,10m:48h,60m:7d,240m:30d,720m:90d,2880m:1y

[vsan_spaceDetail]
pattern = .*\.vsan\.spaceDetail\.
retentions = 5m:24h,10m:48h,60m:7d,240m:30d,720m:90d,2880m:1y,5760m:2y,17280m:5y

[vsan]
pattern = ^vsan\.
retentions = 1m:1h,2m:2h,4m:3h,12m:12h,24m:2d,96m:7d,192m:30d,960m:180d
retentions = 5m:12h,10m:24h,20m:48h,80m:7d,320m:30d,640m:90d

[anything_else]
pattern = .*
# retentions = 5m:3h,10m:12h,20m:48h,80m:7d,240m:30d,720m:90d,2880m:1y,5760m:2y,17280m:5y
retentions = 5m:24h,10m:48h,80m:7d,240m:30d,720m:90d,2880m:1y,5760m:2y,17280m:5y
retentions = 5m:24h,10m:48h,60m:7d,240m:30d,720m:90d,2880m:1y,5760m:2y,17280m:5y
112 changes: 112 additions & 0 deletions opt/sexigraf/CredstoreAdmin.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/usr/bin/pwsh -Command
#
param([Parameter (Mandatory=$true)] [string] $credstore, [string] $server, [string] $username, [string] $password, [switch] $add, [switch] $remove, [switch] $list, [switch] $createstore, [switch] $check)

# https://www.powershellmagazine.com/2013/08/19/mastering-everyday-xml-tasks-in-powershell/
# https://github.com/dotnet/platform-compat/blob/master/docs/DE0001.md

try {
if ($createstore -ne $true) {
$createstorexml = New-Object -TypeName XML
$createstorexml.Load($credstore)
}
} catch {
write-host "credstore not found or not valid xml"
exit 1
}

if ($createstore) {
if (!$(Test-Path $credstore)) {
try {
$XmlWriter = New-Object System.XMl.XmlTextWriter($credstore,$Null)
$xmlWriter.Formatting = 'Indented'
$xmlWriter.Indentation = 1
$XmlWriter.IndentChar = "`t"
$xmlWriter.WriteStartDocument()
$xmlWriter.WriteProcessingInstruction("xml-stylesheet", "type='text/xsl' href='style.xsl'")
$xmlWriter.WriteStartElement('viCredentials')
$xmlWriter.WriteStartElement('passwordEntry')
$xmlWriter.WriteElementString('server',"__localhost__")
$xmlWriter.WriteElementString('username',"login")
$xmlWriter.WriteElementString('password',"xxxxx")
$xmlWriter.WriteEndElement()
$xmlWriter.WriteEndDocument()
$xmlWriter.Flush()
$xmlWriter.Close()
} catch {
write-host "cannot create file"
exit 1
}
} else {
write-host "file already exists"
exit 1
}
} elseif ($check) {
if ($server) {
$XPath = '//passwordEntry[server="' + $server + '"]'
if ($(Select-XML -Xml $createstorexml -XPath $XPath)){
$item = Select-XML -Xml $createstorexml -XPath $XPath
return $item.Node.count
} else {
return 0
}
} else {
write-host "specify -server"
exit 1
}
} elseif ($list) {
$viCredentialsList = @()
foreach ($viCredential in $createstorexml.viCredentials.passwordEntry) {
if ($viCredential.server.ToString() -ne "__localhost__") {
$viCredentialEntry = "" | Select-Object server, username
$viCredentialEntry.server = $viCredential.server.ToString()
$viCredentialEntry.username = $viCredential.username.ToString()
$viCredentialsList += $viCredentialEntry
}
}
return $viCredentialsList|Sort-Object server|Format-Table -hidetableheaders -Property server, username
} elseif ($add) {
if ($server -and $username -and $password) {
$XPath = '//passwordEntry[server="' + $server + '"]'
if (!$(Select-XML -Xml $createstorexml -XPath $XPath)){
try {
$item = Select-XML -Xml $createstorexml -XPath '//passwordEntry[1]'
$newnode = $item.Node.CloneNode($true)
$newnode.server = $server
$newnode.username = $username
$newnode.password = [Convert]::ToBase64String($([System.Text.Encoding]::Unicode.GetBytes($password)))
# [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($newnode.password))
$passwordEntry = Select-XML -Xml $createstorexml -XPath '//viCredentials'
$passwordEntry.Node.AppendChild($newnode)
$createstorexml.Save($credstore)
} catch {
write-host "cannot add entry"
exit 1
}
} else {
write-host "$server entry already exists"
exit 1
}
} else {
write-host "specify -server and -username and -password"
exit 1
}
} elseif ($remove) {
if ($server) {
try {
$XPath = '//passwordEntry[server="' + $server + '"]'
$item = Select-XML -Xml $createstorexml -XPath $XPath
$null = $item.Node.ParentNode.RemoveChild($item.node)
$createstorexml.Save($credstore)
} catch {
write-host "cannot remove entry"
exit 1
}
} else {
write-host "specify -server"
exit 1
}
} else {
write-host "specify -list, -createstore, -add, -remove or -check"
exit 1
}
Loading

0 comments on commit 368ea62

Please sign in to comment.