Discussion:
[Check_mk (english)] Custom check, perfdata formatting
Mäkelä, Antti
2018-11-06 13:54:13 UTC
Permalink
Hi,

I'm writing a custom check that returns perfdata for several variables.

What is the correct method for arranging the perfdata to different graphs? Where is that arrangement configured?

As an example, the interface checks return four graphs.

Bandwidth: Contains input and output bandwidth (2 variables, 1 graph)
Packets: Contains input and output packets, separated into unicast and non-unicast. (4 vars)
Errors: Contains input and output Discards and errors. (4 vars)
Length of output queue (1 var).

In actual check code, the perfdata seems to be just a list of tuples, essentially "perfdata = [ (Name,Result,Warn,Crit,Min, Max), (...), (...), ... ]"

I tried looking at pnp templates and the web metrics plugins (Using CEE), but couldn't really figure it out. Can someone point to the place to look at?

Thanks.

- Antti
Dollemore, Mark (London)
2018-11-06 14:10:06 UTC
Permalink
Hi Antti,

If you are using CEE, then the graphs are configured in the default file ~/share/check_mk/web/plugins/metrics/check_mk.py.

Using the above file as a working example, you can create a custom graphing file for your custom check in ~/local/share/check_mk/web/plugins/metrics/ which will be loaded along with the default file. Unfortunately there is little documentation on this, you just have to use the default file to work out how to get the desired results.

Regards

Mark

-----Original Message-----
From: checkmk-en [mailto:checkmk-en-***@lists.mathias-kettner.de] On Behalf Of MÀkelÀ, Antti
Sent: 06 November 2018 13:54
To: checkmk-***@lists.mathias-kettner.de
Subject: [Check_mk (english)] Custom check, perfdata formatting

Hi,

I'm writing a custom check that returns perfdata for several variables.

What is the correct method for arranging the perfdata to different graphs? Where is that arrangement configured?

As an example, the interface checks return four graphs.

Bandwidth: Contains input and output bandwidth (2 variables, 1 graph)
Packets: Contains input and output packets, separated into unicast and non-unicast. (4 vars)
Errors: Contains input and output Discards and errors. (4 vars)
Length of output queue (1 var).

In actual check code, the perfdata seems to be just a list of tuples, essentially "perfdata = [ (Name,Result,Warn,Crit,Min, Max), (...), (...), ... ]"

I tried looking at pnp templates and the web metrics plugins (Using CEE), but couldn't really figure it out. Can someone point to the place to look at?

Thanks.

- Antti



_______________________________________________
checkmk-en mailing list
checkmk-***@lists.mathias-kettner.de
Manage your subscription or unsubscribe
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

This email has been sent by a member of the Man group (“Man”). Man’s parent company, Man Group plc, is registered in England and Wales (company number 08172396) at Riverbank House, 2 Swan Lane, London, EC4R 3AD.
The contents of this email are for the named addressee(s) only. It contains information which may be confidential and privileged. If you are not the intended recipient, please notify the sender immediately, destroy this email and any attachments and do not otherwise disclose or use them. Email transmission is not a secure method of communication and Man cannot accept responsibility for the completeness or accuracy of this email or any attachments. Whilst Man makes every effort to keep its network free from viruses, it does not accept responsibility for any computer virus which might be transferred by way of this email or any attachments. This email does not constitute a request, offer, recommendation or solicitation of any kind to buy, subscribe, sell or redeem any investment instruments or to perform other such transactions of any kind. Man reserves the right to monitor, record and retain all electronic and telephone communications through its network in accordance with applicable laws and regulations.

During the course of our business relationship with you, we may process your personal data, including through the monitoring of electronic communications. We will only process your personal data to the extent permitted by laws and regulations; for the purposes of ensuring compliance with our legal and regulatory obligations and internal policies; and for managing client relationships. For further information please see our Privacy Notice: https://www.man.com/privacy-policy
Dollemore, Mark (London)
2018-11-06 14:14:26 UTC
Permalink
Oh yeah, forgot to mention when specifying "graph_info" sections in your custom file, use "graph_info.append"

-----Original Message-----
From: Dollemore, Mark (London)
Sent: 06 November 2018 14:10
To: 'MÀkelÀ, Antti'; checkmk-***@lists.mathias-kettner.de
Subject: RE: Custom check, perfdata formatting

