Is there a way to auto assign pollers to nodes through power shell?
I would like to create a scheduled task that runs to ensure that my nodes always have the proper pollers enabled on them.
-Ken
No, we don't have a way to do that today.
There's no "win" button for this, but you could certainly pick out some gold standard devices in your inventory (one of each type or sysoid) and then compare all the other devices with the same identifier to make sure they have the appropriate pollers (and assign the ones that are missing). If you want to take a swing at this, let me know. I'll help frame it for you.
That would be very helpful, thank you.
I have a bunch of perl scripts that basically do this across the nodes here.
the scheme is:
- get a set of noeds that are missing the pollers
- add the poller to the nodes.
script snipped below
#!/usr/local/bin/perl# usual perl preludes to import SWIS API and connect to the server...# omitted because it's specific to our install&add_pollers('N.Topology_LLDP.SNMP.lldpRemoteSystemsData');exit(0);sub add_pollers {my $poller=shift;my $node; my $data= $xs->XMLin($swis->QueryXml(q{SELECT NodeIDFROM Orion.NodesWHERE unmanaged=0 and ObjectSubType='SNMP'and nodeid not in (select NetObjectId from orion.pollers where NetObjectType='N' and pollerType=@p)}, {'p'=>$poller} )); my $nodes=$data->{'s:Body'}-> {'QueryXmlResponse'} -> { 'QueryXmlResult'} -> { 'queryResult'}->{'data'}->{'Nodes'} ; if (ref($nodes) eq 'ARRAY') { for my $f (@$nodes){ $node=$f->{'NodeID'}; printf "Add poller $poller to %s\n", $node; my $d1=$xs->XMLin($swis->Create("Orion.Pollers", { 'PollerType'=>$poller, 'NetObject'=>"N:$node", 'NetObjectType'=>'N', 'NetObjectID'=>$node })); if (defined($d1->{'s:Body'}->{'CreateResponse'}->{'CreateResult'})) { printf( "Poller added: %s\n",$d1->{'s:Body'}->{'CreateResponse'}->{'CreateResult'}); } else { print Dumper($d1); }; } } elsif (ref($nodes) eq 'HASH') { $node=$nodes->{'NodeID'}; printf "Add poller $poller to %s\n", $node; my $d1=$xs->XMLin($swis->Create("Orion.Pollers", { 'PollerType'=>$poller, 'NetObject'=>"N:$node", 'NetObjectType'=>'N', 'NetObjectID'=>$node })); if (defined($d1->{'s:Body'}->{'CreateResponse'}->{'CreateResult'})) { printf( "Poller added: %s\n",$d1->{'s:Body'}->{'CreateResponse'}->{'CreateResult'}); } else { print Dumper($d1); }; } else { print "Poller $poller not missing from any nodes\n"; } return;}