Trusted Contributor.. Virasat Khan Trusted Contributor..
Trusted Contributor..
527 views

SiteScope API - To Change Monitor Name

HI,

I am looking for a process (not manual as I have some 5000 monitor changes to be done). That I can use via API to change a specific word in my monitor names.

 

Background:: I keep the monitor names as standard that has a string (let's say ALTCI), I want this string on all the 5000 monitors to (ALTCI2). 

 

I have got the input in the format as below where the entire string after the last " ; " is my monitor name and rest before it is path separated by " ;".

(SISName.domain.com)Production;Folder1;Sub-Folder1;hostname1;Linux Non-Alertable OS Resources on hostname1;ALTCI::Linux: Average CPU System and User Time Percent on hostname1

0 Likes
5 Replies
Highlighted
Trusted Contributor.. Wendolyn_M_SiS Trusted Contributor..
Trusted Contributor..

Re: SiteScope API - To Change Monitor Name

Hello Virasat,

We hope you are doing great today,

you can find the parameter to change the name on the following documentation pages 77 and 166 RenameMonitor https://softwaresupport.softwaregrp.com/group/softwaresupport/search-result/-/facetsearch/document/KM02681284

if you have any question don't hesitate in contact us

best regards

Wendolyn Moreira

 

Trusted Contributor.. Virasat Khan Trusted Contributor..
Trusted Contributor..

Re: SiteScope API - To Change Monitor Name

I appreciate your quickly reply!!

That was really helpful.

QQ - Does that also work for a string replace in my monitor name? As mentiond in my original query, I don't want to rename entire monitor, but a perticular string in my monitorname.

I Feel this is possible with below approach - However, wanted to confirm if thre is a better way of doing it.

 

string Altci = "TESTRATE"
string New_Altci = "NOOPS"
string monitorCurrentName = altci+"::Linux: Average CPU System and User Time Percent on hostname1"
string monitorNewName = New_Altci+monitorCurrentName

0 Likes
Trusted Contributor.. Virasat Khan Trusted Contributor..
Trusted Contributor..

Re: SiteScope API - To Change Monitor Name

I get a "401" response when I try to invoke this in python. Any suggestions?

URL = 'http://'+SS_Node+':8080/SiteScope'
RestEND= "/api/monitors/monitor/name"
Final_URL = URL+RestEND
data = {'j_username': 'user', 'j_passord':'pwd', 'j_monitorCurrentName':monitorCurrentName, 'j_ParentGroupName':ParentGroupName, 'j_monitorNewName':monitorNewName, 'j_identifier':"Written by Virasat_Python"}
r = requests.post(url = Final_URL, data = data)

0 Likes
Trusted Contributor.. Virasat Khan Trusted Contributor..
Trusted Contributor..

Re: SiteScope API - To Change Monitor Name

I changed my requst.post syntax to pass on credentials and this time I get a "400" response

r = requests.post(url = Final_URL, data = data, auth=(USER,PWS))

Document doesn't brief about those 3 different status respones, do you hvae any idea what they individually mean?

204

400

500

0 Likes
Trusted Contributor.. Virasat Khan Trusted Contributor..
Trusted Contributor..

Re: SiteScope API - To Change Monitor Name

can someone help me please. I am trying to achieve this in python.

 

URL = 'http://'+SS_Node+':8080/SiteScope'
RestEND= "/api/monitors/monitor/name"
Final_URL = URL+RestEND
data = {'username': 'myuser', 'password':'mypwd, 'monitorCurrentName':monitorCurrentName, 'ParentGroupName':ParentGroupName, 'monitorNewName':monitorNewName, 'identifier':"Written by Virasat_Python"}
json_data = json.dumps(data)
r = requests.post(url = Final_URL, data = json_data, auth=('myuser','mypwd'))
response = r.json()

 

To rename a monitor named "Ping" to "Ping1" I get a bad monitor path error. Even if I have a simple hierarchy and placed the monitor under folder Test under sis_root.

monitorCurrentName  = 'Ping'

monitorNewName = 'Ping1'

ParentGropuName = 'Test'

when i print r.json(), I get the message : bad path to monitor...

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.