Hi Antti,

If you are using CEE, then the graphs are configured in the default file ~/share/check_mk/web/plugins/metrics/check_mk.py.

Using the above file as a working example, you can create a custom graphing file for your custom check in ~/local/share/check_mk/web/plugins/metrics/ which will be loaded along with the default file. Unfortunately there is little documentation on this, you just have to use the default file to work out how to get the desired results.

Regards

Mark

-----Original Message-----
From: checkmk-en [mailto:checkmk-en-***@lists.mathias-kettner.de] On Behalf Of MÀkelÀ, Antti
Sent: 06 November 2018 13:54
To: checkmk-***@lists.mathias-kettner.de
Subject: [Check_mk (english)] Custom check, perfdata formatting

Hi,

I'm writing a custom check that returns perfdata for several variables.

What is the correct method for arranging the perfdata to different graphs? Where is that arrangement configured?

As an example, the interface checks return four graphs.

Bandwidth: Contains input and output bandwidth (2 variables, 1 graph)
Packets: Contains input and output packets, separated into unicast and non-unicast. (4 vars)
Errors: Contains input and output Discards and errors. (4 vars)
Length of output queue (1 var).

In actual check code, the perfdata seems to be just a list of tuples, essentially "perfdata = [ (Name,Result,Warn,Crit,Min, Max), (...), (...), ... ]"

I tried looking at pnp templates and the web metrics plugins (Using CEE), but couldn't really figure it out. Can someone point to the place to look at?

Thanks.

- Antti



_______________________________________________
checkmk-en mailing list
checkmk-***@lists.mathias-kettner.de
Manage your subscription or unsubscribe
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

This email has been sent by a member of the Man group (“Man”). Man’s parent company, Man Group plc, is registered in England and Wales (company number 08172396) at Riverbank House, 2 Swan Lane, London, EC4R 3AD.
The contents of this email are for the named addressee(s) only. It contains information which may be confidential and privileged. If you are not the intended recipient, please notify the sender immediately, destroy this email and any attachments and do not otherwise disclose or use them. Email transmission is not a secure method of communication and Man cannot accept responsibility for the completeness or accuracy of this email or any attachments. Whilst Man makes every effort to keep its network free from viruses, it does not accept responsibility for any computer virus which might be transferred by way of this email or any attachments. This email does not constitute a request, offer, recommendation or solicitation of any kind to buy, subscribe, sell or redeem any investment instruments or to perform other such transactions of any kind. Man reserves the right to monitor, record and retain all electronic and telephone communications through its network in accordance with applicable laws and regulations.

During the course of our business relationship with you, we may process your personal data, including through the monitoring of electronic communications. We will only process your personal data to the extent permitted by laws and regulations; for the purposes of ensuring compliance with our legal and regulatory obligations and internal policies; and for managing client relationships. For further information please see our Privacy Notice: https://www.man.com/privacy-policy
Mäkelä, Antti
2018-11-06 16:17:28 UTC
Permalink
That's the thing- I tried to understand what's happening in metrics/check_mk.py, using a simpler check (df, filesystem free space) but I really couldn't see how the file maps df_used, df_free and others to the same graph. I was hoping someone could explain the logic...

- Antti

________________________________________
From: Dollemore, Mark (London) <***@man.com>
Sent: Tuesday, November 6, 2018 16:14
To: Mäkelä, Antti; checkmk-***@lists.mathias-kettner.de
Subject: RE: Custom check, perfdata formatting

Oh yeah, forgot to mention when specifying "graph_info" sections in your custom file, use "graph_info.append"

-----Original Message-----
From: Dollemore, Mark (London)
Sent: 06 November 2018 14:10
To: 'Mäkelä, Antti'; checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: RE: Custom check, perfdata formatting

Hi Antti,

If you are using CEE, then the graphs are configured in the default file ~/share/check_mk/web/plugins/metrics/check_mk.py.

Using the above file as a working example, you can create a custom graphing file for your custom check in ~/local/share/check_mk/web/plugins/metrics/ which will be loaded along with the default file. Unfortunately there is little documentation on this, you just have to use the default file to work out how to get the desired results.

Regards

Mark

-----Original Message-----
From: checkmk-en [mailto:checkmk-en-***@lists.mathias-kettner.de] On Behalf Of Mäkelä, Antti
Sent: 06 November 2018 13:54
To: checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: [Check_mk (english)] Custom check, perfdata formatting

