You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Surinder Mehra <re...@gmail.com> on 2023/02/01 06:21:39 UTC

Get TotalServerNodes using controlscript/Rest Api

Hi,
I am trying to find a way to fetch the count of server nodes in ignite
cluster but don't see any control script option or in Rest api. Could you
please suggest if it is possible. Below link shows this is exposed as a
cluster metric but not accessible through above two options.

https://ignite.apache.org/docs/latest/monitoring-metrics/new-metrics#cluster

Related stackoverflow post:
https://stackoverflow.com/questions/75301565/ignite-cluster-size-using-control-script/

Regards,
Surinder

Re: Get TotalServerNodes using controlscript/Rest Api

Posted by Николай Ижиков <ni...@apache.org>.
> There’s also ignitevisorcmd that you can script.

Visor was removed from Apache Ignite master. 
Please, don't rely on visor.

> 1 февр. 2023 г., в 13:55, Николай Ижиков <NI...@gmail.com> написал(а):
> 
> Hello.
> 
> You can query any metric value or system view content via control script [1], [2]
> 
> > control.sh --system-view nodes
> 
> or [3]
> 
> > control.sh —metric cluster.TotalBaselineNodes
> > control.sh —metric cluster.TotalServerNodes
> > control.sh —metric cluster.TotalClientNodes
> 
> [1] https://ignite.apache.org/docs/latest/tools/control-script#metric-command
> [2] https://ignite.apache.org/docs/latest/tools/control-script#system-view-command
> [3] https://ignite.apache.org/docs/2.11.1/monitoring-metrics/new-metrics#cluster
> 
> 
>> 1 февр. 2023 г., в 13:28, Stephen Darlington <st...@gridgain.com> написал(а):
>> 
>> I’m not aware of any single command to do it, but there are a few options. I’ll list a few as they’re all imperfect.
>> 
>> There are some command-line JMX reader commands you could use to extract the information from Ignite’s metrics.
>> 
>> You could extract the information from the REST API. I needed to use the jq command to parse it into just a count:
>> 
>> http 'http://localhost:8080/ignite?cmd=top' | jq '[ .response[] ] | length' 
>> 
>> You could search the logs for “Topology snapshot” lines.
>> 
>> There’s also ignitevisorcmd that you can script.
>> 
>> Regards,
>> Stephen
>> 
>>> On 1 Feb 2023, at 09:32, Surinder Mehra <re...@gmail.com> wrote:
>>> 
>>> Thanks, I am aware of it. But I needed this in a script. So either curl or control options would be good.
>>> 
>>> On Wed, 1 Feb 2023, 14:51 Aleksandr Pakhomov, <apkhmv@gmail.com <ma...@gmail.com>> wrote:
>>>> Hi, 
>>>> 
>>>> Do you have a chance to use a java client? 
>>>> 
>>>> https://ignite.apache.org/docs/latest/thin-clients/java-thin-client
>>>> 
>>>> It seems this could help igniteClient.cluster().forServers().nodes().count(); 
>>>> 
>>>> Best regards, 
>>>> Aleksandr
>>>> 
>>>>> On 1 Feb 2023, at 10:21, Surinder Mehra <rednirus@gmail.com <ma...@gmail.com>> wrote:
>>>>> 
>>>>> Hi,
>>>>> I am trying to find a way to fetch the count of server nodes in ignite cluster but don't see any control script option or in Rest api. Could you please suggest if it is possible. Below link shows this is exposed as a cluster metric but not accessible through above two options.
>>>>> 
>>>>> https://ignite.apache.org/docs/latest/monitoring-metrics/new-metrics#cluster
>>>>>  
>>>>> Related stackoverflow post:  
>>>>> https://stackoverflow.com/questions/75301565/ignite-cluster-size-using-control-script/
>>>>> 
>>>>> Regards,
>>>>> Surinder
>>>> 
>> 
> 


Re: Get TotalServerNodes using controlscript/Rest Api

Posted by Surinder Mehra <re...@gmail.com>.
You amazed me sir. Thanks a lot, I will update the linked thread on
stackoverflow. Command looks like below now

 kubectl --kubeconfig  config.conf exec <ignite-node> -n {client_name} --
/opt/ignite/apache-ignite/bin/./control.sh --metric
 cluster.TotalServerNodes | grep -v  "metric" | grep
cluster.TotalServerNodes | cut -d " " -f5 | sed 's/^ *//g'

