Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regexp check to match '^$' #12

Open
seriv opened this issue Jun 5, 2012 · 0 comments
Open

Fix regexp check to match '^$' #12

seriv opened this issue Jun 5, 2012 · 0 comments

Comments

@seriv
Copy link

seriv commented Jun 5, 2012

I'd like to write check for nagios if a string result is empty, like

./check_resmon_metric -H myhost -M Core::SmfMaintenance -C services -m services -r '^$'

When curl shows this field is empty:

curl http://myhost:81/Core::SmfMaintenance/services
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/resmon.xsl"?><ResmonResults>
  <ResmonResult module="Core::SmfMaintenance" service="services">
    <last_runtime_seconds>0.089733</last_runtime_seconds>
    <last_update>1338893241</last_update>
    <metric name="count" type="i">0</metric>
    <metric name="services" type="s"></metric>
  </ResmonResult>
</ResmonResults>

the ./check_resmon_metric gives

./check_resmon_metric -H myhost -M Core::SmfMaintenance -C services -m services -r '^$'

Use of uninitialized value $value in pattern match (m//) at /etc/nagios3/CS.conf.d/check_resmon_metric line 378.
Use of uninitialized value $value in concatenation (.) or string at /etc/nagios3/CS.conf.d/check_resmon_metric line 383.
OK: resources -

and result in CRITICAL
I propose to avoid false critical status check if $value is not defined and if so define as empty string, seriv@cd3c2b0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant