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

Livestatus "service_pnpgraph_present" Service Name Char Cleanup #16

Open
Frescha opened this issue Mar 15, 2014 · 1 comment
Open

Livestatus "service_pnpgraph_present" Service Name Char Cleanup #16

Frescha opened this issue Mar 15, 2014 · 1 comment

Comments

@Frescha
Copy link
Contributor

Frescha commented Mar 15, 2014

There should be a character cleanup for function "find_pnp_perfdata_xml" to avoid problems with service names like "fs_/" or "Interface 2" which are typical names in a check_mk environment.

Chars like "/" ":" "" SPACE must be replaced with "_"

Quick fix:
def find_pnp_perfdata_xml(name, request):
"""Check if a pnp xml file exists for a given host or service name."""

if request.pnp_path_readable:
    if '/' in name:
        # It is a service
        name = name.split('/',1)

        replace = { "/": "_", " ": "_", "\\": "_", ":": "_"}
        name[1] = "".join(replace.get(c, c) for c in name[1])

        #if os.access(request.pnp_path + '/' + name + '.xml', os.R_OK):
        if os.access(request.pnp_path + '/' + name[0] + '/' + name[1] + '.xml', os.R_OK):
            return 1
    else:
        # It is a host
        if os.access(request.pnp_path + '/' + name + '/_HOST_.xml', os.R_OK):
            return 1
# If in doubt, there is no pnp file
return 0
@Frescha
Copy link
Contributor Author

Frescha commented Mar 15, 2014

Issue shinken-solutions/shinken#726

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