On Wed, Feb 1, 2023 at 4:34 PM Stephen Darlington <
stephen.darlington@gridgain.com> wrote:

> Cool. You learn something new every day!
>
> On 1 Feb 2023, at 10:55, Николай Ижиков <ni...@apache.org> wrote:
>
> Hello.
>
> You can query any metric value or system view content via control script
> [1], [2]
>
> > control.sh --system-view nodes
>
> or [3]
>
> > control.sh —metric cluster.TotalBaselineNodes
> > control.sh —metric cluster.TotalServerNodes
> > control.sh —metric cluster.TotalClientNodes
>
> [1]
> https://ignite.apache.org/docs/latest/tools/control-script#metric-command
> [2]
> https://ignite.apache.org/docs/latest/tools/control-script#system-view-command
> [3]
> https://ignite.apache.org/docs/2.11.1/monitoring-metrics/new-metrics#cluster
>
>
> 1 февр. 2023 г., в 13:28, Stephen Darlington <
> stephen.darlington@gridgain.com> написал(а):
>
> I’m not aware of any single command to do it, but there are a few options.
> I’ll list a few as they’re all imperfect.
>
> There are some command-line JMX reader commands you could use to extract
> the information from Ignite’s metrics.
>
> You could extract the information from the REST API. I needed to use the
> jq command to parse it into just a count:
>
> http 'http://localhost:8080/ignite?cmd=top' | jq '[ .response[] ] |
> length'
>
> You could search the logs for “Topology snapshot” lines.
>
> There’s also ignitevisorcmd that you can script.
>
> Regards,
> Stephen
>
> On 1 Feb 2023, at 09:32, Surinder Mehra <re...@gmail.com> wrote:
>
> Thanks, I am aware of it. But I needed this in a script. So either curl or
> control options would be good.
>
> On Wed, 1 Feb 2023, 14:51 Aleksandr Pakhomov, <ap...@gmail.com> wrote:
>
>> Hi,
>>
>> Do you have a chance to use a java client?
>>
>> https://ignite.apache.org/docs/latest/thin-clients/java-thin-client
>>
>> It seems this could help
>> igniteClient.cluster().forServers().nodes().count();
>>
>> Best regards,
>> Aleksandr
>>
>> On 1 Feb 2023, at 10:21, Surinder Mehra <re...@gmail.com> wrote:
>>
>> Hi,
>> I am trying to find a way to fetch the count of server nodes in ignite
>> cluster but don't see any control script option or in Rest api. Could you
>> please suggest if it is possible. Below link shows this is exposed as a
>> cluster metric but not accessible through above two options.
>>
>>
>> https://ignite.apache.org/docs/latest/monitoring-metrics/new-metrics#cluster
>>
>> Related stackoverflow post:
>>
>> https://stackoverflow.com/questions/75301565/ignite-cluster-size-using-control-script/
>>
>> Regards,
>> Surinder
>>
>>
>>
>
>
>

Re: Get TotalServerNodes using controlscript/Rest Api

Posted by Stephen Darlington <st...@gridgain.com>.
Cool. You learn something new every day!

