Hi,
Can I procces several Nagios Tables from ServiceNow in order to get the Service Group to which event/service belongs to.
Do you have documentation of the API
Thanks
API for ServiceNow
-
FCC_Nagios_Support
- Posts: 161
- Joined: Tue Mar 10, 2020 11:07 am
Re: API for ServiceNow
I am querying:
curl -XGET "http://10.5.1.159/nagiosxi/api/v1/objec ... 7&pretty=1"
{
"host_name": "mad63205.se.gr.fcc.es",
"service_description": "OS_Windows_1_7_CPU Usage Template",
"objecttype_id": "2",
"object_id": "21047",
"state_time": "2021-02-11 12:23:43",
"state_change": "1",
"state": "1",
"state_type": "1",
"current_check_attempt": "5",
"max_check_attempts": "5",
"last_state": "1",
"last_hard_state": "0",
"instance_id": "1",
"output": "could not fetch information from server"
},
And I obtain all the events
I would like to know to what ServiceGroup belongs to each "service_description"
Do you know the syntax?
Thanks
curl -XGET "http://10.5.1.159/nagiosxi/api/v1/objec ... 7&pretty=1"
{
"host_name": "mad63205.se.gr.fcc.es",
"service_description": "OS_Windows_1_7_CPU Usage Template",
"objecttype_id": "2",
"object_id": "21047",
"state_time": "2021-02-11 12:23:43",
"state_change": "1",
"state": "1",
"state_type": "1",
"current_check_attempt": "5",
"max_check_attempts": "5",
"last_state": "1",
"last_hard_state": "0",
"instance_id": "1",
"output": "could not fetch information from server"
},
And I obtain all the events
I would like to know to what ServiceGroup belongs to each "service_description"
Do you know the syntax?
Thanks
-
FCC_Nagios_Support
- Posts: 161
- Joined: Tue Mar 10, 2020 11:07 am
Re: API for ServiceNow
Is It possible to create a VIEW that can be plublished in the API
Many Thanks
Many Thanks
Re: API for ServiceNow
Hi,
I Think wat you are loooking for is the "/nagiosxi/api/v1/objects/servicegroupmembers"
In this API call you get the servicegroups, and all members of this servicegroup.
In the Help of NagiosXI you can find all API refrence documentation
Kind regards,
Joris Weijters
I Think wat you are loooking for is the "/nagiosxi/api/v1/objects/servicegroupmembers"
In this API call you get the servicegroups, and all members of this servicegroup.
In the Help of NagiosXI you can find all API refrence documentation
Kind regards,
Joris Weijters
-
FCC_Nagios_Support
- Posts: 161
- Joined: Tue Mar 10, 2020 11:07 am
Re: API for ServiceNow
Many Thanks
What I want is to call the api for the statehistory and chain/join with service groupmembers in order to obtain event and its servicegroup
Thanks again
What I want is to call the api for the statehistory and chain/join with service groupmembers in order to obtain event and its servicegroup
Thanks again
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: API for ServiceNow
Hi @FCC_Nagios_Support,
The REST API is fully documented in the user interface with example commands, just go to Help > API Docs.
We do not provide custom scripting/programming as part of product support, but I believe what you want to do here is run a command to get all the members of a particular service using the GET objects/servicegroupmember endpoint.
Once you have created a sequence containing all those members, you can gather the state history by using a limited query on those service group members on the GET objects/statehistory endpoint by object id.
Let us know how it goes.
Benjamin
The REST API is fully documented in the user interface with example commands, just go to Help > API Docs.
We do not provide custom scripting/programming as part of product support, but I believe what you want to do here is run a command to get all the members of a particular service using the GET objects/servicegroupmember endpoint.
Code: Select all
curl -XGET "https://192.168.23.113/nagiosxi/api/v1/objects/servicegroupmembersapikey=<YOURAPIKEY>&pretty=1" -k -k
Code: Select all
curl -XGET "https://192.168.23.113/nagiosxi/api/v1/objects/statehistory?apikey=<YOURAPIKEY>&object_id=<OBJECTID>&pretty=1" -k
Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
FCC_Nagios_Support
- Posts: 161
- Joined: Tue Mar 10, 2020 11:07 am
Re: API for ServiceNow
Hi
I create a View in Laboratory
called
FER
CREATE VIEW FER
AS
SELECT s.object_id as object_id, n.display_name as display_name, n.service_object_id as service_id
ON s.object_id=n.service_object_id
But I cannot query by the API
[root@osboxes ~]# curl -XGET "http://192.168.1.117//nagiosxi/api/v1/o ... D&pretty=1" {
"error": "Unknown API endpoint."
}
[root@osboxes ~]#
How can I publish the VIEW in order to query it
Thanks
I create a View in Laboratory
called
FER
CREATE VIEW FER
AS
SELECT s.object_id as object_id, n.display_name as display_name, n.service_object_id as service_id
ON s.object_id=n.service_object_id
But I cannot query by the API
[root@osboxes ~]# curl -XGET "http://192.168.1.117//nagiosxi/api/v1/o ... D&pretty=1" {
"error": "Unknown API endpoint."
}
[root@osboxes ~]#
How can I publish the VIEW in order to query it
Thanks
Re: API for ServiceNow
You cannot call a MySQL view directly from the API, you would need to write your own custom API endpoint that calls the view and does with it what you want programmatically, see here on your system:
I can submit a request to development to see if they'll add what servicegroups the service is in to the State History API endpoint if you'd like?
Code: Select all
http://YOURXISERVER/nagiosxi/help/custom-api-endpoints.php