Hello everyone!
I am trying to add a specific file system to monitoring with SWIS API. So far I've been using the discovery method successfully, but there are situations where I need to add additional volumes after the node has been already discovered and added to SolarWinds.
I have tried to achieve this with "swis.create", but I'm not sure if it is supposed to work this way, since I would have to generate VolumeID & Volume Index and to set IDENTITY INSERT to ON for the table. I couldn't find any specific "verb" defined for Orion.Volumes for such an action. Does anyone know if this is the way to do it, or is there another way that I'm missing?
Example below:
def create_volumes(self,volume,voldesc,volidx,voltype,volid,nodeid):
""" provided a list of volumes and the nodeid from Orion.Nodes it adds them to monitoring """
props = {
'VolumeIndex': volidx,
'VolumeDescription': voldesc,
'VolumeID': volid,
'NodeID': nodeid,
'VolumeTypeID': voltype,
'Caption': volume
}
results = self.swis.create('Orion.Volumes', **props)
try:
return results
except IndexError:
return False
Returns:
Traceback (most recent call last):
File "./add_missing_hosts_new.py", line 366, in <module>
result = c.create_volumes(volume,voldesc,volidx,voltype,volid,nodeid)
File "/home/apop-sa/automations/monitoring/swtools/swtools/client.py", line 158, in create_volumes
results = self.swis.create('Orion.Volumes', **props)
File "/usr/local/lib/python2.7/dist-packages/orionsdk/swisclient.py", line 34, in create
"Create/" + entity, properties).json()
File "/usr/local/lib/python2.7/dist-packages/orionsdk/swisclient.py", line 59, in _req
resp.raise_for_status()
File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 935, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Cannot insert explicit value for identity column in table 'Volumes' when IDENTITY_INSERT is set to OFF. for url:
Thank you!!!