> On 1 Feb 2023, at 10:55, Николай Ижиков <ni...@apache.org> wrote:
> 
> Hello.
> 
> You can query any metric value or system view content via control script [1], [2]
> 
> > control.sh --system-view nodes
> 
> or [3]
> 
> > control.sh —metric cluster.TotalBaselineNodes
> > control.sh —metric cluster.TotalServerNodes
> > control.sh —metric cluster.TotalClientNodes
> 
> [1] https://ignite.apache.org/docs/latest/tools/control-script#metric-command
> [2] https://ignite.apache.org/docs/latest/tools/control-script#system-view-command
> [3] https://ignite.apache.org/docs/2.11.1/monitoring-metrics/new-metrics#cluster
> 
> 
>> 1 февр. 2023 г., в 13:28, Stephen Darlington <st...@gridgain.com> написал(а):
>> 
>> I’m not aware of any single command to do it, but there are a few options. I’ll list a few as they’re all imperfect.
>> 
>> There are some command-line JMX reader commands you could use to extract the information from Ignite’s metrics.
>> 
>> You could extract the information from the REST API. I needed to use the jq command to parse it into just a count:
>> 
>> http 'http://localhost:8080/ignite?cmd=top' | jq '[ .response[] ] | length' 
>> 
>> You could search the logs for “Topology snapshot” lines.
>> 
>> There’s also ignitevisorcmd that you can script.
>> 
>> Regards,
>> Stephen
>> 
>>> On 1 Feb 2023, at 09:32, Surinder Mehra <re...@gmail.com> wrote:
>>> 
>>> Thanks, I am aware of it. But I needed this in a script. So either curl or control options would be good.
>>> 
>>> On Wed, 1 Feb 2023, 14:51 Aleksandr Pakhomov, <apkhmv@gmail.com <ma...@gmail.com>> wrote:
>>>> Hi, 
>>>> 
>>>> Do you have a chance to use a java client? 
>>>> 
>>>> https://ignite.apache.org/docs/latest/thin-clients/java-thin-client
>>>> 
>>>> It seems this could help igniteClient.cluster().forServers().nodes().count(); 
>>>> 
>>>> Best regards, 
>>>> Aleksandr
>>>> 
>>>>> On 1 Feb 2023, at 10:21, Surinder Mehra <rednirus@gmail.com <ma...@gmail.com>> wrote:
>>>>> 
>>>>> Hi,
>>>>> I am trying to find a way to fetch the count of server nodes in ignite cluster but don't see any control script option or in Rest api. Could you please suggest if it is possible. Below link shows this is exposed as a cluster metric but not accessible through above two options.
>>>>> 
>>>>> https://ignite.apache.org/docs/latest/monitoring-metrics/new-metrics#cluster
>>>>>  
>>>>> Related stackoverflow post:  
>>>>> https://stackoverflow.com/questions/75301565/ignite-cluster-size-using-control-script/
>>>>> 
>>>>> Regards,
>>>>> Surinder
>>>> 
>> 
> 


Re: Get TotalServerNodes using controlscript/Rest Api

Posted by Николай Ижиков <ni...@apache.org>.
Hello.

You can query any metric value or system view content via control script [1], [2]

> control.sh --system-view nodes

or [3]

> control.sh —metric cluster.TotalBaselineNodes
> control.sh —metric cluster.TotalServerNodes
> control.sh —metric cluster.TotalClientNodes

[1] https://ignite.apache.org/docs/latest/tools/control-script#metric-command
[2] https://ignite.apache.org/docs/latest/tools/control-script#system-view-command
[3] https://ignite.apache.org/docs/2.11.1/monitoring-metrics/new-metrics#cluster


> 1 февр. 2023 г., в 13:28, Stephen Darlington <st...@gridgain.com> написал(а):
> 
> I’m not aware of any single command to do it, but there are a few options. I’ll list a few as they’re all imperfect.
> 
> There are some command-line JMX reader commands you could use to extract the information from Ignite’s metrics.
> 
> You could extract the information from the REST API. I needed to use the jq command to parse it into just a count:
> 
> http 'http://localhost:8080/ignite?cmd=top' | jq '[ .response[] ] | length' 
> 
> You could search the logs for “Topology snapshot” lines.
> 
> There’s also ignitevisorcmd that you can script.
> 
> Regards,
> Stephen
> 
>> On 1 Feb 2023, at 09:32, Surinder Mehra <re...@gmail.com> wrote:
>> 
>> Thanks, I am aware of it. But I needed this in a script. So either curl or control options would be good.
>> 
>> On Wed, 1 Feb 2023, 14:51 Aleksandr Pakhomov, <apkhmv@gmail.com <ma...@gmail.com>> wrote:
>>> Hi, 
>>> 
>>> Do you have a chance to use a java client? 
>>> 
>>> https://ignite.apache.org/docs/latest/thin-clients/java-thin-client
>>> 
>>> It seems this could help igniteClient.cluster().forServers().nodes().count(); 
>>> 
>>> Best regards, 
>>> Aleksandr
>>> 
>>>> On 1 Feb 2023, at 10:21, Surinder Mehra <rednirus@gmail.com <ma...@gmail.com>> wrote:
>>>> 
>>>> Hi,
>>>> I am trying to find a way to fetch the count of server nodes in ignite cluster but don't see any control script option or in Rest api. Could you please suggest if it is possible. Below link shows this is exposed as a cluster metric but not accessible through above two options.
>>>> 
>>>> https://ignite.apache.org/docs/latest/monitoring-metrics/new-metrics#cluster
>>>>  
>>>> Related stackoverflow post:  
>>>> https://stackoverflow.com/questions/75301565/ignite-cluster-size-using-control-script/
>>>> 
>>>> Regards,
>>>> Surinder
>>> 
> 


