-
Notifications
You must be signed in to change notification settings - Fork 2
/
CRUD.AddInterface.ps1
45 lines (42 loc) · 1.77 KB
/
CRUD.AddInterface.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# This sample script demonstrates how to add a new interface using CRUD operations.
#
# Please update the hostname and credential setup to match your configuration, and
# reference to an existing node and interface you would like to add for monitoring.
# Connect to SWIS
$hostname = "localhost"
$username = "admin"
$password = New-Object System.Security.SecureString
$cred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
$swis = Connect-Swis -host $hostname -cred $cred
# add an interface, please fill in the correct values you need
$newIfaceProps = @{
NodeID=1; # NodeID on which the interface is working on
InterfaceName="FastEthernet0/0"; # description name of the interface to add
IfName="Fa0/0";
InterfaceIndex=0;
ObjectSubType="SNMP";
Status=0;
RediscoveryInterval=5;
PollInterval=120;
StatCollection=10;
}
$newIfaceUri = New-SwisObject $swis -EntityType "Orion.NPM.Interfaces" -Properties $newIfaceProps
$ifaceProps = Get-SwisObject $swis -Uri $newIfaceUri
# register specific pollers for the node
$poller = @{
NetObject="I:"+$ifaceProps["InterfaceID"];
NetObjectType="I";
NetObjectID=$ifaceProps["InterfaceID"];
}
# Status
$poller["PollerType"]="I.Status.SNMP.IfTable";
$pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller
# Interface Traffic
$poller["PollerType"]="I.StatisticsTraffic.SNMP.Universal";
$pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller
# Interface Errors
$poller["PollerType"]="I.StatisticsErrors32.SNMP.IfTable";
$pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller
# Rediscovery
$poller["PollerType"]="I.Rediscovery.SNMP.IfTable";
$pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller