Hello
Is it possible to parse webpage output into dci result?
for example if webpage returned data like:{
"cluster_name" : "test",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 2,
"number_of_data_nodes" : 2,
"active_primary_shards" : 0,
"active_shards" : 0,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 100.0
}
how would i get "status = good" out of it ?
In short, yes. So you can take advantage of existing Nagios probes or other scripts you've written. But you'll have to write your script.
Download the manual and see section 6.9 and 6.10 for using "external metrics".
Here are two easy examples you can add to your nxagentd.conf file to try it out:
# Windows examples
# Get number of files in a directory (C:\ here)
ExternalParameterShellExec = AAFileCount:dir C:\ | find /c /v ""
# See what directory the agent runs in by default
ExternalParameterShellExec = AAWhatDirIsTheAgentIn:cd
After you add the lines restart the agent.
(I named them AA-whatever so they'd be at the top of the list. )
On the nxmc right-click the node, and select Data Collection Configuration.
Click the New Parameter button.
Click Select
Choose either of the above parameters, then click Query. If you've done it right, it will come back with values.
You can then have NetXMS do different things based on the values, like it does with any other data point.
Thanks for the reply, i managed to make litle powershell script for task at hand.
Egert
Hi,
starting with 3.2 you can also define web service and use it for data collection. For example you can define web service named TestService with correct URL and authentication options and then create DCI with origin "web service". As parameter you should use service_name:path_to_element. For example, to access number_of_pending_tasks element:
TestService:/number_of_pending_tasks
Best regards,
Victor
Thats exactly what i needed, many thanks! :)
Egert