Hi,

I'm writing a custom check that returns perfdata for several variables.

What is the correct method for arranging the perfdata to different graphs? Where is that arrangement configured?

As an example, the interface checks return four graphs.

Bandwidth: Contains input and output bandwidth (2 variables, 1 graph)
Packets: Contains input and output packets, separated into unicast and non-unicast. (4 vars)
Errors: Contains input and output Discards and errors. (4 vars)
Length of output queue (1 var).

In actual check code, the perfdata seems to be just a list of tuples, essentially "perfdata = [ (Name,Result,Warn,Crit,Min, Max), (...), (...), ... ]"

I tried looking at pnp templates and the web metrics plugins (Using CEE), but couldn't really figure it out. Can someone point to the place to look at?

Thanks.

- Antti



_______________________________________________
checkmk-en mailing list
checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Manage your subscription or unsubscribe
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en



This email has been sent by a member of the Man group (“Man”). Man’s parent company, Man Group plc, is registered in England and Wales (company number 08172396) at Riverbank House, 2 Swan Lane, London, EC4R 3AD. The contents of this email are for the named addressee(s) only. It contains information which may be confidential and privileged. If you are not the intended recipient, please notify the sender immediately, destroy this email and any attachments and do not otherwise disclose or use them. Email transmission is not a secure method of communication and Man cannot accept responsibility for the completeness or accuracy of this email or any attachments. Whilst Man makes every effort to keep its network free from viruses, it does not accept responsibility for any computer virus which might be transferred by way of this email or any attachments. This email does not constitute a request, offer, recommendation or solicitation of any kind to buy, subscribe, sell or redeem any investment instruments or to perform other such transactions of any kind. Man reserves the right to monitor, record and retain all electronic and telephone communications through its network in accordance with applicable laws and regulations.

During the course of our business relationship with you, we may process your personal data, including through the monitoring of electronic communications. We will only process your personal data to the extent permitted by laws and regulations; for the purposes of ensuring compliance with our legal and regulatory obligations and internal policies; and for managing client relationships. For further information please see our Privacy Notice: https://www.man.com/privacy-policy
Dollemore, Mark (London)
2018-11-06 16:40:06 UTC
Permalink
Hi Antti,

Each perfdata metric output by your custom check needs a metric_info section, this will describe the unit of measurement, the color and the title.

Then for each graph you wish to produce you need a graph_info.append section, this will define which metrics to graph and how the graph should be displayed (ie area, stack), you can also supply optional scalers if you want to see your thresholds displayed on the graph.