Re: Get TotalServerNodes using controlscript/Rest Api

Posted by Stephen Darlington <st...@gridgain.com>.
I’m not aware of any single command to do it, but there are a few options. I’ll list a few as they’re all imperfect.

There are some command-line JMX reader commands you could use to extract the information from Ignite’s metrics.

You could extract the information from the REST API. I needed to use the jq command to parse it into just a count:

http 'http://localhost:8080/ignite?cmd=top' | jq '[ .response[] ] | length' 

You could search the logs for “Topology snapshot” lines.

There’s also ignitevisorcmd that you can script.

Regards,
Stephen

> On 1 Feb 2023, at 09:32, Surinder Mehra <re...@gmail.com> wrote:
> 
> Thanks, I am aware of it. But I needed this in a script. So either curl or control options would be good.
> 
> On Wed, 1 Feb 2023, 14:51 Aleksandr Pakhomov, <apkhmv@gmail.com <ma...@gmail.com>> wrote:
>> Hi, 
>> 
>> Do you have a chance to use a java client? 
>> 
>> https://ignite.apache.org/docs/latest/thin-clients/java-thin-client
>> 
>> It seems this could help igniteClient.cluster().forServers().nodes().count(); 
>> 
>> Best regards, 
>> Aleksandr
>> 
>>> On 1 Feb 2023, at 10:21, Surinder Mehra <rednirus@gmail.com <ma...@gmail.com>> wrote:
>>> 
>>> Hi,
>>> I am trying to find a way to fetch the count of server nodes in ignite cluster but don't see any control script option or in Rest api. Could you please suggest if it is possible. Below link shows this is exposed as a cluster metric but not accessible through above two options.
>>> 
>>> https://ignite.apache.org/docs/latest/monitoring-metrics/new-metrics#cluster
>>>  
>>> Related stackoverflow post:  
>>> https://stackoverflow.com/questions/75301565/ignite-cluster-size-using-control-script/
>>> 
>>> Regards,
>>> Surinder
>> 


Re: Get TotalServerNodes using controlscript/Rest Api

Posted by Surinder Mehra <re...@gmail.com>.
Thanks, I am aware of it. But I needed this in a script. So either curl or
control options would be good.

On Wed, 1 Feb 2023, 14:51 Aleksandr Pakhomov, <ap...@gmail.com> wrote:

> Hi,
>
> Do you have a chance to use a java client?
>
> https://ignite.apache.org/docs/latest/thin-clients/java-thin-client
>
> It seems this could help
> igniteClient.cluster().forServers().nodes().count();
>
> Best regards,
> Aleksandr
>
> On 1 Feb 2023, at 10:21, Surinder Mehra <re...@gmail.com> wrote:
>
> Hi,
> I am trying to find a way to fetch the count of server nodes in ignite
> cluster but don't see any control script option or in Rest api. Could you
> please suggest if it is possible. Below link shows this is exposed as a
> cluster metric but not accessible through above two options.
>
>
> https://ignite.apache.org/docs/latest/monitoring-metrics/new-metrics#cluster
>
> Related stackoverflow post:
>
> https://stackoverflow.com/questions/75301565/ignite-cluster-size-using-control-script/
>
> Regards,
> Surinder
>
>
>

Re: Get TotalServerNodes using controlscript/Rest Api

Posted by Aleksandr Pakhomov <ap...@gmail.com>.
Hi, 

Do you have a chance to use a java client? 

https://ignite.apache.org/docs/latest/thin-clients/java-thin-client <https://ignite.apache.org/docs/latest/thin-clients/java-thin-client>

It seems this could help igniteClient.cluster().forServers().nodes().count(); 

Best regards, 
Aleksandr

> On 1 Feb 2023, at 10:21, Surinder Mehra <re...@gmail.com> wrote:
> 
> Hi,
> I am trying to find a way to fetch the count of server nodes in ignite cluster but don't see any control script option or in Rest api. Could you please suggest if it is possible. Below link shows this is exposed as a cluster metric but not accessible through above two options.
> 
> https://ignite.apache.org/docs/latest/monitoring-metrics/new-metrics#cluster <https://ignite.apache.org/docs/latest/monitoring-metrics/new-metrics#cluster>
>  
> Related stackoverflow post:  
> https://stackoverflow.com/questions/75301565/ignite-cluster-size-using-control-script/ <https://stackoverflow.com/questions/75301565/ignite-cluster-size-using-control-script/>
> 
> Regards,
> Surinder