Forum Discussion

Tom's avatar
7 years ago

Measure, Alert on Ulimit level

Greeting LM community,


Is it possible to alert on the Linux ulimit level?




2 Replies

Replies have been turned off for this discussion
  • Hi Tom, 

    You could create a script datasource to get the ulimit value, here is an example below.  You would need to create a datapoint in the datasource using a key value pair *Key set to "Ulimit".  You can set a threshold in the datapoint for alerting.  You will need to set "ssh.user" and "ssh.pass" properties on the device.

    The output from the script will look like this --> Ulimit:1024


    /* Ulimit script */

    import com.santaba.agent.groovyapi.expect.Expect

    def hostname = hostProps.get("system.hostname");
    def username = hostProps.get("ssh.user");
    def pass = hostProps.get("ssh.pass");

    // default timeout for Expect SSH
    def timeout = 15;

    // Command to get load average data
    def ulimit_cmd = "ulimit -n\n";

    // Expected shell prompt character, may have to be changed
    // Linux generally uses "#" for root shells
    def prompt = '\\$'

     * Ulimit Pattern Key
    ulimit_pattern = ~/^(\d+)$/

    // Connect to the device and wait for the prompt
    ssh_conn =, username, pass, timeout);

    // Send the ulimit command and wait for the prompt

    // Iterate over output
    { line ->
    //println line
        // Run the match
        matcher = ulimit_pattern.matcher(line);

        // Did we match?
        if (matcher.getCount() > 0)
            // Yes, print data
            println "ulimit:" + matcher[0][1];


    // Exit the shell!

    return 0;

  • Thanks for your time and effort on this :)/emoticons/smile@2x.png 2x" title=":)" width="20">