Go (golang) plugin in Citellus

I wanted to practice a bit Go programing, so I divided that task in two parts, one, adding a golang extension for Citellus and a sample, but working plugin using it. If interested in the code it’s available at the review at https://review.gerrithub.io/c/citellusorg/citellus/+/495622. The final sample code for it has been: // Author: Pablo Iranzo Gómez ([email protected]) // Header for citellus metadata // long_name: Report detected number of CPU's // description: List the processors detected in the system // priority: 200 package main import ( "bufio" "io" "os" "runtime" "strconv" "strings" ) func main() { var OKAY, _ = strconv.Atoi(os.Getenv("RC_OKAY")) var SKIP, _ = strconv.Atoi(os.Getenv("RC_SKIPPED")) var INFO, _ = strconv.Atoi(os.Getenv("RC_INFO")) var CITELLUS_ROOT = os.Getenv("CITELLUS_ROOT") var CITELLUS_LIVE, _ = strconv.Atoi(os.Getenv("CITELLUS_LIVE")) var FAILED, _ = strconv.Atoi(os.Getenv("RC_FAILED")) if CITELLUS_LIVE == 1 { // Report # of CPU's var CPUS = runtime.NumCPU() os.Stderr.WriteString(strconv.Itoa(CPUS)) os.Exit(INFO) } else if CITELLUS_LIVE == 0 { file, err := os.Open(CITELLUS_ROOT + "/proc/cpuinfo") if err != nil { os.Stderr.WriteString("Failure to open required file " + CITELLUS_ROOT + "/proc/cpuinfo") os.Exit(SKIP) } defer file.Close() counts := wordCount(file) os.Stderr.WriteString(strconv.Itoa(counts["processor"])) os.Exit(INFO) } else { os.Stderr.WriteString("Undefined CITELLUS_LIVE status") os.Exit(FAILED) } // Failback case, exiting as OK os.Exit(OKAY) } // https://forgetcode.com/go/2348-count-the-number-of-word-occurrence-in-given-a-file func wordCount(rdr io.Reader) map[string]int { counts := map[string]int{} scanner := bufio.NewScanner(rdr) scanner.Split(bufio.ScanWords) for scanner.Scan() { word := scanner.Text() word = strings.ToLower(word) counts[word]++ } return counts } Of course, lot of googling helped to start building the pieces. ...

June 14, 2020 · 2 min · Pablo Iranzo Gómez

Killercoda scenario creation

After some time checking the scenarios at https://learn.openshift.com, I decided to give it a try. With the help of Mario Vázquez, author of Getting Started with Kubefed, I did create two scenarios: How to use Citellus on Citellus: Troubleshooting automation KubeVirt on a ‘browser-based’ approach for MiniKube setup for validating KubeVirt: Kubernetes with VM Virtualization (versus the regular containers). You can check how them can be created by looking at their code at: killercoda Scenarios or the ‘playable’ version at https://killercoda.com/iranzo/. ...

June 11, 2019 · 1 min · Pablo Iranzo Gómez

First post on Red Hat blog

New blog post! After some great help and collaboration from all the colleagues reviewing, suggesting edits, we were able to prepare a blog post on Citellus, the tool we develop as part of our daily work solving cases. Check it out at Citellus: System configuration validation tool Enjoy! (and if you do, you can Buy Me a Coffee ) Pablo

June 7, 2018 · 1 min · Pablo Iranzo Gómez

DevConf.cz 2018: Citellus - Detecting common pitfalls of deployments

Citellus: Detecting common pitfalls of deployments https://github.com/citellusorg/citellus Recording at https://www.youtube.com/watch?v=SDzzqrUdn5A What is Citellus? Citellus is a framework populated by community-contributed scripts that automate detecting problems, including configuration issues, conflicts with package versions, and more. History: how did was it started? The tool, started by Robin Černín after a long weekend shift checking one and over again several sosreports for the same data on different hosts. It started with some tests + shell wrapper, and was added a python wrapper by Pablo Iranzo to bring in more powerful features. ...

January 27, 2018 · 8 min · Pablo Iranzo Gómez

DevConf.cz 2018!

Presentation at DevConf.cz 2018! As highlighted in the prior edition of the ‘What’s new’, we got a slot for DevConf.cz 2018. During that slot, my colleagues Martin, Pablo and myself were presenting on the history and basics of Citellus and how it helps on debugging issues and providing faster analysis of already known ones. It is possible to watch the recording at https://www.youtube.com/watch?v=SDzzqrUdn5A and the slides used at: https://github.com/citellusorg/citellus/blob/master/doc/devconfcz2018-presentation-revealmd.md Enjoy! (and if you do, you can Buy Me a Coffee ) ...

January 27, 2018 · 1 min · Pablo Iranzo Gómez
This blog is a participant in the Amazon Associate Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.