Example (takes perf metrics MSMQ_Incoming_Messages and MSMQ_Outgoing_Messages and displays them as a stack in a single graph.


metric_info["MSMQ_Incoming_Messages"] = {
"title" : _("MSMQ Incoming Messages"),
"unit" : "count",
"color" : "32/a",
}

metric_info["MSMQ_Outgoing_Messages"] = {
"title" : _("MSMQ Outgoing Messages"),
"unit" : "count",
"color" : "42/a",
}


graph_info.append({
"title" : _("MSMQ Messages Count"),
"metrics" : [
( "MSMQ_Incoming_Messages", "stack" ),
( "MSMQ_Outgoing_Messages", "stack" ),
],
})


Mark

-----Original Message-----
From: Mäkelä, Antti [mailto:***@vintor.fi]
Sent: 06 November 2018 16:17
To: Dollemore, Mark (London); checkmk-***@lists.mathias-kettner.de
Subject: Re: Custom check, perfdata formatting

That's the thing- I tried to understand what's happening in metrics/check_mk.py, using a simpler check (df, filesystem free space) but I really couldn't see how the file maps df_used, df_free and others to the same graph. I was hoping someone could explain the logic...

- Antti

________________________________________
From: Dollemore, Mark (London) <***@man.com>
Sent: Tuesday, November 6, 2018 16:14
To: Mäkelä, Antti; checkmk-***@lists.mathias-kettner.de
Subject: RE: Custom check, perfdata formatting

Oh yeah, forgot to mention when specifying "graph_info" sections in your custom file, use "graph_info.append"

-----Original Message-----
From: Dollemore, Mark (London)
Sent: 06 November 2018 14:10
To: 'Mäkelä, Antti'; checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: RE: Custom check, perfdata formatting

Hi Antti,

If you are using CEE, then the graphs are configured in the default file ~/share/check_mk/web/plugins/metrics/check_mk.py.

Using the above file as a working example, you can create a custom graphing file for your custom check in ~/local/share/check_mk/web/plugins/metrics/ which will be loaded along with the default file. Unfortunately there is little documentation on this, you just have to use the default file to work out how to get the desired results.

Regards

Mark

-----Original Message-----
From: checkmk-en [mailto:checkmk-en-***@lists.mathias-kettner.de] On Behalf Of Mäkelä, Antti
Sent: 06 November 2018 13:54
To: checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: [Check_mk (english)] Custom check, perfdata formatting

Hi,

I'm writing a custom check that returns perfdata for several variables.

What is the correct method for arranging the perfdata to different graphs? Where is that arrangement configured?

As an example, the interface checks return four graphs.

Bandwidth: Contains input and output bandwidth (2 variables, 1 graph)
Packets: Contains input and output packets, separated into unicast and non-unicast. (4 vars)
Errors: Contains input and output Discards and errors. (4 vars)
Length of output queue (1 var).

In actual check code, the perfdata seems to be just a list of tuples, essentially "perfdata = [ (Name,Result,Warn,Crit,Min, Max), (...), (...), ... ]"

I tried looking at pnp templates and the web metrics plugins (Using CEE), but couldn't really figure it out. Can someone point to the place to look at?

Thanks.

- Antti



_______________________________________________
checkmk-en mailing list
checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Manage your subscription or unsubscribe
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en



This email has been sent by a member of the Man group ("Man"). Man's parent company, Man Group plc, is registered in England and Wales (company number 08172396) at Riverbank House, 2 Swan Lane, London, EC4R 3AD. The contents of this email are for the named addressee(s) only. It contains information which may be confidential and privileged. If you are not the intended recipient, please notify the sender immediately, destroy this email and any attachments and do not otherwise disclose or use them. Email transmission is not a secure method of communication and Man cannot accept responsibility for the completeness or accuracy of this email or any attachments. Whilst Man makes every effort to keep its network free from viruses, it does not accept responsibility for any computer virus which might be transferred by way of this email or any attachments. This email does not constitute a request, offer, recommendation or solicitation of any kind to buy, subscribe, sell or redeem any investment instruments or to perform other such transactions of any kind. Man reserves the right to monitor, record and retain all electronic and telephone communications through its network in accordance with applicable laws and regulations.

During the course of our business relationship with you, we may process your personal data, including through the monitoring of electronic communications. We will only process your personal data to the extent permitted by laws and regulations; for the purposes of ensuring compliance with our legal and regulatory obligations and internal policies; and for managing client relationships. For further information please see our Privacy Notice: https://www.man.com/privacy-policy
Mäkelä, Antti
2018-11-06 17:21:56 UTC
Permalink
Ah, that's the ticket. So we have graph_info objects referencing metric_info objects, which in turn refer to perfdata names.

Thanks, will try this tomorrow.

- Antti

________________________________________
From: Dollemore, Mark (London) <***@man.com>
Sent: Tuesday, November 6, 2018 18:40
To: Mäkelä, Antti; checkmk-***@lists.mathias-kettner.de
Subject: RE: Custom check, perfdata formatting

Hi Antti,

Each perfdata metric output by your custom check needs a metric_info section, this will describe the unit of measurement, the color and the title.

Then for each graph you wish to produce you need a graph_info.append section, this will define which metrics to graph and how the graph should be displayed (ie area, stack), you can also supply optional scalers if you want to see your thresholds displayed on the graph.

Example (takes perf metrics MSMQ_Incoming_Messages and MSMQ_Outgoing_Messages and displays them as a stack in a single graph.


metric_info["MSMQ_Incoming_Messages"] = {
"title" : _("MSMQ Incoming Messages"),
"unit" : "count",
"color" : "32/a",
}

metric_info["MSMQ_Outgoing_Messages"] = {
"title" : _("MSMQ Outgoing Messages"),
"unit" : "count",
"color" : "42/a",
}


graph_info.append({
"title" : _("MSMQ Messages Count"),
"metrics" : [
( "MSMQ_Incoming_Messages", "stack" ),
( "MSMQ_Outgoing_Messages", "stack" ),
],
})


Mark

-----Original Message-----
From: Mäkelä, Antti [mailto:***@vintor.fi]
Sent: 06 November 2018 16:17
To: Dollemore, Mark (London); checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: Re: Custom check, perfdata formatting

That's the thing- I tried to understand what's happening in metrics/check_mk.py, using a simpler check (df, filesystem free space) but I really couldn't see how the file maps df_used, df_free and others to the same graph. I was hoping someone could explain the logic...

- Antti

________________________________________
From: Dollemore, Mark (London) <***@man.com>
Sent: Tuesday, November 6, 2018 16:14
To: Mäkelä, Antti; checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: RE: Custom check, perfdata formatting

Oh yeah, forgot to mention when specifying "graph_info" sections in your custom file, use "graph_info.append"

-----Original Message-----
From: Dollemore, Mark (London)
Sent: 06 November 2018 14:10
To: 'Mäkelä, Antti'; checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: RE: Custom check, perfdata formatting

Hi Antti,

If you are using CEE, then the graphs are configured in the default file ~/share/check_mk/web/plugins/metrics/check_mk.py.

Using the above file as a working example, you can create a custom graphing file for your custom check in ~/local/share/check_mk/web/plugins/metrics/ which will be loaded along with the default file. Unfortunately there is little documentation on this, you just have to use the default file to work out how to get the desired results.

Regards

Mark

-----Original Message-----
From: checkmk-en [mailto:checkmk-en-***@lists.mathias-kettner.de] On Behalf Of Mäkelä, Antti
Sent: 06 November 2018 13:54
To: checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: [Check_mk (english)] Custom check, perfdata formatting

Hi,

I'm writing a custom check that returns perfdata for several variables.

What is the correct method for arranging the perfdata to different graphs? Where is that arrangement configured?

As an example, the interface checks return four graphs.

Bandwidth: Contains input and output bandwidth (2 variables, 1 graph)
Packets: Contains input and output packets, separated into unicast and non-unicast. (4 vars)
Errors: Contains input and output Discards and errors. (4 vars)
Length of output queue (1 var).

In actual check code, the perfdata seems to be just a list of tuples, essentially "perfdata = [ (Name,Result,Warn,Crit,Min, Max), (...), (...), ... ]"

I tried looking at pnp templates and the web metrics plugins (Using CEE), but couldn't really figure it out. Can someone point to the place to look at?

Thanks.

- Antti



_______________________________________________
checkmk-en mailing list
checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Manage your subscription or unsubscribe
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en



This email has been sent by a member of the Man group ("Man"). Man's parent company, Man Group plc, is registered in England and Wales (company number 08172396) at Riverbank House, 2 Swan Lane, London, EC4R 3AD. The contents of this email are for the named addressee(s) only. It contains information which may be confidential and privileged. If you are not the intended recipient, please notify the sender immediately, destroy this email and any attachments and do not otherwise disclose or use them. Email transmission is not a secure method of communication and Man cannot accept responsibility for the completeness or accuracy of this email or any attachments. Whilst Man makes every effort to keep its network free from viruses, it does not accept responsibility for any computer virus which might be transferred by way of this email or any attachments. This email does not constitute a request, offer, recommendation or solicitation of any kind to buy, subscribe, sell or redeem any investment instruments or to perform other such transactions of any kind. Man reserves the right to monitor, record and retain all electronic and telephone communications through its network in accordance with applicable laws and regulations.

During the course of our business relationship with you, we may process your personal data, including through the monitoring of electronic communications. We will only process your personal data to the extent permitted by laws and regulations; for the purposes of ensuring compliance with our legal and regulatory obligations and internal policies; and for managing client relationships. For further information please see our Privacy Notice: https://www.man.com/privacy-policy
Mäkelä, Antti
2018-11-07 10:17:10 UTC
Permalink
Got this working - except I'm getting my "consolidated" graph that has multiple performance metrics drawn as lines, in *addition* to some, but not all, of the original graphs.

Is seems that If I define

graph_info["check_mk-custom_check_test"] = {
"title" : _("Test %"),
"metrics" : [
( "Testunit1.1", "line" ),
( "Testunit2.3", "line" ),
],
}

And I have

metric_info["Testunit1.1"]= {
"title" : _("Test 1.1, percent"),
"unit" : "%",
"color" : "14/a",
}

metric_info["Testunit2.3"] = {
"title" : _("Test 2.3, percent"),
"unit" : "%",
"color" : "14/a",
}


I get the two above to a single graph, but I also get "Test 1" as an unformatted graph on it's own.

Another thing is that the above are percentage units, I'd like the Y-axis of the graph to be from 0 to 100.

RRDs are being recorded for all metrics.

(Note: No need to use "append" - the objects are dicts).

- Antti


-----Original Message-----
From: checkmk-en <checkmk-en-***@lists.mathias-kettner.de> On Behalf Of Mäkelä, Antti
Sent: tiistai 6. marraskuuta 2018 19.22
To: Dollemore, Mark (London) <***@man.com>; checkmk-***@lists.mathias-kettner.de
Subject: Re: [Check_mk (english)] Custom check, perfdata formatting

Ah, that's the ticket. So we have graph_info objects referencing metric_info objects, which in turn refer to perfdata names.

Thanks, will try this tomorrow.

- Antti

________________________________________
From: Dollemore, Mark (London) <***@man.com>
Sent: Tuesday, November 6, 2018 18:40
To: Mäkelä, Antti; checkmk-***@lists.mathias-kettner.de
Subject: RE: Custom check, perfdata formatting

Hi Antti,

Each perfdata metric output by your custom check needs a metric_info section, this will describe the unit of measurement, the color and the title.

Then for each graph you wish to produce you need a graph_info.append section, this will define which metrics to graph and how the graph should be displayed (ie area, stack), you can also supply optional scalers if you want to see your thresholds displayed on the graph.

Example (takes perf metrics MSMQ_Incoming_Messages and MSMQ_Outgoing_Messages and displays them as a stack in a single graph.


metric_info["MSMQ_Incoming_Messages"] = { "title" : _("MSMQ Incoming Messages"), "unit" : "count", "color" : "32/a", }

metric_info["MSMQ_Outgoing_Messages"] = { "title" : _("MSMQ Outgoing Messages"), "unit" : "count", "color" : "42/a", }


graph_info.append({
"title" : _("MSMQ Messages Count"),
"metrics" : [
( "MSMQ_Incoming_Messages", "stack" ),
( "MSMQ_Outgoing_Messages", "stack" ),
],
})


Mark

-----Original Message-----
From: Mäkelä, Antti [mailto:***@vintor.fi]
Sent: 06 November 2018 16:17
To: Dollemore, Mark (London); checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: Re: Custom check, perfdata formatting

That's the thing- I tried to understand what's happening in metrics/check_mk.py, using a simpler check (df, filesystem free space) but I really couldn't see how the file maps df_used, df_free and others to the same graph. I was hoping someone could explain the logic...

- Antti

________________________________________
From: Dollemore, Mark (London) <***@man.com>
Sent: Tuesday, November 6, 2018 16:14
To: Mäkelä, Antti; checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: RE: Custom check, perfdata formatting

Oh yeah, forgot to mention when specifying "graph_info" sections in your custom file, use "graph_info.append"

-----Original Message-----
From: Dollemore, Mark (London)
Sent: 06 November 2018 14:10
To: 'Mäkelä, Antti'; checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: RE: Custom check, perfdata formatting

Hi Antti,

If you are using CEE, then the graphs are configured in the default file ~/share/check_mk/web/plugins/metrics/check_mk.py.

Using the above file as a working example, you can create a custom graphing file for your custom check in ~/local/share/check_mk/web/plugins/metrics/ which will be loaded along with the default file. Unfortunately there is little documentation on this, you just have to use the default file to work out how to get the desired results.

Regards

Mark

-----Original Message-----
From: checkmk-en [mailto:checkmk-en-***@lists.mathias-kettner.de] On Behalf Of Mäkelä, Antti
Sent: 06 November 2018 13:54
To: checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: [Check_mk (english)] Custom check, perfdata formatting

Hi,

I'm writing a custom check that returns perfdata for several variables.

What is the correct method for arranging the perfdata to different graphs? Where is that arrangement configured?

As an example, the interface checks return four graphs.

Bandwidth: Contains input and output bandwidth (2 variables, 1 graph)
Packets: Contains input and output packets, separated into unicast and non-unicast. (4 vars)
Errors: Contains input and output Discards and errors. (4 vars) Length of output queue (1 var).

In actual check code, the perfdata seems to be just a list of tuples, essentially "perfdata = [ (Name,Result,Warn,Crit,Min, Max), (...), (...), ... ]"

I tried looking at pnp templates and the web metrics plugins (Using CEE), but couldn't really figure it out. Can someone point to the place to look at?

Thanks.

- Antti



_______________________________________________
checkmk-en mailing list
checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Manage your subscription or unsubscribe
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en



This email has been sent by a member of the Man group ("Man"). Man's parent company, Man Group plc, is registered in England and Wales (company number 08172396) at Riverbank House, 2 Swan Lane, London, EC4R 3AD. The contents of this email are for the named addressee(s) only. It contains information which may be confidential and privileged. If you are not the intended recipient, please notify the sender immediately, destroy this email and any attachments and do not otherwise disclose or use them. Email transmission is not a secure method of communication and Man cannot accept responsibility for the completeness or accuracy of this email or any attachments. Whilst Man makes every effort to keep its network free from viruses, it does not accept responsibility for any computer virus which might be transferred by way of this email or any attachments. This email does not constitute a request, offer, recommendation or solicitation of any kind to buy, subscribe, sell or redeem any investment instruments or to perform other such transactions of any kind. Man reserves the right to monitor, record and retain all electronic and telephone communications through its network in accordance with applicable laws and regulations.

During the course of our business relationship with you, we may process your personal data, including through the monitoring of electronic communications. We will only process your personal data to the extent permitted by laws and regulations; for the purposes of ensuring compliance with our legal and regulatory obligations and internal policies; and for managing client relationships. For further information please see our Privacy Notice: https://www.man.com/privacy-policy
Mäkelä, Antti
2018-11-07 10:19:11 UTC
Permalink
Ok, turns out I can't use points, commas or some other characters I guess in the definition names. Now it works ok.

Now just need to figure out scaling of the percentage axis.


-----Original Message-----
From: Mäkelä, Antti
Sent: keskiviikko 7. marraskuuta 2018 12.17
To: Dollemore, Mark (London) <***@man.com>; checkmk-***@lists.mathias-kettner.de
Subject: RE: Custom check, perfdata formatting

Got this working - except I'm getting my "consolidated" graph that has multiple performance metrics drawn as lines, in *addition* to some, but not all, of the original graphs.

Is seems that If I define

graph_info["check_mk-custom_check_test"] = {
"title" : _("Test %"),
"metrics" : [
( "Testunit1.1", "line" ),
( "Testunit2.3", "line" ),
],
}

And I have

metric_info["Testunit1.1"]= {
"title" : _("Test 1.1, percent"),
"unit" : "%",
"color" : "14/a",
}

metric_info["Testunit2.3"] = {
"title" : _("Test 2.3, percent"),
"unit" : "%",
"color" : "14/a",
}


I get the two above to a single graph, but I also get "Test 1" as an unformatted graph on it's own.

Another thing is that the above are percentage units, I'd like the Y-axis of the graph to be from 0 to 100.

RRDs are being recorded for all metrics.

(Note: No need to use "append" - the objects are dicts).

- Antti


-----Original Message-----
From: checkmk-en <checkmk-en-***@lists.mathias-kettner.de> On Behalf Of Mäkelä, Antti
Sent: tiistai 6. marraskuuta 2018 19.22
To: Dollemore, Mark (London) <***@man.com>; checkmk-***@lists.mathias-kettner.de
Subject: Re: [Check_mk (english)] Custom check, perfdata formatting

Ah, that's the ticket. So we have graph_info objects referencing metric_info objects, which in turn refer to perfdata names.

Thanks, will try this tomorrow.

- Antti

________________________________________
From: Dollemore, Mark (London) <***@man.com>
Sent: Tuesday, November 6, 2018 18:40
To: Mäkelä, Antti; checkmk-***@lists.mathias-kettner.de
Subject: RE: Custom check, perfdata formatting

Hi Antti,

Each perfdata metric output by your custom check needs a metric_info section, this will describe the unit of measurement, the color and the title.

Then for each graph you wish to produce you need a graph_info.append section, this will define which metrics to graph and how the graph should be displayed (ie area, stack), you can also supply optional scalers if you want to see your thresholds displayed on the graph.

Example (takes perf metrics MSMQ_Incoming_Messages and MSMQ_Outgoing_Messages and displays them as a stack in a single graph.


metric_info["MSMQ_Incoming_Messages"] = { "title" : _("MSMQ Incoming Messages"), "unit" : "count", "color" : "32/a", }

metric_info["MSMQ_Outgoing_Messages"] = { "title" : _("MSMQ Outgoing Messages"), "unit" : "count", "color" : "42/a", }


graph_info.append({
"title" : _("MSMQ Messages Count"),
"metrics" : [
( "MSMQ_Incoming_Messages", "stack" ),
( "MSMQ_Outgoing_Messages", "stack" ),
],
})


Mark

-----Original Message-----
From: Mäkelä, Antti [mailto:***@vintor.fi]
Sent: 06 November 2018 16:17
To: Dollemore, Mark (London); checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: Re: Custom check, perfdata formatting

That's the thing- I tried to understand what's happening in metrics/check_mk.py, using a simpler check (df, filesystem free space) but I really couldn't see how the file maps df_used, df_free and others to the same graph. I was hoping someone could explain the logic...

- Antti

________________________________________
From: Dollemore, Mark (London) <***@man.com>
Sent: Tuesday, November 6, 2018 16:14
To: Mäkelä, Antti; checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: RE: Custom check, perfdata formatting

Oh yeah, forgot to mention when specifying "graph_info" sections in your custom file, use "graph_info.append"

-----Original Message-----
From: Dollemore, Mark (London)
Sent: 06 November 2018 14:10
To: 'Mäkelä, Antti'; checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: RE: Custom check, perfdata formatting

Hi Antti,

If you are using CEE, then the graphs are configured in the default file ~/share/check_mk/web/plugins/metrics/check_mk.py.

Using the above file as a working example, you can create a custom graphing file for your custom check in ~/local/share/check_mk/web/plugins/metrics/ which will be loaded along with the default file. Unfortunately there is little documentation on this, you just have to use the default file to work out how to get the desired results.

Regards

Mark

-----Original Message-----
From: checkmk-en [mailto:checkmk-en-***@lists.mathias-kettner.de] On Behalf Of Mäkelä, Antti
Sent: 06 November 2018 13:54
To: checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Subject: [Check_mk (english)] Custom check, perfdata formatting

Hi,

I'm writing a custom check that returns perfdata for several variables.

What is the correct method for arranging the perfdata to different graphs? Where is that arrangement configured?

As an example, the interface checks return four graphs.

Bandwidth: Contains input and output bandwidth (2 variables, 1 graph)
Packets: Contains input and output packets, separated into unicast and non-unicast. (4 vars)
Errors: Contains input and output Discards and errors. (4 vars) Length of output queue (1 var).

In actual check code, the perfdata seems to be just a list of tuples, essentially "perfdata = [ (Name,Result,Warn,Crit,Min, Max), (...), (...), ... ]"

I tried looking at pnp templates and the web metrics plugins (Using CEE), but couldn't really figure it out. Can someone point to the place to look at?

Thanks.

- Antti



_______________________________________________
checkmk-en mailing list
checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Manage your subscription or unsubscribe
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en



This email has been sent by a member of the Man group ("Man"). Man's parent company, Man Group plc, is registered in England and Wales (company number 08172396) at Riverbank House, 2 Swan Lane, London, EC4R 3AD. The contents of this email are for the named addressee(s) only. It contains information which may be confidential and privileged. If you are not the intended recipient, please notify the sender immediately, destroy this email and any attachments and do not otherwise disclose or use them. Email transmission is not a secure method of communication and Man cannot accept responsibility for the completeness or accuracy of this email or any attachments. Whilst Man makes every effort to keep its network free from viruses, it does not accept responsibility for any computer virus which might be transferred by way of this email or any attachments. This email does not constitute a request, offer, recommendation or solicitation of any kind to buy, subscribe, sell or redeem any investment instruments or to perform other such transactions of any kind. Man reserves the right to monitor, record and retain all electronic and telephone communications through its network in accordance with applicable laws and regulations.

During the course of our business relationship with you, we may process your personal data, including through the monitoring of electronic communications. We will only process your personal data to the extent permitted by laws and regulations; for the purposes of ensuring compliance with our legal and regulatory obligations and internal policies; and for managing client relationships. For further information please see our Privacy Notice: https://www.man.com/privacy-policy
Loading...